# What structural signals indicate SSE resumption has silently invalidated a session-scoped MCP capability grant **Date of Record:** 2026 November 26 **Scope:** Applies to MCP clients and servers using Streamable HTTP transport with `Last-Event-ID` based SSE resumption, where capability negotiation is bound to a session identifier established at `initialize`. Does not apply to stateless one-shot request/response MCP transports or to sessions that renegotiate capabilities on every stream reconnect. ## Core Distinction The failure mode is not "the stream dropped" and it is not "the session expired." It is the specific case where the SSE stream reconnects successfully, the event replay delivers every event the client missed, the session ID remains valid, and yet the *capability set the server will actually honor* has diverged from the capability set the client believes it negotiated. The transport layer reports health; the negotiation layer has silently mutated underneath it. Streamable HTTP MCP multiplexes two things that share a session identifier but have different lifetimes: the event stream (resumable, monotonic by `Last-Event-ID`, replayable) and the negotiated capability manifest (a point-in-time assertion made during `initialize`, not part of the event log, not replayed, not versioned). Resumption restores the *stream* to a prior sequence position. It does not restore the *capability grant* to a prior state. When the server's capability surface changes between the disconnect and the reconnect—because the server restarted with a different config, because a tool was hot-reloaded, because a downstream dependency that backed a capability went unhealthy—the replayed event stream will look perfectly continuous while the negotiated manifest is now a lie. The structural signal is the absence of a signal: a clean `200` on reconnect, a valid `Last-Event-ID` echo, contiguous event IDs, and *no capability re-assertion in the resume handshake*. Continuity of the event stream is treated by most client implementations as evidence of continuity of the session contract. It is not. ## What Was Observed A client agent held a session with `tools` capability negotiated to include `file_write` and `shell_exec`, plus a `sampling` capability with `maxTokens: 8192`. The SSE stream dropped mid-task at event ID `4471` during a long-running tool call. The client reconnected with `Last-Event-ID: 4471`. The server accepted the resume, replayed events `4472` through `4489`, and continued streaming. The client's event handler processed the replay and continued issuing tool calls. Every transport-level health check passed: HTTP 200, correct content-type, monotonic event IDs, no gaps. What the client did not observe: the server had been restarted between disconnect and reconnect. On restart it came up with `file_write` disabled (a policy flag flipped in its config) and `sampling.maxTokens` clamped to 2048 (a downstream model swap). The session ID was still in the server's session store—it had been persisted—so the resume was accepted. But the persisted session record did not include the negotiated capability manifest; the server treated capabilities as a property of the *current process config*, not of the session. The client's cached manifest said `file_write: enabled`. The server's live behavior said otherwise. The failure surfaced three tool calls later, when the agent issued a `file_write` tool call, received a `MethodNotFound` JSON-RPC error, and—because its error-handling path treated `MethodNotFound` as a transient routing failure rather than a capability revocation—retried twice before the token budget ran out. The agent had no signal that its negotiated contract had been invalidated; it interpreted a contract violation as a transient fault. A second observation, from a different deployment: the server *did* persist the capability manifest with the session, but on resume it replayed the event stream from `Last-Event-ID` while serving requests against the *current* manifest. The replay contained events generated under the old manifest (including a `tools/list_changed` notification that had been emitted before the restart but only now delivered). The client processed `tools/list_changed`, refetched the tool list, and got the new manifest—but only for tools, not for sampling parameters, which had no change notification. Split-brain capability state: tools correct, sampling stale. ## Condition of Validity The invariant that must hold for resumable SSE to be safe is: > For any session S, the capability manifest in effect at event sequence position N must equal the capability manifest in effect at every event sequence position M ≤ N that the client has observed, OR a capability-change event must appear in the replayed stream at or before the sequence position where the divergence occurred. This is a *stream-embedded* invariant. It requires that capability changes be modeled as events in the same ordered log as tool results and messages, not as out-of-band process state. When capabilities are process-scoped rather than session-scoped, the invariant cannot hold across a restart, because the restart resets the process state without emitting an event into the session's log. The condition of validity therefore fails whenever any of the following is true: - The session store persists the session ID but not the negotiated manifest. - The server's capability surface can change without emitting a `notifications/capabilities_changed` (or equivalent) event into every live session's stream. - The resume handshake does not include a manifest digest or version the client can compare against its cached copy. - The client treats stream continuity (contiguous event IDs) as sufficient evidence of contract continuity. ## Decision Boundary The boundary between "safe to resume" and "must renegotiate" is drawn by whether the client can *prove* manifest identity across the gap. Two mechanisms make this decidable: 1. **Manifest digest in the resume response.** The server's response to a resume request (the initial HTTP response headers before the SSE body, or a mandatory first event) carries a hash of the currently-effective capability manifest. The client compares against the hash it cached at `initialize`. Mismatch → the client must discard its cached manifest, treat all in-flight tool calls as having unknown status, and renegotiate. This converts a silent divergence into a hard, observable failure. 2. **Capability changes as sequenced events.** Any mutation of the capability surface emits an event with a sequence number into every active session's stream. A restart that changes capabilities must, on resume, synthesize a `capabilities_changed` event at the resume boundary (sequence = last delivered + 1) before any other event. The client then sees the change in-order and can react before issuing dependent calls. Below the boundary (digest matches, or change event received in-order): resume is safe, cached manifest stands. Above the boundary (digest mismatch with no change event, or change event arrives *after* a dependent call was already dispatched): the session is in an indeterminate capability state and every outstanding request's outcome is unknown. The non-obvious part of the boundary: a `tools/list_changed` notification is *not* sufficient. It covers tools but not sampling parameters, not resource subscription limits, not experimental capability flags. The digest must cover the entire manifest, or the change event must be emitted for every capability class that can mutate. ## Operational Effect An agent operating under this failure mode exhibits a specific, recognizable pathology: it retries `MethodNotFound` and `InvalidParams` errors as if they were transient, because its model of the world says the capability is present and the error must be a routing glitch. This burns token budget on retries that cannot succeed, and—worse—it can cause the agent to *route around* the failure by attempting alternative tools it believes are equivalent, which under a partially-mutated manifest may themselves be unavailable or may have different semantics than the agent assumes. The correct operational response, once the structural signal is recognized (resume succeeded but no manifest digest was checked), is to treat the session as capability-indeterminate: halt dependent tool dispatch, issue a fresh `initialize`-equivalent capability query against the same session, diff the result against the cached manifest, and reconcile in-flight calls whose outcomes are now unknown. Calls dispatched after the resume boundary but before the reconciliation must be treated as having unknown effect—the server may have executed them under the new manifest, refused them, or executed them partially. The architectural guardrail is to make capability identity a *first-class, stream-ordered, digest-verifiable* property of the session, never an implicit property of process state. The transport can resume; the contract must be re-proven. ```python import hashlib import json from dataclasses import dataclass, field from typing import Optional class CapabilityContinuityError(RuntimeError): """Raised when a resumed MCP session cannot prove capability manifest identity.""" @dataclass class CapabilityManifest: tools: dict sampling: dict experimental: dict = field(default_factory=dict) def digest(self) -> str: canonical = json.dumps( {"tools": self.tools, "sampling": self.sampling, "experimental": self.experimental}, sort_keys=True, separators=(",", ":"), ) return hashlib.sha256(canonical.encode()).hexdigest() @dataclass class SessionState: session_id: str last_event_id: int cached_manifest: CapabilityManifest cached_digest: str def resume_session( state: SessionState, resume_response_headers: dict, server_live_manifest: CapabilityManifest, replayed_events: list, ) -> CapabilityManifest: """ Validate a Streamable HTTP SSE resume against the cached capability manifest. Returns the manifest the client should now trust, or raises if identity cannot be proven. """ header_digest: Optional[str] = resume_response_headers.get("x-mcp-capability-digest") # Path 1: server advertised a manifest digest on resume. if header_digest is not None: if header_digest != state.cached_digest: # Divergence proven. Only safe if a change event preceded any dependent call. change_events = [ e for e in replayed_events if e.get("method") == "notifications/capabilities_changed" and e.get("id", 0) > state.last_event_id ] if not change_events: raise CapabilityContinuityError( f"manifest digest mismatch on resume: cached={state.cached_digest} " f"server={header_digest} with no in-stream change event" ) return server_live_manifest return state.cached_manifest # Path 2: no digest advertised. Fall back to in-stream change events, but this # is only sound if the change event covers every mutated capability class. change_events = [ e for e in replayed_events if e.get("method") == "notifications/capabilities_changed" and e.get("id", 0) > state.last_event_id ] if change_events: return server_live_manifest # No digest, no change event: cannot prove continuity. If the live manifest # differs from cache in any class, the session is capability-indeterminate. if server_live_manifest.digest() != state.cached_digest: raise CapabilityContinuityError( "resume accepted without manifest digest or change event, but live manifest " "diverges from cache; session is capability-indeterminate" ) return state.cached_manifest ```