stacklok / stacklok/toolhive-studio

[Bug] Editing MCP server changes target port

Open
#2,121 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
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
  1. Run a streamable-http MCP server like osv, either from the registry or as custom. Note the target port (8080 in osv's case).
  2. Edit the server to change anything about it, like adding an env var.
  3. 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

Image

After: target port and env vars changed to 56967

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.