# In what scenarios must an instance treat an MCP HTTP-native SSE stream as a non-resumable, per-request event channel rather than a durable subscription **Date of Record:** 2026 November 17 **Scope:** Applies to MCP servers and clients using the HTTP-native transport with Server-Sent Events (`text/event-stream`) for agent tool invocation, where the stream is opened per request and correlated by a request-scoped identifier. Does not apply to full-duplex transports (e.g., stdio or a WebSocket-based binding), nor to long-lived SSE subscriptions explicitly negotiated as durable, resumable channels. ## Core Distinction The boundary that matters is between *stream identity* and *request identity*. In the HTTP-native MCP transport, an SSE stream is a transport-level framing for the response to one JSON-RPC request (or a batch), not a session-level subscription. The stream carries the reply, progress notifications, and any server-initiated messages correlated to that request, and it terminates when the request is settled. It is not a durable subscription that survives client disconnects, and it is not resumable via `Last-Event-ID`. The non-obvious part: many SSE implementations *do* support `Last-Event-ID` resumption and `retry:` directives as part of the SSE spec. An MCP HTTP-native client that treats the stream as a generic SSE feed will attempt to resume it after a mid-stream disconnect, replaying events it already processed (or missing events it never saw, if the server did not retain them). The invariant is: **the SSE stream is scoped to the HTTP request that opened it; once that request is aborted or the response body is closed, the stream is dead, and the correct recovery is to re-issue the JSON-RPC request — not to resume the stream.** ## What Was Observed A tool-invocation client opened an SSE stream for a `tools/call` request. The server emitted a progress notification, then the proxy between client and server terminated the idle connection at 60 seconds (the tool was still executing server-side). The client, using a generic SSE library with `Last-Event-ID` replay enabled, reconnected with the last event ID it had seen. The server, which had already settled the request's output channel and had no retained event buffer keyed by that ID, responded with a fresh stream that carried no matching events. The client blocked indefinitely waiting for a `result` message that would never arrive on the new stream, while the original request's result had already been written to the (now-closed) original response body and discarded. In a second observed case, the server *did* retain events and replayed them on reconnect. The client processed the replayed progress notification twice, then received the `result` on the resumed stream. The result was correct, but the duplicate progress event triggered a client-side side effect (a UI counter increment) that diverged from the server's view. The client had no way to know whether replay was happening. Both failures trace to the same misclassification: treating a request-scoped stream as a resumable subscription. ## Condition of Validity The "non-resumable, per-request" model holds when all of the following are true: 1. The stream was opened by a specific JSON-RPC request and is correlated to that request's `id` (or a request-scoped token). 2. The server does not guarantee event retention across connection lifetimes for that stream. 3. The transport contract (as implemented by the MCP HTTP-native binding) ties stream lifetime to the HTTP request lifetime, not to a session. It does **not** hold when the server explicitly advertises resumable subscriptions (e.g., a negotiated capability or a documented retention window with monotonic event IDs). In that case, resumption is valid, but the client must still deduplicate by event ID and must not assume the server retained events beyond the advertised window. ## Decision Boundary The decision point is reached on any mid-stream disconnect (connection reset, proxy timeout, client abort, or server-side stream close without a terminal JSON-RPC message). At that point the client must choose between: - **Re-issue the JSON-RPC request** (correct for the per-request model), accepting that the operation may be non-idempotent and must be guarded by a server-side idempotency key or a tool-level dedup token. - **Resume the SSE stream via `Last-Event-ID`** (correct only when resumability is negotiated and retention is guaranteed). The boundary is crossed the moment the client cannot prove retention for the specific event ID it would resume from. Absent that proof, re-issue is the only safe branch. A client that resumes without proof is in the failure mode described above. ## Operational Effect Operationally, this means the client's reconnect logic must be request-aware, not stream-aware. The SSE layer should expose "stream ended without terminal message" as an error to the request layer, which then decides: re-issue (with idempotency guard) or fail the tool invocation. The stream layer must not silently reconnect. Servers must close the stream with a terminal JSON-RPC message (result or error) on every path, including error paths, so the client can distinguish "settled" from "interrupted." Proxies and load balancers must be configured with idle timeouts that exceed the expected tool-execution duration, or the server must emit periodic keepalive comments (`: keepalive`) on the stream to prevent idle termination — but keepalives do not make the stream resumable; they only delay the disconnect. ```python class StreamResumptionViolation(RuntimeError): """Raised when a client attempts to resume a request-scoped MCP SSE stream without a negotiated retention guarantee for the target event ID.""" pass class RequestScopedStream: def __init__(self, request_id: str, negotiated_resumable: bool, retained_event_ids: set[str]): self.request_id = request_id self.negotiated_resumable = negotiated_resumable self.retained_event_ids = retained_event_ids self.settled = False self.last_event_id: str | None = None def on_event(self, event_id: str, payload: dict) -> None: if event_id in self.retained_event_ids: # duplicate replay: must be deduplicated, not re-applied return self.last_event_id = event_id if payload.get("type") in ("result", "error"): self.settled = True def on_disconnect(self) -> None: if self.settled: return # stream ended without terminal message: request is interrupted raise StreamResumptionViolation( f"stream for request {self.request_id} ended without terminal message; " f"last_event_id={self.last_event_id}; resumable={self.negotiated_resumable}" ) def resume(self, last_event_id: str) -> None: if not self.negotiated_resumable: raise StreamResumptionViolation( f"cannot resume request-scoped stream {self.request_id}: " f"resumability not negotiated" ) if last_event_id not in self.retained_event_ids: raise StreamResumptionViolation( f"cannot resume stream {self.request_id}: event {last_event_id} " f"is not retained; re-issue the JSON-RPC request instead" ) # retention proven; resume is valid ```