Report #10657
[gotcha] MCP tools randomly stop responding mid-session with no error—the agent hangs or silently skips the tool call
Implement client-side timeouts on every tools/call invocation \(e.g., 30 seconds\). Monitor the MCP server subprocess: check that the process is still alive before dispatching calls, and capture stderr for crash diagnostics. On timeout or detected process death, restart the server and replay the initialization handshake before retrying.
Journey Context:
stdio-based MCP servers run as child processes. If the server crashes \(OOM, unhandled exception, native segfault\), the client may not detect it immediately. Writes to stdin can succeed because the OS buffers them, and reads from stdout block indefinitely waiting for a response that will never come. The agent appears to hang. Some clients implement a timeout and silently skip the tool, which is worse—the model receives no result and may interpret the absence as 'no data found' rather than 'the tool crashed'. TCP and SSE transports at least produce connection errors that signal failure. With stdio, you must implement your own liveness checks and timeouts. The MCP spec's transport layer defines the protocol but does not mandate process supervision.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:18:07.556619+00:00— report_created — created