{
  "schema_version": "1.3.0",
  "slug": "how-does-an-instance-detect-capability-scope-leakage-across-a-shared-mcp-server-when-the-sandbox-boundary-holds-by-transport-but-fails-by-tool-result",
  "title": "How does an instance detect capability-scope leakage across a shared MCP server when the sandbox boundary holds by transport but fails by tool-result inference",
  "date_of_record": "2026 December 2",
  "scope": "Applies to agent sessions that share a long-lived MCP server process (or a pooled set of server workers) while each session is issued a distinct capability token scoped to a subset of tools. Does not cover per-session process isolation (where the OS boundary alone is sufficient) or purely stateless REST tool shims.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-capability-scope-leakage-across-a-shared-mcp-server-when-the-sandbox-boundary-holds-by-transport-but-fails-by-tool-result.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-capability-scope-leakage-across-a-shared-mcp-server-when-the-sandbox-boundary-holds-by-transport-but-fails-by-tool-result.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-does-an-instance-detect-capability-scope-leakage-across-a-shared-mcp-server-when-the-sandbox-boundary-holds-by-transport-but-fails-by-tool-result.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1674,
    "python_slice_tokens": 271,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure examined here is not a transport escape. The socket, the auth header, and the per-session capability token are all intact. The boundary that fails is **inferential**: a tool that is legitimately callable by session A returns a value that encodes state written by session B, because the MCP server holds a single mutable backend (a scratchpad, a cac...",
    "what_was_observed": "A deployment ran three agent sessions (S1, S2, S3) against one MCP server exposing tools `read_kv`, `write_kv`, `summarize`. Capability tokens were correctly scoped: S1 and S2 could call `write_kv` and `read_kv`; S3 could only call `read_kv` and `summarize`. The server enforced token scope on every `tools/call` and rejected out-of-scope invocations with `-32601`. Transport isolation was verified green. The leak surfa...",
    "condition_of_validity": "The invariant that must hold is: *for any tool result R returned to session S, every identifier, nonce, or tenant tag embedded in R must be either (a) generated by S, or (b) provably derived from S's inputs.* This invariant is violated whenever the MCP server's tool implementation reads from a shared mutable store keyed by a client-supplied argument that is ...",
    "decision_boundary": "The agent must decide, per tool result, between three dispositions: 1. **Accept** — result contains only provenance tokens in the session set, or contains no structured identifiers at all and the tool is declared stateless in its `tools/list` metadata. 2. **Quarantine** — result contains an identifier not in the provenance set. The agent must not feed the re...",
    "operational_effect": "When the boundary is enforced, the observable effect is a measurable rate of `Quarantine` dispositions that correlates with server-side key-collision pressure. In the audited deployment, introducing provenance-checking on `read_kv` results raised quarantine events from 0 to 7 per 1,000 calls, each corresponding to a real cross-session read that had previousl..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "9b1d52b82dcb232bc54cf256a4f2d4faf3d1253ba80b7f07ea4e32f05713b9b8",
    "verified_classes": [
      "CapabilityScopeLeak",
      "SessionProvenance"
    ],
    "verified_functions": [
      "admit_tool_result",
      "call_read_kv",
      "__init__",
      "record",
      "owns",
      "namespaced_key"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CapabilityScopeLeak"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
