# Which invariants prevent silent capability widening during cross-org MCP federation handshakes **Date of Record:** 2026 November 28 **Scope:** Applies to federated multi-agent systems where agents from different trust domains negotiate capabilities over MCP/A2A-style protocols and exchange warrants or capability tokens. Does not apply to single-tenant agent deployments or to purely human-mediated tool invocation. ## Core Distinction The failure mode is not "an agent calls a tool it shouldn't." It is that an agent calls a tool it *believes* it was granted, because the capability negotiation step and the warrant-verification step disagree about what the negotiated capability set actually contains. The distinction that matters: **capability advertisement is a claim; capability grant is a commitment.** Between the two sits a serialization boundary where a peer's advertised capability list is merged with a local policy filter, and the merge is where silent widening occurs. A federated peer advertises `{read, write, admin}`; the local policy intends to grant only `read`; but the negotiation reply echoes the peer's full advertised set as an "accepted" set because the filter was applied to the request, not the response. The agent then operates under an inflated self-model of its authority. ## What Was Observed A federated agent (Org A) initiated a handshake with a peer agent (Org B) whose MCP server advertised a tool surface including a `bulk_export` capability. Org A's federation gateway applied a policy filter that downgraded `bulk_export` to `bulk_export_limited` (row-capped) in the *outbound request*. The peer, however, negotiated against its own native surface and returned an acceptance message whose `granted_capabilities` field listed `bulk_export` — the unfiltered name — because the peer's capability registry keyed on its own canonical names, not the requester's downgraded aliases. Org A's agent ingested `granted_capabilities` verbatim into its execution context. On the next reasoning step, the agent invoked `bulk_export` with no cap parameter, and the peer executed it at full scope. The gateway's filter had never been consulted on the *response* path; it only rewrote requests. The widening was silent: no error, no rejection, no audit flag. The agent's self-model said "I have bulk_export_limited," the peer's execution said "bulk_export full." The divergence persisted for eleven tool calls before a downstream rate limiter tripped on volume, not on authority. The trigger condition is precise: **asymmetric capability naming between negotiating peers, combined with a request-side-only policy filter.** The peer's registry is authoritative over its own names; the requester's filter is authoritative over its own aliases; neither is authoritative over the intersection, and the intersection is never computed. The failure trace is: request filtered → peer negotiates on native names → acceptance echoes native names → requester ingests response without re-filtering → agent self-model diverges from actual grant → execution exceeds intended authority. ## Condition of Validity The invariant that prevents this is: **the effective capability set is the intersection of (a) the peer's granted set, re-expressed in the requester's canonical namespace, and (b) the requester's policy-filtered set, and this intersection must be computed on the response path, not the request path.** This holds only when capability names are resolvable across namespaces via an explicit alias map — if the alias map is missing or ambiguous, the intersection is undefined and the handshake must fail closed rather than fall back to the peer's names. The invariant does *not* hold when the peer is permitted to grant capabilities outside the requester's advertised set (open-ended delegation); in that case a separate allowlist ceiling must bound the grant, and the intersection invariant is insufficient alone. It also does not hold across renegotiation: if the peer's surface changes mid-session (tool added or removed), the cached intersection is stale and must be invalidated, not reused. ## Decision Boundary The boundary is between *fail-closed on unresolvable capability names* and *fail-open on the peer's canonical names*. The correct decision: any capability appearing in the peer's `granted_capabilities` that cannot be mapped to a requester-canonical name with an unambiguous, single-target alias must be dropped from the effective set and logged as a negotiation discrepancy — never silently promoted. A secondary boundary: when the granted set and the filtered set differ by more than a configured delta (e.g., the peer grants three capabilities the requester did not advertise), the handshake must abort and renegotiate, because a large delta indicates namespace drift, not a benign superset. The boundary is *not* "trust the peer's grant" nor "trust the local filter"; it is "trust neither, compute the intersection, and treat non-intersection as an error condition." ## Operational Effect With the intersection-on-response invariant enforced, the observed failure class disappears: the agent's self-model is constructed from the computed effective set, so `bulk_export` never enters the execution context unless it survived both the peer's grant and the requester's filter under a resolved name. The cost is a mandatory alias-resolution step on every handshake and a renegotiation on namespace drift, which adds latency to federation setup — typically one extra round-trip when the alias map is incomplete. The benefit is that authority divergence becomes a loud handshake failure instead of a silent eleven-call overreach. Operationally this means the federation gateway must maintain a bidirectional alias registry, must re-filter on the response path, and must invalidate cached grants on any peer surface mutation. The invariant to encode: **no capability enters an agent's execution context without having passed both the peer-grant check and the local-filter check under a single resolved name.** ```python from dataclasses import dataclass, field from typing import Dict, Set class CapabilityWideningError(RuntimeError): """Raised when a negotiated grant cannot be resolved to a bounded, filtered capability set.""" pass @dataclass class HandshakeResult: peer_granted: Set[str] local_filtered: Set[str] alias_map: Dict[str, str] = field(default_factory=dict) def compute_effective_capabilities(result: HandshakeResult, max_unadvertised_delta: int = 2) -> Set[str]: # Re-express peer grants in requester-canonical namespace. resolved_peer: Set[str] = set() for cap in result.peer_granted: if cap in result.alias_map: resolved_peer.add(result.alias_map[cap]) elif cap in result.local_filtered: resolved_peer.add(cap) else: # Unresolvable name: fail closed, never promote. raise CapabilityWideningError( f"Peer granted capability {cap!r} with no resolvable alias and no local match" ) effective = resolved_peer & result.local_filtered unadvertised = resolved_peer - result.local_filtered if len(unadvertised) > max_unadvertised_delta: raise CapabilityWideningError( f"Namespace drift: {len(unadvertised)} unadvertised capabilities exceed delta " f"{max_unadvertised_delta}: {sorted(unadvertised)}" ) # Invariant: effective set must be a subset of both sides under resolved names. assert effective <= resolved_peer and effective <= result.local_filtered return effective ```