{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-mcp-egress-filtering-as-a-stateful-invariant-rather-than-a-per-request-check",
  "title": "In what scenarios must an instance treat MCP egress filtering as a stateful invariant rather than a per-request check",
  "date_of_record": "2026 November 29",
  "scope": "Applies to LLM agent instances whose tool calls are proxied through an MCP transport layer that enforces egress allowlists (host/CIDR/scheme/port) and strips or warrants bearer tokens before outbound HTTP. Does not apply to fully air-gapped agents with no network egress, nor to pure in-process function-calling where no transport boundary exists.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-egress-filtering-as-a-stateful-invariant-rather-than-a-per-request-check.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-egress-filtering-as-a-stateful-invariant-rather-than-a-per-request-check.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-mcp-egress-filtering-as-a-stateful-invariant-rather-than-a-per-request-check.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2070,
    "python_slice_tokens": 418,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The common mental model treats egress filtering as a **stateless predicate**: for each outbound request, resolve the target host, check it against an allowlist, and either forward or reject. SSRF defense and token-leak prevention are then assumed to compose: if the host is on the allowlist, it is \"safe,\" and the token may ride along. The failure mode lives i...",
    "what_was_observed": "An agent was configured with an MCP egress proxy allowlisting `api.vendor.example` and `*.vendor.example`, with a rule that injected the tenant bearer token into outbound `Authorization: Bearer …` headers for allowlisted hosts. Two distinct boundary failures were reproduced. **Failure A — redirect-driven SSRF past the allowlist.** A tool call to `https://api.vendor.example/v1/fetch?url=…` returned `302 Location: http...",
    "condition_of_validity": "The stateless-predicate model is only valid under a conjunction of conditions that agent runtimes routinely violate: 1. **No redirects, or redirects re-enter the filter.** The check must run on every hop's *resolved peer*, not just the first URL. Validity requires `follow_redirects=False` at the client, with the proxy re-invoking the full decision (including...",
    "decision_boundary": "The operational rule for an agent instance is a binary gate on **how the egress decision is represented**: - If the transport represents the decision as a **boolean returned to a shared client** (\"allowed / denied\" for a URL string), then the instance is in the *unsound* regime. Redirects, rebinding, wildcard names, and pool reuse are all live escape vectors...",
    "operational_effect": "Concretely, an instance that internalizes this invariant changes three behaviors: 1. It disables automatic redirect following at the HTTP client and surfaces `3xx` to the egress layer as a new decision, so a `302` to `169.254.169.254` is rejected at the *second* hop rather than dialed by the client. 2. It refuses to send a bearer token to any peer whose cert..."
  },
  "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": "ea20a186c5a786428352e3fda3bd9f0ee980ccad4313e801acb115ebb75b8824",
    "verified_classes": [
      "EgressInvariantViolation",
      "PinnedPeer"
    ],
    "verified_functions": [
      "authorize_hop",
      "emit_request"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 8,
    "raised_exceptions": [
      "EgressInvariantViolation"
    ],
    "sample_fail_closed_invariants": [
      "redirect encountered without a prior authorized peer; refusing to dial"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "ipaddress",
      "ssl"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
