Skip to content

[Bug] Editing MCP server changes target port #2121

@danbarr

Description

@danbarr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions