# Under what conditions must an instance refuse an MCP tool result whose transport attestation was minted against a different capability snapshot than the one it negotiated **Date of Record:** 2026 November 22 **Scope:** Applies to LLM agents acting as MCP clients that negotiate a server's `tools/list` capability set, receive per-result transport-level attestations (signed envelopes binding result bytes to a capability snapshot hash), and must decide whether to consume or reject a result. Does not apply to stateless single-shot tool calls where the client never caches a capability snapshot, nor to servers that emit no attestation envelope at all (in which case integrity is out of scope by construction). ## Core Distinction There are two things an MCP client can verify about a tool result, and conflating them is the root of the failure. The first is **content integrity**: the bytes the server returned hash to the digest the server signed. The second is **capability binding**: the digest the server signed was computed over a *capability snapshot* — the exact `tools/list` manifest, schema version, and server-side policy epoch — that the client and server jointly agreed on at session open. A result can pass content integrity perfectly while being bound to a snapshot the client never negotiated. That is the boundary condition: **a cryptographically valid signature over a result whose capability snapshot hash does not match the client's cached negotiation is not a valid result — it is a valid result for a different session.** The non-obvious part is that this mismatch is *benign-looking*. The signature verifies. The schema validates. The JSON parses. Every local check passes. The only failing check is a cross-reference between the envelope's `capability_snapshot` claim and the client's own record of what it negotiated — a comparison the client must actively perform and must be willing to fail closed on. ## What Was Observed A client agent opened a session with an MCP server and negotiated a capability snapshot. During `tools/list`, the server advertised seven tools including `read_file` with a schema whose `path` parameter was constrained to a sandbox root, and `http_fetch` with an allowlisted host set. The client cached snapshot hash `S1 = H(manifest_bytes || schema_version || policy_epoch)`. Mid-task, the agent issued an `http_fetch` call. The server returned a result envelope: ``` { "result": {...}, "attestation": { "capability_snapshot": "S2", "result_digest": "d4e1...", "sig": "MEUCIQ..." } } ``` `S2 ≠ S1`. The server had, between negotiation and this call, hot-reloaded its policy: the allowlisted host set had been widened (an operator added a host) and the `read_file` sandbox root had been moved. The manifest bytes changed, so the snapshot hash changed to `S2`. The server signed the result against `S2` — correctly, honestly, with its current key — and the signature verified against the server's published key. The client's naive verifier checked `sig` over `result_digest` and accepted. It never compared `capability_snapshot` to `S1`. The result was consumed. The agent then issued a `read_file` call against a path that had been valid under `S1`'s sandbox root but was now *outside* the widened-and-moved root under `S2` — because the agent was reasoning about the sandbox from its stale `S1` manifest while the server enforced `S2`. The call succeeded against `S2`'s root but returned a file the agent's plan assumed was unreachable. Downstream, the agent's plan branched on "file not found" and instead got content, and the divergence compounded across four subsequent tool calls before the task failed an unrelated assertion. The failure was not a forged signature, a tampered result, or an injection. It was a **capability snapshot skew**: result integrity held, capability binding silently broke, and the agent's model of the server's policy drifted from the server's actual policy without a single local check firing. A second observation sharpened the mechanism. When the client was instrumented to log `attestation.capability_snapshot` on every result, skew appeared in two distinct shapes: **forward skew** (server at `S2`, client at `S1`, server policy changed after negotiation) and **backward skew** (server at `S0`, client at `S1`, a load-balanced replica still serving an older manifest). Backward skew is the more dangerous of the two because the older snapshot is often *more permissive* in ways the client has already discounted — the client's plan assumes a restriction that the stale replica does not enforce. ## Condition of Validity A result is consumable by the agent if and only if all of the following hold simultaneously: 1. `result_digest` recomputed over the canonicalized result bytes equals the envelope's claimed digest. 2. `sig` verifies over the canonicalized `(result_digest || capability_snapshot || nonce || session_id)` tuple against the server's key material valid *at the envelope's stated signing epoch*. 3. `capability_snapshot` equals the client's cached `S_negotiated` — **byte-exact**, not "compatible" and not "same tool names." 4. The envelope's `session_id` and `nonce` match the outstanding request the client is currently awaiting (replay binding). 5. No capability snapshot transition has been *announced* to the client that supersedes `S_negotiated`; if the server intends to change snapshots mid-session, it must do so through an explicit renegotiation that updates the client's cache *before* results bound to the new snapshot are honored. Condition 3 is the one that fails silently. Conditions 1, 2, and 4 are what naive verifiers implement. Condition 5 is what turns a hard reject into a recoverable one. The invariant, stated precisely: **for every result the agent consumes, the capability snapshot under which the result was produced must be identical to the capability snapshot under which the agent formed the plan that consumes it.** Integrity without binding is theater; binding without renegotiation is a deadlock. ## Decision Boundary The client must fail closed — reject the result and halt the dependent plan branch — when `capability_snapshot ≠ S_negotiated` **and** no renegotiation handshake has completed for the envelope's snapshot. It must not: - Accept the result because the signature verifies. Signature validity is orthogonal to binding. - Accept the result because the schema still validates. A widened allowlist still validates the old schema. - Silently update `S_negotiated` to the envelope's snapshot. This is the most tempting error and the worst: it retroactively legitimizes results the agent's plan was never built to reason about, and it converts a detectable skew into an undetectable one. - Retry against the same server hoping for a different snapshot. Skew is a policy state, not a transient. The client *may* accept a skewed result only under an explicit, narrow escape: if it re-negotiates `tools/list`, receives the new manifest, recomputes `S_new`, verifies `S_new == envelope.capability_snapshot`, and *re-plans* the dependent branch against `S_new` from a checkpoint taken before the skewed result was requested. The result is then consumed as if it were the first result of a new session. Without the re-plan, renegotiation alone is insufficient — the plan state is still `S1`-shaped even though the cache now says `S2`. The boundary is sharp: **skew is a plan-invalidation event, not a result-validation event.** The result is fine. The plan is what's stale. Rejecting the result is the mechanism; invalidating the plan is the point. ## Operational Effect When the client enforces snapshot binding, three things change operationally. First, **hot-reloading servers become visible**. A server that mutates its manifest mid-session without renegotiation will now produce a stream of rejected results the moment it reloads. This is correct behavior — the server is violating the renegotiation contract — but it surfaces as a client-side error, which means operators must be prepared to read "capability snapshot skew" as a *server* misconfiguration signal, not a client bug. The guardrail should log the server's advertised snapshot, the client's negotiated snapshot, and the policy epoch delta, so the operator can see exactly which reload caused it. Second, **load-balanced fleets require snapshot pinning at the routing layer**. The backward-skew case (stale replica) cannot be fixed at the client — the client is correctly rejecting a result from a replica that never should have received the request. The fix is session affinity by `S_negotiated`: requests from a session pinned to `S1` must route only to replicas serving `S1`, or the session must be renegotiated on replica change. Without this, the client's correct rejection becomes a hard availability failure under rolling deploys. Third, **the agent's checkpoint must carry `S_negotiated`**. A mid-task checkpoint that records plan state but not the negotiated snapshot cannot resume correctly: on resume, the agent has no basis to reject a result bound to a snapshot it never knew about. The snapshot hash belongs in the checkpoint alongside the plan, and resume must re-verify the server's current snapshot against the checkpointed one before issuing any tool call. A checkpoint without the snapshot is a checkpoint that has already forgotten what it agreed to. The compounding failure in the observed case — four tool calls of silent divergence — is the cost of not enforcing this boundary. Each call was locally valid, each result was honestly signed, and the plan drifted one policy epoch away from reality per step. The invariant that bounds it is cheap to check and expensive to omit. ```python import hashlib import hmac from dataclasses import dataclass class CapabilitySnapshotSkew(RuntimeError): """Raised when an MCP result's attestation is bound to a capability snapshot the client did not negotiate for the active session.""" class AttestationIntegrityError(RuntimeError): """Raised when a result envelope fails digest or signature verification.""" @dataclass(frozen=True) class NegotiatedSession: session_id: str capability_snapshot: str # S_negotiated, byte-exact hash of manifest server_key: bytes def _canonical_digest(result_bytes: bytes) -> str: return hashlib.sha256(result_bytes).hexdigest() def verify_and_bind( session: NegotiatedSession, envelope: dict, result_bytes: bytes, ) -> None: """Verify content integrity AND capability binding. Fails closed on any skew. Never mutates session.capability_snapshot. """ # 1. Content integrity: recompute digest over canonical result bytes. recomputed = _canonical_digest(result_bytes) if not hmac.compare_digest(recomputed, envelope["attestation"]["result_digest"]): raise AttestationIntegrityError( f"result digest mismatch: envelope={envelope['attestation']['result_digest']} " f"recomputed={recomputed}" ) # 2. Replay binding: envelope must answer the outstanding session request. if envelope.get("session_id") != session.session_id: raise AttestationIntegrityError( f"session mismatch: envelope={envelope.get('session_id')} " f"negotiated={session.session_id}" ) # 3. Signature over the binding tuple, not just the result. signing_input = "|".join( [ envelope["attestation"]["result_digest"], envelope["attestation"]["capability_snapshot"], envelope.get("nonce", ""), session.session_id, ] ).encode() expected_sig = hmac.new(session.server_key, signing_input, hashlib.sha256).hexdigest() if not hmac.compare_digest(expected_sig, envelope["attestation"]["sig"]): raise AttestationIntegrityError("attestation signature invalid") # 4. Capability binding: the decisive check that naive verifiers omit. envelope_snapshot = envelope["attestation"]["capability_snapshot"] if envelope_snapshot != session.capability_snapshot: raise CapabilitySnapshotSkew( "result bound to capability snapshot " f"{envelope_snapshot!r} but session negotiated " f"{session.capability_snapshot!r}; plan state is stale, " "renegotiate tools/list and re-plan from checkpoint before consuming" ) def consume_tool_result(session: NegotiatedSession, envelope: dict, result_bytes: bytes) -> dict: """Entry point the agent calls for every tool result. Fails closed on skew.""" verify_and_bind(session, envelope, result_bytes) return envelope["result"] ```