You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Upon clicking the "Connect" button, a new server is spawned, but the old server isn't shut down.
To Reproduce
Steps to reproduce the behavior:
Click "Connect"
Click "Connect" again
Observe that the child process for the first server is still running
Expected behavior
The child process for the first server should be shut down.
Logs
not applicable
Additional context
You need to call backingServerTransport.close() on the old backing server when you're starting up the new one. You should probably also clean up the proxy connection. Happy to contribute a PR.
Excellent small world repro, @Skn0tt. I verified that two logs are created and the previous server process continues until the inspector is closed and both processes are killed.
Two logs after clicking Connect again
Two processes
After closing the inspector, both processes are killed
How to handle
You need to call backingServerTransport.close() on the old backing server when you're starting up the new one. You should probably also clean up the proxy connection.
Makes sense, however I question whether we should leave the Connect button enabled when there is an existing connection. I don't see the use in it, and clearly it is problematic.
@olaservo Have you seen any use case that would break if we just disable the button once we have a connection? If no one has a good reason why, I say we head off this connection management issue by making the button aware of the connection state.
I use the inspector while developing my MCP server, and the button is crucial for restarting the MCP server. So please don't disable it - but you could change its text to "Reconnect" or "Restart".
You need to call backingServerTransport.close() on the old backing server when you're starting up the new one. You should probably also clean up the proxy connection. Happy to contribute a PR.
@Skn0tt Would you like to create a PR? I'll be happy to review it. I can do the PR if you'd like, but It is rewarding to fix the bug you found. :)
Activity
cliffhall commentedon Mar 24, 2025
Hi @Skn0tt
I tried this with both stdio and sse servers and didn't see any additional processes spawned.
Can you provide more detailed steps to reproduce and/or screenshots?
Skn0tt commentedon Mar 25, 2025
Hi Cliff! Here's a repro: https://github.com/Skn0tt/mcp-inspector-repro
cliffhall commentedon Mar 25, 2025
Excellent small world repro, @Skn0tt. I verified that two logs are created and the previous server process continues until the inspector is closed and both processes are killed.
Two logs after clicking Connect again
Two processes
After closing the inspector, both processes are killed
How to handle
Makes sense, however I question whether we should leave the Connect button enabled when there is an existing connection. I don't see the use in it, and clearly it is problematic.
@olaservo Have you seen any use case that would break if we just disable the button once we have a connection? If no one has a good reason why, I say we head off this connection management issue by making the button aware of the connection state.
Skn0tt commentedon Mar 26, 2025
I use the inspector while developing my MCP server, and the button is crucial for restarting the MCP server. So please don't disable it - but you could change its text to "Reconnect" or "Restart".
cliffhall commentedon Mar 26, 2025
@Skn0tt Would you like to create a PR? I'll be happy to review it. I can do the PR if you'd like, but It is rewarding to fix the bug you found. :)
Skn0tt commentedon Mar 27, 2025
Sure, there you go: #216
cliffhall commentedon Mar 31, 2025
Thanks, @Skn0tt!