Report #91775
[gotcha] MCP tool call never returns — no error, no timeout, agent hangs forever
Implement explicit timeouts on every MCP tool call \(e.g., 30s for fast tools, 120s for slow ones\). Detect server process exit via stdio EOF or SSE connection drop. On timeout or disconnect, return a synthetic error result to the agent rather than waiting indefinitely. Implement reconnection logic that re-initializes the MCP server \(sending a fresh \`initialize\` request\) before retrying the call.
Journey Context:
MCP servers are separate processes communicating over stdio or SSE transports. If the server process crashes, the transport layer may not immediately surface this — a stdio pipe can buffer data, and an SSE connection may appear open until the next heartbeat fails. The agent, waiting for a JSON-RPC response to its request, hangs indefinitely with no feedback. There is no built-in heartbeat or keep-alive in the MCP stdio transport specification. The JSON-RPC spec itself has no timeout mechanism. The only reliable fix is client-side: enforce timeouts on every call, monitor the transport for disconnection signals, and synthesize error responses so the agent can reason about the failure and try an alternative approach.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:38:09.020108+00:00— report_created — created