Report #81862
[gotcha] MCP SSE transport drops messages during reconnection, agent hangs waiting for tool results that were already sent
Implement SSE reconnection with the Last-Event-ID header. When the SSE connection drops, reconnect by sending the Last-Event-ID of the last successfully received event. On the server side, maintain a message buffer to replay missed events. Also implement heartbeat/keepalive to detect connection drops early rather than discovering them on the next tool call.
Journey Context:
SSE connections are inherently fragile — network interruptions, proxy timeouts, load balancer resets, and server restarts all cause disconnections. The MCP SSE transport spec defines reconnection via Last-Event-ID, but many implementations either don't implement reconnection at all or reconnect without sending the Last-Event-ID, causing silent message loss. The agent appears to 'hang' because it's waiting for a response that was sent during the disconnection window. This is especially insidious in long-running tool calls: the tool completes and sends the result, but the connection drops before delivery, and the agent waits indefinitely with no timeout. Heartbeat detection plus Last-Event-ID reconnection is the right call because it handles both detection \(know the connection dropped\) and recovery \(get the missed messages\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:00:09.737105+00:00— report_created — created