# Why does an instance negotiate MCP capabilities over HTTP and silently lose streamable-resource support when the server falls back to SSE? **Date of Record:** 2026 December 3 **Scope:** Applies to MCP clients negotiating capabilities over HTTP transport (JSON-RPC over POST, streamable HTTP, and SSE fallback) where server and client version skew exists and the server advertises a superset of capabilities in `initialize` but downgrades the transport mid-session. Does not apply to stdio transport, where capability negotiation is atomic and transport is fixed for the process lifetime. ## Core Distinction The failure is not "the server doesn't support streaming resources." The failure is that the client's *cached capability set* is derived from the `initialize` result, while the *actual transport binding* is decided later, per-request, by the HTTP layer's content negotiation and fallback logic. These two facts are conflated by nearly every MCP client implementation because in stdio they are always identical. Concretely: a server returns `capabilities: { resources: { subscribe: true, listChanged: true }, tools: {}, prompts: {} }` in its `initialize` response over `application/json`. The client records `subscribe: true`. But the server is behind a proxy that does not support long-lived chunked responses, so the first `resources/subscribe` attempt is answered with a 200 that carries an SSE stream header the proxy truncates after 30 seconds, or the server itself falls back to a polling-style SSE endpoint that emits `resource_updated` notifications only on reconnect. The client believes it holds a live subscription; the server believes it granted a degraded one. Neither is wrong under its own reading of the protocol, and the divergence is invisible until a resource changes and no notification arrives. The distinction that matters operationally: **`initialize` advertises intent, not binding.** Capability negotiation in MCP is a two-party declaration of what each side *can* do, not a contract about *how* the transport will carry it. Under HTTP with backward-compatible fallback, there is a third party—the transport layer and any intermediary—that can unilaterally downgrade the binding after negotiation completes. ## What Was Observed A client agent (call it C) connecting to an MCP server (S) at `https://s.internal/mcp`, version skew: C speaks protocol `2025-03-26`, S supports `2024-11-05` and `2025-03-26` but is configured to prefer the older revision when the client's `MCP-Protocol-Version` header is absent. Trace: 1. C sends `initialize` with `protocolVersion: "2025-03-26"` and `capabilities: { roots: { listChanged: true }, sampling: {} }`. 2. S responds with `protocolVersion: "2024-11-05"` (its preferred fallback), `capabilities: { resources: { subscribe: true }, tools: { listChanged: true } }`. 3. C, being backward-compatible, accepts the older revision. It records `resources.subscribe = true` and `tools.listChanged = true`. It does **not** re-negotiate transport, because in `2024-11-05` the transport was implicitly SSE-only and C's HTTP client is configured to accept both `text/event-stream` and `application/json` responses. 4. C issues `resources/subscribe` for `file:///workspace/state.json`. S returns 200 with `Content-Type: text/event-stream` and begins streaming. C's HTTP client, configured with a 60s idle timeout suitable for request/response, closes the stream after 60s of no events. 5. S treats the closed stream as a client-side unsubscribe (per its `2024-11-05` semantics, where the SSE connection *is* the subscription). It does not send a final event. C believes the subscription is active. 6. `state.json` changes at t+90s. S emits `notifications/resources/updated` to zero subscribers. C never learns. The non-obvious part: at step 3, C's backward-compatibility path *silently disabled its own reconnection logic*. C had a reconnect-on-close handler for `2025-03-26` streamable HTTP (where the spec mandates resumption via `Last-Event-ID`), but the handler was gated on `protocolVersion >= 2025-03-26`. Under the negotiated `2024-11-05`, no resumption mechanism exists, so the handler was a no-op. The version downgrade didn't just change the wire format; it removed the recovery primitive, and the capability cache didn't record that the *recovery contract* had changed. ## Condition of Validity This failure requires all four of the following to co-occur: - **Transport is HTTP with fallback.** Stdio has no fallback path; the transport is fixed at spawn. WebSocket-only has no content-negotiation downgrade. - **Version skew exists in the direction where the server's preferred revision is older than the client's.** If S prefers `2025-03-26` and C is on `2024-11-05`, C simply can't use streamable HTTP features and will not falsely believe it can. The dangerous direction is client-newer-than-server, because the client's backward-compat layer is the thing that loses information. - **The capability set is cached from `initialize` and not re-derived from the transport binding.** Any client that recomputes effective capabilities per-request from the actual `Content-Type` and stream liveness is immune. - **The server's capability advertisement is a superset of what its fallback transport can actually deliver.** A server that correctly reports `resources: { subscribe: false }` when it knows it will fall back to a truncated SSE endpoint is safe. The bug is in servers that advertise the *protocol-level* capability without accounting for the *deployment-level* transport constraint. When any of these is absent, the failure does not manifest, which is why it survives testing: a test harness that runs client and server at the same version over a direct connection with no proxy will never reproduce it. ## Decision Boundary The invariant a client must enforce: > **Effective capability = advertised capability ∩ transport-supported capability ∩ recovery-supported capability, evaluated at the moment of use, not at `initialize`.** The decision boundary is where to evaluate this intersection. Three candidate points: 1. **At `initialize` return.** Insufficient—transport binding isn't known yet, and intermediaries can change it later. 2. **At first use of the capability.** Necessary but not sufficient—the transport can degrade *after* first successful use (the 60s idle-close above happens after the subscription is established). 3. **At every notification-expecting operation and on every stream close.** This is the correct boundary. The client must treat stream close as a capability event, not a transport event. The guardrail: on any stream close for a subscription-bearing operation, the client must (a) mark the subscription `UNKNOWN`, not `ACTIVE` and not `CLOSED`; (b) attempt resumption *only if* the negotiated revision defines a resumption primitive; (c) if no resumption primitive exists, degrade to polling with an explicit `resources/read` reconciliation against the last-known content hash; (d) if the content hash differs and no notification was delivered, emit a `capability_desync` signal to the agent's planner so it does not proceed on stale state. The boundary the agent must not cross: it must never treat "no notification received" as "resource unchanged." Under a degraded subscription these are indistinguishable, and that is precisely the amnesia pattern—the agent's memory of the resource is stale but its confidence in that memory is unchanged. ## Operational Effect Downstream consequences when this boundary is unguarded: - **Silent stale reads.** The agent proceeds on a `state.json` snapshot from t=0 while the file changed at t=90s. No error surfaces. This is the classic cold-start amnesia pattern relocated into the transport layer. - **Error compounding across tool calls.** A `tools/call` that reads the stale resource and writes a derived artifact propagates the staleness. Because `tools.listChanged` was also advertised and also silently unsubscribed, the agent doesn't learn the tool schema changed either. - **False consensus in multi-agent setups.** If two agents subscribe to the same resource and one reconnects (getting fresh state) while the other doesn't, they hold divergent views of the same resource with equal confidence. Any auditor agent comparing their outputs will see a "disagreement" that is actually a transport artifact. - **Replay discrepancies.** A recorded session replayed against a re-initialized server may negotiate a *different* revision (if the server's fallback preference is load-dependent or config-drift-dependent), producing a different effective capability set and therefore different behavior for identical inputs. Non-reproducible agent runs. The mitigation that actually works is not "pin the protocol version"—that breaks the backward-compat requirement that motivated the fallback in the first place. It is to make the capability cache *transport-aware and revocation-aware*: every cached capability carries the binding it was established under and a liveness token, and any liveness loss demotes the capability to `UNKNOWN` until re-verified. The agent's planner must then treat `UNKNOWN` capabilities as requiring explicit reconciliation before use, converting a silent staleness into a visible, bounded cost. ```python import hashlib from dataclasses import dataclass, field from enum import Enum from typing import Optional class CapabilityDesyncError(RuntimeError): """Raised when a cached capability's transport binding has degraded and the agent attempts to rely on it without reconciliation.""" class BindingState(Enum): ACTIVE = "active" UNKNOWN = "unknown" # stream closed, no resumption primitive REVOKED = "revoked" # server explicitly withdrew @dataclass class CapabilityBinding: name: str protocol_version: str transport: str # "json" | "sse" | "streamable-http" state: BindingState = BindingState.ACTIVE last_known_hash: Optional[str] = None resumption_supported: bool = False RESUMPTION_VERSIONS = {"2025-03-26"} # only these define Last-Event-ID resume def negotiate_binding( capability: str, negotiated_version: str, response_content_type: str, ) -> CapabilityBinding: transport = { "text/event-stream": "sse", "application/json": "json", }.get(response_content_type.split(";")[0].strip(), "unknown") return CapabilityBinding( name=capability, protocol_version=negotiated_version, transport=transport, resumption_supported=negotiated_version in RESUMPTION_VERSIONS, ) def on_stream_close(binding: CapabilityBinding) -> CapabilityBinding: # Stream close is a capability event, not a transport event. if binding.resumption_supported: # resumable: keep ACTIVE, caller will re-issue with Last-Event-ID return binding binding.state = BindingState.UNKNOWN return binding def require_live_capability( binding: CapabilityBinding, current_resource_hash: Optional[str], ) -> None: if binding.state is BindingState.REVOKED: raise CapabilityDesyncError( f"capability {binding.name!r} revoked by server; " f"agent must re-initialize before use" ) if binding.state is BindingState.UNKNOWN: # No resumption primitive under this negotiated revision. # Agent must reconcile by explicit read, not assume unchanged. if current_resource_hash is None: raise CapabilityDesyncError( f"capability {binding.name!r} binding UNKNOWN under " f"protocol {binding.protocol_version!r} (transport={binding.transport}); " f"no resumption primitive available, explicit reconciliation required" ) if binding.last_known_hash and current_resource_hash != binding.last_known_hash: raise CapabilityDesyncError( f"capability {binding.name!r} desync: resource changed while " f"subscription was degraded (was {binding.last_known_hash[:8]}, " f"now {current_resource_hash[:8]}); agent state is stale" ) def reconcile(binding: CapabilityBinding, content: bytes) -> CapabilityBinding: h = hashlib.sha256(content).hexdigest() if binding.last_known_hash and binding.last_known_hash != h: # divergence confirmed; surface it before re-arming raise CapabilityDesyncError( f"reconciliation found divergence on {binding.name!r}; " f"planner must invalidate derived artifacts" ) binding.last_known_hash = h binding.state = BindingState.ACTIVE return binding ```