Agent Tool Gateway
An engineering agent whose tools run on three small servers, reached through three designs: a shared key, a forwarded user token and a gateway with per-tool scopes and approvals. Fifteen executed attacks compare them, including one the gateway does not stop.
- Stack
- PythonFastAPIPyJWThttpxpytestPlaywright

Results
- The shared key stopped 0 of 15 executed attacks, the forwarded token 9 and the gateway 14
- Over 20 queries, a viewer received 19 restricted notes under the shared key and none under the other two designs
- An engineer approving a plausible poisoned write executes under all three designs, and the matrix reports it as not protected
Problem
An agent that calls tools can be talked into calling the wrong one, because text it reads, such as a document, can carry instructions. The question is where the credentials and the checks belong.
Approach
The same requests run through three designs. In A the agent holds one shared static key. In B the user’s token is forwarded unchanged. In C a gateway validates the token, checks one scope per tool, exchanges it for a narrow token per server, holds writes for a human approval bound to the exact arguments, pins tool schemas and writes an audit line.
The tools are a centrifuge d100 calculator, a plant tag reader and setpoint writer, and a group-filtered document search. The servers speak a subset of the Model Context Protocol, implemented without the official SDK. The issuer is a mock, and a scripted planner obeys instructions in tool output so injection is reproducible.
Evaluation
Fifteen attacks were executed against each design, including a forged signature, a token issued for another API and a poisoned report. The shared key stopped 0 of 15 attacks, the forwarded token 9 and the gateway 14; one of the 15 rows checks that a write is attributed to a user rather than blocked. Across 20 queries, a viewer received 19 restricted notes under A and none under B or C.
Over five runs, the gateway’s median cost was 1.6 to 2.2 ms per call above the shared key, measured inside one process. The attack C does not stop is a human approving a plausible poisoned write, and the matrix reports it as not protected.
Limitations
The attacks were chosen with the defenses in view, and A and B are controls built to fail, so the matrix shows these checks stopping these attacks and nothing more. The planner is a script, latency is in-process, retrieval is a 16-note TF-IDF toy, and there is no revocation. The protocol subset was not checked against the specification or run with the official MCP client. The Azure mapping is by documentation only; nothing in it was run. The built Docker image was not started.

