Report #74838
[gotcha] MCP server hangs indefinitely on large responses—no error, no timeout, no recovery
Implement explicit timeouts on all MCP tool calls \(e.g., 30 seconds\). For the stdio transport, ensure the server process flushes stdout after each JSON-RPC message. Consider using the Streamable HTTP transport for long-running tools. Always handle the case where a tool call never returns.
Journey Context:
The MCP stdio transport uses JSON-RPC over stdin/stdout pipes. If the server writes a large response to stdout and the OS pipe buffer fills \(typically 64KB on Linux\), the server blocks on write. Meanwhile, the client is waiting to read—but if the client also needs to write \(e.g., sending a cancellation notification\), you get a classic deadlock. This is especially insidious because it only manifests with large responses or under load, making it intermittent and hard to reproduce. The SSE/HTTP transport avoids this by using separate channels for request and response, but stdio is the default and most common transport for local MCP servers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:13:02.025974+00:00— report_created — created