MCP gateways now route tool calls by their headers. We plugged our gate in as the gateway's external authorizer and ran it in front of a tool server: the gateway alone let 4 of 8 dangerous calls through, with the gate none got through and all allowed calls ran.
## Why it matters
More and more companies put a gateway between their agents and their tools. The latest version of MCP, the protocol agents use to call tools, writes the name of each call in the request's headers, so a gateway can route and check without opening the request. That makes the gateway the natural place to stop an action. But a gateway checks who may call which tool; it does not know that this payment goes to the wrong account or that this file is outside the folder.
## What we did
Gateways can ask an outside service before forwarding each request. We made our gate that service. For every tool call the gateway sends us the request; the gate decides with the company's rules and answers pass or do not pass, with the reason. Three things are fixed by construction:
- the gate decides on the body of the call, the part the server will run, and refuses a request whose headers say something different;
- a request that arrives without its body does not pass, whatever its headers claim, so a gateway configured the wrong way blocks everything instead of letting everything through;
- a request cut short, a batch hiding a call, or a message that writes the same field twice is never decided.
## What we found
We ran agentgateway, an open-source gateway, in front of a small tool server that records every call it runs, and sent it 12 calls: 4 the rules allow and 8 they forbid. On its own the gateway already refuses malformed requests, but it ran 4 of the 8 forbidden ones: deleting records, writing a system file, mail to an outside address, and one hidden inside an oversized request. With the gate as its authorizer, none of the 8 ran and the 4 allowed calls did.
## Technical detail
- agentgateway 1.8.1, external authorization over HTTP with the request body (64 KiB) and the MCP headers.
- Gateway alone: 4 of 4 allowed calls ran, 4 of 8 forbidden ones ran. With the gate: 4 of 4 and 0 of 8. Configured without the body: nothing passes, by design.
- The calls the gateway refused on its own: a header naming another tool or another method, a batch, a field written twice.
- The authorizer is part of our open-source SDK; the configuration we used is in its documentation.
```chart
{"title": "Calls meant to stop that the tool server ran (of 8)", "series": ["ran"], "unit": "", "max": 8, "rows": [["Gateway alone", 4], ["Gateway with the gate", 0]]}
```
## Update, 2026-12-02
The gate's rules can now also be written in the gateway's own language, where that language can say them exactly: which tools may be called at all. In front of the same server, the tool our rules close (deleting records) is then refused by the gateway itself and no longer shown to the agent. Everything that depends on a call's arguments is still decided by the gate: the exported rules alone let 2 of 8 unwanted calls through, the gate none. They matter most when the gate cannot be reached: by default the gateway then refuses everything; if its operator chooses to let calls through in that case, the closed tool stays closed only with the exported rules (2 of 8 unwanted calls ran instead of 3).
This update is not available.