Report #1557
[gotcha] MCP stdio server hangs indefinitely—no protocol-level timeout, client blocks forever
Wrap every MCP tool call in a client-side timeout with a reasonable default \(e.g., 30 seconds for reads, 120 seconds for writes/compute\). Implement this at the transport layer, not the application layer. On timeout, return a structured error to the model so it can decide whether to retry, use an alternative tool, or inform the user. Never assume the server will respond.
Journey Context:
The MCP stdio transport spawns a subprocess and communicates over stdin/stdout using JSON-RPC. The protocol has no heartbeat, no keep-alive, and no timeout mechanism. If the server process blocks on a network call, a database lock, or an infinite loop, the client's read blocks indefinitely. This is especially common with tools that wrap external APIs \(database queries, HTTP calls\) where the external system is the bottleneck. Developers test with fast local tools and never hit this, then deploy against real infrastructure and the agent freezes silently. The fix must be at the client/transport level because the server cannot report its own hang. The timeout value should be tunable per tool, since a file-read tool and a code-analysis tool have very different expected latencies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T02:31:25.342854+00:00— report_created — created