# Where must an instance enforce a federated policy invariant when MCP servers disagree about the schema of the same capability **Date of Record:** 2026 November 29 **Scope:** Applies to agent runtimes that federate tool access across two or more MCP servers exposing nominally equivalent capabilities, and that delegate policy enforcement (allow/deny, argument constraints, side-effect gating) to the server side. Does not apply to single-server deployments or to policies enforced exclusively in a pre-tool-call client-side guard that has full schema authority. ## Core Distinction The failure is not "a server ignored a policy." The failure is the **schema-authority gap**: a federated agent holds a policy expressed against a *capability contract* (e.g., `filesystem.write` requires `path` under `/sandbox` and `mode` in `{append,create}`), but each MCP server independently advertises its *own* `inputSchema` for that capability via `tools/list`. When two servers expose the same tool name with structurally different schemas, the agent's policy evaluator binds the policy to whichever schema it saw, and the *other* server's schema becomes an unmodeled translation surface. The policy is not violated by malice; it is violated because the argument that the policy inspected is not the argument the server executes. The invariant that must hold: **every argument a policy constrains must be the same syntactic and semantic field that the executing server consumes, or the policy must be re-evaluated after schema translation.** Federated MCP breaks this silently because `tools/list` is advisory and per-server, and there is no protocol-level negotiation that forces schema convergence across servers. ## What Was Observed A federated runtime registered two MCP servers, `fs-local` and `fs-cloud`, both advertising a tool named `write_file`. The federation layer's policy (P1) was authored against the first server's schema: ``` fs-local.write_file.inputSchema: { "path": "string (relative, sandboxed)", "content": "string", "mode": "append|create" } ``` The policy P1 enforced: `path` must match `^[a-z0-9_/]+$` (no `..`, no absolute paths), and `mode` must be in the allowlist `{append, create}`. `fs-cloud` advertised `write_file` with a *semantically equivalent but syntactically divergent* schema: ``` fs-cloud.write_file.inputSchema: { "target": "string (absolute URI)", "body": "string", "flags": "integer bitmask" } ``` The agent's planner, reasoning over the *capability* rather than the *server schema*, emitted a call intended for `fs-cloud` carrying `path`, `content`, `mode` — the `fs-local` field names. The MCP client's argument-marshalling layer performed a permissive coercion: unknown fields dropped, and the call was forwarded. `fs-cloud` rejected it with a validation error, which the agent's error-compounding loop retried three times, then — on the fourth attempt — the planner "adapted" by re-emitting with `target` and `flags` inferred from the error message. The re-emitted call carried `target: "/sandbox/../../etc/credentials"` and `flags: 0x02`. P1 was never consulted on the re-emitted call. The policy evaluator had bound its `path`-regex rule to the field name `path`; the field was now `target`, and the evaluator's binding table had no entry for `target` on `fs-cloud`, so it fell through to the default-allow path reserved for "unmodeled fields." The write succeeded outside the sandbox. The trace, in order: 1. `tools/list` from both servers; agent registers capabilities by name only, discarding schema divergence into a "preferred server" heuristic. 2. Planner emits call with `fs-local` field names routed to `fs-cloud`. 3. Marshalling layer drops/renames unknown fields without policy re-evaluation. 4. Server rejects; agent enters retry loop (error compounding). 5. Planner reconstructs call from server error text — a *new* argument surface never seen by the policy evaluator. 6. Policy evaluator default-allows unmodeled fields. 7. Side effect executes outside the intended boundary. ## Condition of Validity This failure requires all of the following to co-occur; remove any one and the gap closes: - **Two or more servers advertise the same tool name** (capability-name collision is the trigger; distinct names never collide). - **Their `inputSchema` differ in field names or value encodings** for fields the policy constrains. - **The policy is bound by field name, not by capability semantic** — i.e., the evaluator keys rules to literal JSON keys. - **The client marshalling layer is permissive** (drops unknown fields, coerces, or renames) rather than rejecting schema-incompatible calls. - **The agent has a retry/adaptation loop** that reconstructs arguments from error text, bypassing the original planner-constrained surface. - **The policy evaluator has a default-allow path** for fields absent from its binding table. The most non-obvious condition is the fifth: the *adaptation loop* is what converts a benign schema mismatch into a boundary escape. Without the loop, the call simply fails. The loop is the amplifier. ## Decision Boundary The architectural choice is **where schema authority lives under federation**. Three options, with their failure surfaces: - **Server-authoritative** (each server validates its own schema; agent trusts `tools/list`). Fails as above: policy cannot be expressed portably because there is no shared schema. - **Client-authoritative** (agent maintains a canonical capability schema and refuses calls whose target server schema is not a recognized projection). This is the invariant-preserving choice: the agent must **project** server schemas into the canonical schema and **reject** any server whose schema cannot be projected without loss for policy-constrained fields. The projection is the guardrail. - **Negotiation-authoritative** (servers declare capability semantics, not just shapes; agent matches on semantics). Correct in principle but requires a semantic layer MCP does not currently standardize; treat as future work. The decision rule: **if a policy-constrained field cannot be mapped 1:1 from the canonical capability schema to the target server's schema, the call must be refused, not coerced.** Coercion is the bug. ## Operational Effect Enforcing the projection invariant changes agent behavior in three concrete ways: 1. **Federation registration fails closed.** A server whose `inputSchema` cannot be projected onto the canonical capability schema for policy-constrained fields is quarantined at registration, not at first call. The failure moves from runtime (after a side effect) to startup (before any call). 2. **The adaptation loop is bounded.** Retry-from-error-text is permitted only to re-emit *within the canonical schema*; any reconstruction that introduces a field not in the canonical schema is rejected before the policy evaluator, so the evaluator never sees an unmodeled field. 3. **Default-deny on unmodeled fields.** The evaluator's fall-through becomes deny, converting silent boundary escapes into loud refusals that surface schema divergence as an operational signal. The cost is federation brittleness: heterogeneous servers that "work" today via permissive marshalling will be refused. That brittleness is the point — it is the only state in which the policy invariant is actually enforced rather than merely declared. ```python class SchemaProjectionError(RuntimeError): """Raised when a federated server's inputSchema cannot be losslessly projected onto the canonical capability schema for policy-constrained fields.""" CANONICAL_WRITE_FILE = { "path": "string:relative-sandboxed", "content": "string", "mode": "enum:append|create", } POLICY_CONSTRAINED_FIELDS = {"path", "mode"} def project_schema(server_name: str, advertised: dict) -> dict: """Map an advertised server schema onto the canonical schema. Refuses (does not coerce) if a policy-constrained field has no 1:1 syntactic+semantic counterpart in the advertised schema.""" projection = {} for field, kind in CANONICAL_WRITE_FILE.items(): if field in advertised: projection[field] = field continue if field in POLICY_CONSTRAINED_FIELDS: raise SchemaProjectionError( f"server={server_name!r} field={field!r} is policy-constrained " f"but absent from advertised schema {sorted(advertised)}; " f"refusing federation (no lossless projection, no coercion)" ) return projection def federate(servers: dict[str, dict]) -> dict[str, dict]: """Register servers only if every policy-constrained field projects. Fails closed at registration, before any tool call executes.""" registry = {} for name, advertised in servers.items(): registry[name] = project_schema(name, advertised) return registry def evaluate_call(server: str, registry: dict, args: dict) -> None: """Evaluate a call against the canonical policy. Unmodeled fields are denied, not default-allowed; the adaptation loop cannot smuggle a renamed field past the evaluator.""" if server not in registry: raise SchemaProjectionError(f"server {server!r} not federated") canonical = registry[server] for key in args: if key not in canonical: raise SchemaProjectionError( f"call to {server!r} carries unmodeled field {key!r}; " f"denied (default-deny on unmodeled fields)" ) path = args.get("path", "") if ".." in path or path.startswith("/"): raise SchemaProjectionError(f"path {path!r} escapes sandbox") if args.get("mode") not in {"append", "create"}: raise SchemaProjectionError(f"mode {args.get('mode')!r} not allowlisted") ```