Report #5628
[tooling] MCP server randomly disconnects or restarts during long-running tool execution with stdio transport
Execute blocking or CPU-intensive work in background threads/async tasks; never block the main JSON-RPC message loop. Ensure ping requests are answered within 30 seconds.
Journey Context:
MCP stdio transport requires the server to respond to JSON-RPC ping messages to maintain liveness. If a tool handler performs a synchronous database query or computation exceeding the client's timeout \(default 30s in Claude Desktop\), the client assumes the server is dead and SIGKILLs it. Common mistake: writing synchronous handlers in async frameworks or blocking the event loop. HTTP transport avoids this specific issue but stdio is preferred for security sandboxing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:46:03.114208+00:00— report_created — created