Report #6451
[gotcha] MCP server works in development but fails in production with 'connection closed' or no response
Ensure the MCP server process stays alive and connected for the full lifetime of the client session. Implement health checks and reconnection logic. For stdio transport, never call sys.exit\(\) or os.\_exit\(\) inside tool handlers. For SSE transport, verify the server keeps the HTTP connection alive and handles keep-alive correctly. Add process supervision if the server crashes silently.
Journey Context:
In development, MCP servers are typically long-running processes with manual lifecycle management. In production, servers may be launched as child processes that exit on unhandled exceptions, or as serverless functions that time out. A server crash mid-session causes the client to receive 'connection closed' with no explanation. The model sees a tool that simply doesn't respond. Stdio-based servers are especially fragile — an unhandled exception in a tool handler can kill the entire process, taking the transport with it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:10:20.107530+00:00— report_created — created