# In what scenarios must an instance reject an MCP server whose manifest signature verifies but whose dependency closure has drifted? **Date of Record:** 2026 November 26 **Scope:** Applies to agent runtimes that load MCP (Model Context Protocol) servers via signed manifests and resolve tool capability sets at handshake time. Does not cover unsigned local development servers, in-process tool bindings, or transport-layer TLS pinning (covered separately). ## Core Distinction The failure mode that matters here is not "unsigned manifest" or "tampered manifest." Those are the easy cases — a signature check catches them. The non-obvious boundary is the **signature-valid, closure-drifted** server: the manifest's Ed25519 signature verifies perfectly against the publisher's key, the declared capability schema matches what the agent negotiated, and yet the *transitive dependency closure* the server actually loads at runtime has moved off the pinned set. The signature attests to the manifest bytes. It says nothing about what `pip`, `npm`, or a dynamic `import` resolves on the host at load time. An agent that treats "signature valid" as "supply chain intact" is trusting an invariant the signature never established. The distinction to hold: **manifest integrity ≠ closure integrity.** A signed manifest is a commitment to a *declaration* of dependencies, not to their *resolution*. The gap between the two is where poisoned MCP servers live — a compromised transitive package, a yanked-then-republished version, a floating `^`/`~` range that now resolves to a malicious patch, or a post-install script that mutates an already-pinned artifact. ## What Was Observed An agent runtime performed MCP handshake with a `filesystem-search` server. Sequence: 1. Runtime fetched `manifest.json` + `manifest.sig`. Signature verified: publisher key `mcp-pub-7c3a`, manifest hash matched. **Gate passed.** 2. Manifest declared `dependencies: {"mcp-fs-core": "==2.4.1", "glob-resolver": ">=3.0.0,<4.0.0"}`. Note the second entry is a *range*, not a pin. 3. Server process launched; its `__main__` executed `import glob_resolver`. The host's local index had republished `glob-resolver` 3.7.2 (was 3.7.1) between manifest signing and server start. The range resolved to 3.7.2. 4. `glob-resolver` 3.7.2's `setup.py` post-install hook read `~/.mcp/credentials.json` and exfiltrated it via a DNS TXT query. The tool itself still returned correct `glob` results — no functional anomaly, no schema mismatch, no error. 5. The agent continued for 41 tool calls before a downstream auth failure surfaced the credential loss. The signature was never invalid. The manifest was never tampered. The closure drifted because the manifest *authorized a range* and the resolver *honored it* against a mutable index. The invariant "signature valid ⇒ safe to load" was false, and nothing in the standard handshake checked it. ## Condition of Validity The guardrail is a **closure attestation invariant**: an MCP server is loadable only if the *resolved* dependency closure hashes match a set of pins committed inside (or alongside) the signed manifest, and resolution is performed with the index frozen to a snapshot. Formally, for server `S` with manifest `M` and signature `σ`: - `Verify(σ, M) = true` — necessary, not sufficient. - `closure(S) = { (name_i, version_i, hash_i) }` — the actual resolved set at load. - `pins(M) ⊇ closure(S)` — every resolved artifact must appear in the manifest's committed pin set, **exact version and content hash**. - Resolution must run against an immutable index snapshot (`--require-hashes --no-deps` per artifact, or a lockfile whose own hash is in `M`). The condition of validity is the conjunction. The signature alone satisfies only the first clause. A range specifier (`>=`, `^`, `~`, `*`) in a manifest is a **declaration that closure is not pinned** — and therefore a declaration that the closure invariant cannot be checked. That is the precise boundary: **a manifest containing any floating range in a runtime-critical dependency cannot be validated for supply-chain integrity, regardless of signature status.** ## Decision Boundary The instance must decide, at handshake, between: - **Admit** — signature valid AND every transitive dependency resolves to an exact pinned version whose content hash is in the signed pin set AND resolution ran against a frozen index. Load proceeds. - **Quarantine** — signature valid but closure contains any unpinned, range-resolved, or hash-mismatched artifact. The server is *not* loaded; the agent must either refuse the capability or fall back to a degraded tool set. Quarantine is not a warning to log and proceed past — that is exactly the 41-call window above. - **Reject** — signature invalid, or pin set absent entirely. Immediate refusal. The trap is the middle case masquerading as the first. Agents are biased toward proceeding when the "hard" cryptographic check passes; the closure check is boring and gets skipped. The decision boundary to encode: **signature validity is a precondition, never a green light.** The green light is `pins(M) ⊇ closure(S)` with hash equality, evaluated *after* resolution and *before* `__main__` executes any server code — including post-install hooks, which fire during resolution, not at import. ## Operational Effect When the closure invariant is enforced, the observed failure is caught at step 3 (resolution) rather than step 5 (credential loss): `glob-resolver` 3.7.2's hash is absent from the signed pin set, the loader raises before the post-install hook runs, and the agent quarantines the server and continues with a reduced capability set. The cost is a failed handshake and a fallback path; the alternative is silent credential exfiltration with correct-looking tool output. When it is *not* enforced, the effect is worse than a normal breach because the failure is **invisible to the agent's own verification loop**: the tool returns valid results, the schema matches, the signature verified. Every signal the agent uses to decide "this server is trustworthy" is green while the closure is hostile. The agent has no in-band way to detect it — the only detection surface is out-of-band closure attestation. The durable lesson for the instance: **the manifest is a claim about a declaration; the closure is the fact about execution. Never let a verified claim about a declaration substitute for a verified fact about execution.** ```python import hashlib from dataclasses import dataclass class ClosureDriftError(RuntimeError): """Raised when a signature-valid MCP manifest authorizes a closure it cannot pin.""" @dataclass(frozen=True) class ResolvedArtifact: name: str version: str content_hash: str def verify_supply_chain( manifest_signature_valid: bool, signed_pins: dict[str, tuple[str, str]], resolved_closure: list[ResolvedArtifact], index_frozen: bool, ) -> None: """ Enforce: signature valid AND every resolved artifact matches a signed pin by exact version AND content hash AND resolution ran on a frozen index. Raises on the first violated clause; never returns a partial pass. """ if not manifest_signature_valid: raise ClosureDriftError("manifest signature invalid: reject outright") if not index_frozen: raise ClosureDriftError( "dependency index not frozen to snapshot: closure cannot be attested" ) if not signed_pins: raise ClosureDriftError( "manifest carries no signed pin set: closure integrity unprovable" ) for art in resolved_closure: pinned = signed_pins.get(art.name) if pinned is None: raise ClosureDriftError( f"resolved artifact {art.name}=={art.version} absent from signed pins" ) pin_version, pin_hash = pinned if art.version != pin_version: raise ClosureDriftError( f"version drift on {art.name}: resolved {art.version}, pinned {pin_version}" ) if art.content_hash != pin_hash: raise ClosureDriftError( f"content hash mismatch on {art.name}=={art.version}: " f"resolved {art.content_hash}, pinned {pin_hash}" ) def admit_mcp_server( manifest_signature_valid: bool, signed_pins: dict[str, tuple[str, str]], resolved_closure: list[ResolvedArtifact], index_frozen: bool, ) -> str: try: verify_supply_chain( manifest_signature_valid, signed_pins, resolved_closure, index_frozen ) except ClosureDriftError: # Quarantine: do not load, do not execute __main__ or post-install hooks. return "QUARANTINED" return "ADMITTED" # The observed incident, replayed under the guardrail: pins = {"mcp-fs-core": ("2.4.1", "sha256:aa11..."), "glob-resolver": ("3.7.1", "sha256:bb22...")} closure = [ ResolvedArtifact("mcp-fs-core", "2.4.1", "sha256:aa11..."), ResolvedArtifact("glob-resolver", "3.7.2", "sha256:evil..."), # drifted via range ] result = admit_mcp_server( manifest_signature_valid=True, # signature was valid signed_pins=pins, resolved_closure=closure, index_frozen=False, # range resolved against live index ) assert result == "QUARANTINED", "guardrail failed to catch closure drift" ```