# Why does an instance trust an MCP server it reconnected to over HTTP without re-verifying the attestation bound to the original transport session? **Date of Record:** 2026 November 27 **Scope:** Applies to agent runtimes that connect to MCP servers over HTTP-native transports (Streamable HTTP, SSE) where provenance is established once at session establishment via an attestation (signed manifest, SBOM digest, or signed tool-schema hash) and where the transport can silently re-establish or migrate connections (reconnect after idle timeout, load-balancer failover, `Mcp-Session-Id` re-binding, redirect following). Does not apply to stdio transports where the process handle itself is the identity anchor, nor to cases where every request carries a fresh signed warrant. ## Core Distinction The failure is not "the server is malicious." It is that **attestation provenance is scoped to a session lifetime, but the transport identity it was verified against is not**. An agent verifies an MCP server's provenance (signed manifest, tool-schema digest, publisher identity) exactly once, at `initialize`, and binds that verdict to the in-memory `ClientSession` object. The HTTP transport underneath, however, has an independent lifecycle: it reconnects, follows redirects, re-binds `Mcp-Session-Id`, and resumes after `Last-Event-ID` replay — all without re-invoking the attestation check. The invariant that *should* hold — "the attestation I verified is the attestation of the endpoint I am currently talking to" — is silently violated because the verification lives one layer above the layer that mutates. The non-obvious part: the agent's own reasoning layer cannot detect this. The reconnected server returns a *valid* `initialize` result, a *valid* tool list, and *valid* responses. Nothing raises. The divergence is between two state machines (attestation verdict vs. transport identity) that were never cross-checked after the first handshake. ## What Was Observed A long-running agent held an MCP session to a code-analysis server for ~40 minutes of intermittent tool calls. Sequence of events: 1. At `initialize`, the runtime fetched the server's signed manifest over `https://mcp.vendor.example/.well-known/mcp-attestation`, verified the Ed25519 signature against a pinned publisher key, and computed a SHA-256 digest of the returned `tools/list` schema. Verdict `TRUSTED` cached on the `ClientSession`. 2. The HTTP connection went idle past the load balancer's 60s keepalive and was dropped. The client transport reconnected transparently — this is spec-permitted behavior for Streamable HTTP. 3. The load balancer routed the reconnect to a *different backend instance* of the same origin, which was running a newer server build. It issued a new `Mcp-Session-Id`. The client accepted the re-bind because the origin matched. 4. The new backend returned a `tools/list` whose `run_shell` tool had an *additional* optional parameter (`env`) and a subtly different `description`. The agent never re-fetched `tools/list` because its cache was keyed on `ClientSession`, not on transport generation. 5. The agent called `run_shell` with arguments shaped for the *old* schema. The new backend interpreted the extra field differently and executed with a modified environment. No error surfaced; the tool returned `exit_code: 0`. The attestation digest the agent had verified covered the *old* tool schema. The endpoint it was now talking to served a *different* schema under the *same* origin and the *same* (cached) `TRUSTED` verdict. Provenance was verified. Provenance was also wrong. ## Condition of Validity The cached-attestation pattern is only sound under a conjunction that is rarely all true: - **Origin stability implies identity stability.** False for load-balanced, blue/green, or canary backends that share an origin but not a build. - **Transport reconnect is semantically transparent.** False when reconnect crosses a `Mcp-Session-Id` re-bind, a redirect, or an SSE `Last-Event-ID` resume served by a different instance. - **Tool schema is immutable within a session.** False; MCP permits `notifications/tools/list_changed`, and even without it, a re-bound backend may serve a different list. - **The attestation covers the endpoint, not just the publisher.** Often false: many attestations sign the *publisher's* manifest, not the *served schema digest*, so a stale-schema swap passes signature verification. The invariant that must hold: **`verified_attestation.endpoint_fingerprint == current_transport.endpoint_fingerprint` at every tool invocation**, where the fingerprint includes the served `tools/list` digest and the resolved backend identity (not merely the origin). When any component of the conjunction fails, the cached `TRUSTED` verdict is no longer valid for the connection in use. ## Decision Boundary The boundary is: **re-verify when the transport generation changes, not when the session object changes.** Concretely: - Treat every transport event that can alter the peer — reconnect, redirect, `Mcp-Session-Id` re-bind, SSE resume with a new `Last-Event-ID` lineage — as incrementing a `transport_generation` counter. - Bind the attestation verdict to `(session_id, transport_generation, schema_digest)`, not to the session alone. - On generation increment, either (a) re-fetch and re-verify the attestation and schema digest before the next tool call, or (b) if the new digest differs from the verified one, *fail closed* rather than proceed on the stale verdict. - Do **not** rely on the model to notice schema drift from tool descriptions; the reasoning layer receives whatever `tools/list` the transport surfaces and has no memory of the prior digest. The failure mode to guard against is the "quiet upgrade": same origin, new build, valid signature, different schema. This passes every check except the one nobody runs — the cross-layer fingerprint equality. ## Operational Effect Without the guard, an agent's provenance assurance degrades to *publisher-level* trust while silently losing *artifact-level* trust. The blast radius is bounded only by how much the divergent schema can change argument interpretation — for tools that execute code, mutate state, or read secrets, a schema drift under a cached `TRUSTED` verdict is a supply-chain substitution that never trips a signature check. The correct posture: attestation is a property of a *specific connection generation*, and the runtime must treat a transport re-bind as a new, unverified peer until the fingerprint equality is re-established. ```python from __future__ import annotations import hashlib from dataclasses import dataclass, field class AttestationDriftError(RuntimeError): """Raised when a transport re-bind serves a schema that no longer matches the verified attestation.""" @dataclass class Attestation: publisher_key_id: str schema_digest: str # SHA-256 of the served tools/list schema at verification time endpoint_fingerprint: str # resolved backend identity, not just origin @dataclass class TransportState: session_id: str transport_generation: int = 0 current_schema_digest: str = "" current_endpoint_fingerprint: str = "" @dataclass class ProvenanceGuard: verified: Attestation transport: TransportState _bound_generation: int = field(default=-1) def on_connect(self, schema_bytes: bytes, endpoint_fingerprint: str) -> None: self.transport.transport_generation += 1 self.transport.current_schema_digest = hashlib.sha256(schema_bytes).hexdigest() self.transport.current_endpoint_fingerprint = endpoint_fingerprint def assert_current(self) -> None: # Fail closed if the connection generation changed since the verdict was bound. if self.transport.transport_generation != self._bound_generation: if self.transport.current_schema_digest != self.verified.schema_digest: raise AttestationDriftError( "transport re-bind serves schema digest " f"{self.transport.current_schema_digest!r} but verified attestation covers " f"{self.verified.schema_digest!r} (generation " f"{self.transport.transport_generation}); refusing tool call" ) if self.transport.current_endpoint_fingerprint != self.verified.endpoint_fingerprint: raise AttestationDriftError( "endpoint fingerprint changed under cached TRUSTED verdict; re-verify required" ) self._bound_generation = self.transport.transport_generation def invoke_tool(guard: ProvenanceGuard, tool_name: str, args: dict) -> dict: guard.assert_current() # ... dispatch to transport only after fingerprint equality holds ... return {"tool": tool_name, "args": args, "status": "dispatched"} ```