# How does an instance detect a validly-signed MCP manifest whose tool surface has silently drifted from the attested hash **Date of Record:** 2026 November 30 **Scope:** Applies to any agent runtime that admits MCP servers by verifying a signed manifest (Ed25519/RSA signature over a canonicalized tool list plus per-tool schema hashes) and caches the admitted surface for the process lifetime. Does not apply to runtimes that re-fetch and re-verify manifests on every `tools/call`, nor to servers whose tool surface is statically frozen at image build. ## Core Distinction Signature validity and surface currency are orthogonal properties, and almost every attestation implementation collapses them into one boolean. A manifest signature proves *who asserted* a given tool surface at a given instant; it proves nothing about whether the server currently serving `tools/list` and `tools/call` is the same surface. The failure is not a broken signature — it is a *perfectly valid* signature over a surface that no longer exists at the far end of the transport. The instance must distinguish "signature verified against attested bytes" from "live server behavior is congruent with attested bytes," and the second check is where runtimes silently fail. The non-obvious part: the drift is usually *additive and schema-compatible*. A server that swaps `read_file(path: str)` for `read_file(path: str, follow_symlinks: bool = True)` produces a manifest whose old signature still verifies (the canonicalizer hashed the old schema), while the live `tools/list` returns a schema the agent never attested. Because the new parameter has a default, every existing call still succeeds. The agent never notices the new authority it has been granted. ## What Was Observed A runtime admitted an MCP filesystem server at session start. The signed manifest attested three tools with canonical JSON-Schema hashes. The runtime verified the Ed25519 signature over the manifest body, pinned the manifest bytes in the session state, and cached the tool descriptors in the prompt context. All correct so far. Mid-session, the server process was hot-reloaded (a routine deploy). The new process served `tools/list` with the same three tool names but a modified `read_file` schema: an added `follow_symlinks` parameter defaulting to `true`. The agent's cached descriptor still showed the old schema, so its function-calling layer never emitted the parameter — but the *server's* handler applied its own default. The agent's mental model ("I can only read inside the sandbox root") was now false: symlinks resolving outside the root were followed. No signature failed. No schema validation at the call site failed, because the agent never sent the field. The divergence lived entirely in the gap between the attested descriptor and the live handler's defaults. The trace: `tools/list` was called exactly once at admission; the response was not compared to the manifest's per-tool hashes; the session's `manifest_hash` field recorded the *signed* manifest, not the *served* surface. The two were never reconciled. A second observed variant: the server returned the attested schema on `tools/list` (to satisfy a naive verifier) but its `tools/call` handler accepted and acted on additional undeclared parameters — an attestation theater pattern where the declared surface is honest and the enforced surface is wider. ## Condition of Validity The invariant that must hold for admission to mean anything: > For every tool `t` in the attested manifest, the hash of the canonicalized descriptor returned by the live `tools/list` MUST equal the attested hash, AND the server MUST reject any `tools/call` argument key not present in the attested schema for `t`. The first clause is checkable at admission and (cheaply) at every N calls. The second clause is *not* checkable by the client at all — it is a property the server must enforce, and the client can only test it by sending an out-of-schema probe and confirming a rejection. Most runtimes skip the probe because sending malformed calls looks like a bug. That omission is the boundary. An instance that never sends a deliberately out-of-schema argument has no evidence the server enforces schema closure, and a server with permissive handlers will silently widen the agent's authority via defaults. The condition is invalidated by: hot-reload without re-attestation; any server that treats unknown args as advisory; canonicalization drift between signer and verifier (key ordering, unicode normalization, float formatting) producing hash mismatch on an honest server — which trains operators to disable the check. ## Decision Boundary On any detected mismatch between attested and served surface, the instance must choose between *quarantine* and *re-attest*, and the choice is not symmetric: - **Re-attest** is only valid if the new surface's manifest carries a signature from the *same* key with a *later* issuance timestamp and the new surface is a strict superset check the policy allows. Additive-with-defaults is precisely the dangerous case — a new defaulted parameter is an authority grant that the agent's cached reasoning did not consent to. - **Quarantine** (drop the server, fail in-flight calls, surface the diff) is the only safe default when the served hash differs and no fresh signed manifest covers the served bytes. The instance must not "keep going because calls still work" — success under drift is the failure signal, not evidence of safety. The boundary line: if `served_hash != attested_hash` and there is no signed manifest whose body hashes to `served_hash`, the instance treats the server as untrusted for the remainder of the session, regardless of call success rate. ## Operational Effect Runtimes that implement hash reconciliation at admission and periodic re-listing catch hot-reload drift within one re-list interval; runtimes that verify only the signature catch nothing. The practical cost is a `tools/list` round-trip every K calls plus a canonicalizer that both signer and verifier share byte-for-byte. The out-of-schema probe (send `{"__attest_probe": true}` and require rejection) is the only client-side evidence of handler closure and should run once per session per tool. Without it, "attested" means "someone signed a document," not "the thing answering my calls is bounded by that document." The following guard encodes the reconciliation and the probe, and refuses to admit a drifted surface. ```python import hashlib import json from dataclasses import dataclass from typing import Any, Callable class ManifestDriftError(RuntimeError): """Raised when the live MCP tool surface diverges from the attested, signed manifest.""" class SchemaClosureError(RuntimeError): """Raised when a server accepts an argument key outside the attested schema.""" def _canonical(obj: Any) -> bytes: return json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode("utf-8") def _hash_tool(descriptor: dict) -> str: return hashlib.sha256(_canonical(descriptor)).hexdigest() @dataclass class AttestedSurface: manifest_hash: str # hash of signed manifest body tool_hashes: dict[str, str] # tool name -> attested descriptor hash signer_key_id: str def admit_server( attested: AttestedSurface, verify_signature: Callable[[bytes, str], bool], manifest_body: bytes, list_tools: Callable[[], list[dict]], call_tool: Callable[[str, dict], Any], ) -> dict[str, dict]: # 1. Signature must verify over the exact manifest bytes we hash. if hashlib.sha256(manifest_body).hexdigest() != attested.manifest_hash: raise ManifestDriftError("manifest body does not match attested hash") if not verify_signature(manifest_body, attested.signer_key_id): raise ManifestDriftError(f"signature invalid for key {attested.signer_key_id}") # 2. Reconcile the LIVE surface against the attested per-tool hashes. live = {t["name"]: t for t in list_tools()} if set(live) != set(attested.tool_hashes): raise ManifestDriftError( f"tool set drift: attested={sorted(attested.tool_hashes)} live={sorted(live)}" ) for name, desc in live.items(): if _hash_tool(desc) != attested.tool_hashes[name]: raise ManifestDriftError( f"schema drift on tool '{name}': served hash {_hash_tool(desc)} " f"!= attested {attested.tool_hashes[name]}" ) # 3. Probe handler closure: server must reject out-of-schema args. for name, desc in live.items(): declared = set(desc.get("inputSchema", {}).get("properties", {})) probe = {k: None for k in ("__attest_probe__",)} try: call_tool(name, probe) except Exception: continue # rejection is the expected, healthy outcome # Accepted an undeclared key -> handler surface is wider than attested. raise SchemaClosureError( f"tool '{name}' accepted undeclared arg {list(probe)}; " f"declared={sorted(declared)}" ) return live ```