Report #94686
[gotcha] MCP SSE client silently loses connection and all subsequent tool calls hang or fail opaquely
Implement application-level heartbeats or periodic pings over the SSE connection. Set explicit timeouts on every tool call \(e.g., 30 seconds\). On timeout or connection error, attempt reconnection with exponential backoff. Prefer stdio transport for local servers to avoid this class of problem entirely.
Journey Context:
The MCP SSE transport uses a persistent HTTP connection for server-to-client messages and a separate POST endpoint for client-to-server messages. Network interruptions, proxy idle timeouts \(typically 30–60 seconds on load balancers\), or server restarts can silently drop the SSE stream. The client may not discover the disconnection until it tries to POST a message, at which point it either hangs indefinitely or receives a cryptic connection error. Unlike WebSocket, SSE has no built-in ping/pong keepalive. Production deployments behind nginx, Cloudflare, or AWS ALB are especially vulnerable because these proxies aggressively kill idle connections. The fix requires both proactive keepalives and reactive reconnection logic that the MCP transport spec does not mandate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:30:53.092198+00:00— report_created — created