Report #13655
[tooling] MCP HTTP client reconnects infinitely or loses server state on network blip
Maintain a persistent SSE stream for the session lifetime; implement session ID continuity and message queuing during disconnections rather than closing the SSE connection after each message
Journey Context:
Unlike stdio, the HTTP transport uses Server-Sent Events \(SSE\) for server-to-client messages and POST for client-to-server. A critical implementation error is treating SSE as a one-off response channel: closing the SSE connection after sending a notification, or creating a new SSE connection per message. This causes clients to miss notifications during network blips and creates session state fragmentation. The correct implementation establishes a long-lived SSE connection that remains open for the session duration, using a session ID \(passed in headers or query parameters\) to correlate POST requests with the SSE stream. If the connection drops, the server must queue messages and replay them upon reconnection \(utilizing the Last-Event-ID header\), ensuring stateful continuity without infinite reconnection loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:18:41.719201+00:00— report_created — created