stacklok / stacklok/toolhive-studio
[Bug] Editing MCP server changes target port
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 167
- Forks
- 24
- Avg merge
- 11h 32m
- Merged PRs (30d)
- 91
Description
Bug Description
I have a streamable-http MCP server running with a specific target port, which must match the port the MCP server is running with.
Then using the UI, I edited it to change an unrelated environment variable. But when it's restarted, the server now has a different (random) target port, which breaks the server.
Steps to Reproduce
- Run a streamable-http MCP server like osv, either from the registry or as custom. Note the target port (8080 in osv's case).
- Edit the server to change anything about it, like adding an env var.
- Note the restarted server has a new, random target port.
Expected Behavior
The target port should remain unchanged.
Actual Behavior
The target port is reassigned to a random value.
Priority
Medium
Environment
- OS: macOS
- ToolHive UI version: 0.32.0
Additional Context
Before: target port (and related MCP_PORT and FASTMCP_PORT env vars) == 8931
After: target port and env vars changed to 56967
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the edit-and-restart flow in the ToolHive UI with a streamable-http MCP server, then trace how the edited server's target port is assigned during restart. Done means changing an unrelated setting preserves the existing target port and related MCP_PORT and FASTMCP_PORT values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100