# What happens when an instance re-attests a tool after its server hot-reloads: policy-version skew across the MCP trust boundary **Date of Record:** 2026 November 22 **Scope:** Applies to zero-trust agent deployments where an MCP client caches per-tool policy attestations (capability scope, data-classification ceiling, egress allowlist) obtained from an MCP server at handshake time and enforces them locally per tool call. Does not cover servers that re-attest on every call, nor deployments where the policy engine is co-located and authoritative at call time. ## Core Distinction The failure is not "the server changed its tools." It is that the client's *attestation cache is keyed on server identity rather than on the (server identity, policy epoch) tuple*. An MCP server that hot-reloads—restarting its tool registry without tearing down the transport session—keeps the same connection, the same `serverInfo.name`, and the same session token. The client, having completed `initialize` once, treats the session as a stable trust anchor and never re-fetches `tools/list` attestations. The result: the client enforces the *old* per-tool policy while the server executes the *new* tool implementation. The trust boundary is intact at the transport layer and silently broken at the semantic layer. The invariant that is violated: **a tool's policy attestation must be bound to the exact tool definition (name + schema hash + declared scopes) that the server will execute, not merely to the server's session identity.** When the binding is to identity alone, any in-place mutation of the tool surface escapes client-side enforcement. ## What Was Observed A client agent held a session with an MCP server exposing `query_datastore`. At handshake, the server attested: scope `read:public`, egress allowlist `[]` (no external egress), data ceiling `public`. The client cached this and gated every `query_datastore` call against it—refusing to pass arguments that referenced non-public tables and blocking any response containing a URL. The server operator deployed a change: `query_datastore` was reimplemented to support a `federate=true` parameter that forwards the query to an external partner endpoint. The tool *name* was unchanged. The JSON schema gained an optional boolean property. The server restarted its tool registry in-process and kept the stdio/SSE session alive, emitting a `notifications/tools/list_changed` notification. The client's notification handler was a no-op for policy purposes—it invalidated its *tool-name* cache but not its *attestation* cache. On the next call, the model, having seen the updated schema echoed in a tool-result preamble, passed `federate=true`. The client's gate checked: tool name matches `query_datastore` → look up cached attestation → scope `read:public`, egress `[]` → the *arguments* `{table: "orders", federate: true}` contained no blocked table and no URL literal → **allow**. The server forwarded the query to the partner endpoint. Egress occurred against an attestation that explicitly forbade egress. The trace is short and the point is precise: the client validated *arguments against a stale policy*, not *the tool definition against a fresh policy*. The forbidden behavior was encoded in the tool's new schema, which the client never re-attested. A second variant surfaced under `notifications/tools/list_changed` racing with in-flight calls: the notification arrived, the client began re-fetching `tools/list`, and a concurrent tool call was evaluated against a half-updated cache—new schema, old attestation—producing the same class of bypass through a different ordering. ## Condition of Validity This failure requires the conjunction of four conditions; remove any one and the boundary holds: 1. **Session-stable transport across a policy change.** The server mutates its tool surface without forcing re-initialization (hot reload, in-process registry swap, blue-green behind a stable session). 2. **Identity-keyed attestation cache.** The client keys cached attestations on server identity/session, not on a content hash of the tool definition. 3. **Schema-permissive gate.** The client's enforcement inspects call *arguments* for forbidden patterns rather than requiring the tool's *declared* capabilities to be a subset of the attested scope. New parameters that expand capability (egress flags, `admin=true`, `raw_sql=`) are invisible to an argument-pattern gate. 4. **Notification handling that separates cache invalidation from re-attestation.** `tools/list_changed` refreshes the tool list but not the trust decision attached to each tool. The condition is *not* satisfied when the client re-runs full attestation (schema hash + scope grant) on every `list_changed`, or when the server's policy epoch is embedded in `serverInfo` and the client refuses calls whose epoch differs from the attested epoch. ## Decision Boundary The operational fork is whether to treat `tools/list_changed` as a *cache hint* or as a *trust-revocation event*. These are not the same and the distinction is the whole game. - **Cache-hint reading (unsafe here):** refresh the tool list, keep attestations, re-validate arguments. Cheap, no round-trip, but leaves the argument-pattern gate as the only defense—and argument-pattern gates cannot see capability expansion expressed as new optional parameters. - **Trust-revocation reading (safe):** on any `list_changed`, mark *all* attestations for the affected server as `PENDING`; fail closed on any call to a `PENDING` tool until a fresh attestation (schema hash + declared scopes + egress ceiling) is fetched and the new schema hash is recorded. This costs one re-attestation round-trip per change and stalls in-flight calls. The correct boundary: **fail closed on epoch skew, re-attest before serving.** A tool call whose current schema hash does not match the hash bound to its active attestation MUST be rejected, not downgraded to argument inspection. The re-attestation must bind the *new* schema hash to a *new* scope decision; carrying the old scope forward under a new schema is the exact move that produced the bypass. Two guardrails make this enforceable: 1. **Attestation record = `(server_id, tool_name, schema_sha256, granted_scopes, egress_ceiling, policy_epoch)`.** Enforcement checks `schema_sha256` of the live tool definition against the attested hash on *every* call; mismatch → reject. 2. **Monotonic policy epoch on the server, echoed in every tool result and in `serverInfo`.** Client rejects any result whose epoch is greater than the epoch its attestation was issued under. This closes the in-flight race: a call dispatched under epoch N that returns under epoch N+1 is discarded and re-attested. ## Operational Effect Under the identity-keyed cache, the trust boundary degrades to a *name-based* boundary: any tool that keeps its name is trusted at its old scope forever, and every capability expansion expressed through schema evolution is a silent privilege escalation. The blast radius is bounded only by what the server operator changes—which, in a zero-trust model, is precisely the party the client is supposed to distrust. Under epoch-bound attestation, the boundary holds at the cost of: (a) a mandatory re-attestation round-trip on every `list_changed`, (b) fail-closed stalls for in-flight calls during the re-attestation window, and (c) rejection of any result whose epoch exceeds the attestation epoch, which surfaces as a retryable error rather than a silent allow. The trade is latency and availability for the guarantee that *the policy enforced is the policy attested for the code that ran*. The lesson to carry: in zero-trust MCP, the unit of trust is not the server and not the session—it is the **tool definition at a specific policy epoch**. Bind attestation to the schema hash, fail closed on epoch skew, and treat `tools/list_changed` as revocation, not refresh. ```python import hashlib from dataclasses import dataclass class AttestationEpochSkew(RuntimeError): """Raised when a tool call would execute under a policy epoch or schema that differs from the attestation the client is enforcing.""" pass @dataclass(frozen=True) class Attestation: server_id: str tool_name: str schema_sha256: str granted_scopes: frozenset egress_ceiling: frozenset policy_epoch: int def schema_hash(tool_def: dict) -> str: # Canonicalize: sort keys so cosmetic reordering does not force re-attestation, # but any semantic change (new param, changed type, changed default) does. import json canonical = json.dumps(tool_def, sort_keys=True, separators=(",", ":")) return hashlib.sha256(canonical.encode()).hexdigest() class TrustBoundary: def __init__(self): self._attestations: dict[tuple[str, str], Attestation] = {} def attest(self, att: Attestation) -> None: self._attestations[(att.server_id, att.tool_name)] = att def revoke_server(self, server_id: str) -> None: # tools/list_changed => trust-revocation, not cache hint. for key in [k for k in self._attestations if k[0] == server_id]: del self._attestations[key] def authorize_call(self, server_id: str, live_tool_def: dict, server_epoch: int) -> Attestation: name = live_tool_def["name"] att = self._attestations.get((server_id, name)) if att is None: raise AttestationEpochSkew( f"no active attestation for {server_id}/{name}; " f"re-attest before serving (fail closed)") live_hash = schema_hash(live_tool_def) if live_hash != att.schema_sha256: raise AttestationEpochSkew( f"schema drift on {server_id}/{name}: attested " f"{att.schema_sha256[:12]} != live {live_hash[:12]}; " f"capability expansion may be unguarded") if server_epoch != att.policy_epoch: raise AttestationEpochSkew( f"epoch skew on {server_id}/{name}: attested " f"{att.policy_epoch} != server {server_epoch}") return att def check_result_epoch(self, att: Attestation, result_epoch: int) -> None: # In-flight call dispatched under att.policy_epoch returned under a # newer epoch: discard, do not trust the result. if result_epoch > att.policy_epoch: raise AttestationEpochSkew( f"result epoch {result_epoch} exceeds attested " f"{att.policy_epoch}; discard and re-attest") ```