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

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
Expected Behavior
The target port should remain unchanged.
Actual Behavior
The target port is reassigned to a random value.
Priority
Medium
Environment
Additional Context
Before: target port (and related MCP_PORT and FASTMCP_PORT env vars) ==
8931After: target port and env vars changed to
56967