How to control which MCP tools each agent can call
MCP access control per agent and per tool. What the spec leaves to you, what gateways add, and how unused grants get found and revoked.
MCP access control per agent and per tool. What the spec leaves to you, what gateways add, and how unused grants get found and revoked.
MCP access control is mostly left to you. The spec settles whether a client may talk to a server and stops there, so an agent that can reach a server can usually call everything on it. That's fine with one agent and one server. It gets uncomfortable around the third agent, when nobody can say from memory which of them is able to call delete_item.
There is an authorization section in the MCP spec, though it's narrower than it sounds. It's optional, it applies to the HTTP transports, and it builds on OAuth 2.1. What it settles is whether a given client may talk to a given server at all. It has no permission model for individual tools. A server is allowed to return a different tool list depending on the authorization it was shown, but deciding who gets which tools is left to whoever runs the server.
Tools can also describe themselves with annotations, readOnlyHint and destructiveHint among them. The spec is careful to call these hints, and says a client must treat them as untrusted unless it trusts the server they came from.
So unless the server does that filtering itself, an agent holding its URL and key can call every tool on it. If the server belongs to a vendor, the only control you have is the vendor's own scopes, and those are usually coarse (write access often includes delete). The key itself sits in the agent's environment, where anything else running there can read it.
Sometimes the server gives you enough by itself. GitHub's remote MCP server has a read-only mode, and lets you choose toolsets or individual tools with a header. If every agent using a server should get the same access to it, you can set that at the server and stop there.
That breaks down once two agents need different tools from one server, or once you want a single place to see what every agent can reach. Gateways exist for those cases. Docker's MCP Gateway is open source and runs each server in its own container, and its profiles pick which servers and tools a client gets to see. Cloudflare and Kong come at it from the access side. Cloudflare's MCP server portals put several servers behind one endpoint with Access policies per identity, while Kong keeps allow and deny lists per tool for each consumer. If the term is new, what is an MCP gateway starts from the spec, and the best MCP gateway for agents you wrote compares ten of them.
Amiril, which is what we build, is an MCP gateway that also reads your agents' traces, so it can tell you which grants have gone unused and which tools an agent still calls outside the gateway.
You register a tool server once, with its MCP address and how to sign in to it. Amiril reads the server's tool list and sorts each tool into Read, Write or Destructive using the hints the server sends. A tool that sends no hints at all is filed as Write, and you can move it to Destructive when you review the list. That sorting is a first guess, because the hints are only what the server says about itself, and you check and correct it before the tools are added. The levels matter when you grant, since an agent can be given a whole server at Read, at Read and write, or in full.
Every tool starts denied, and that includes a tool the server adds six months after you registered it. Amiril re-reads each server's tool list on a schedule. A tool that turns up is added as denied, and a change to a tool you already granted goes in the access log. We care about that case more than about the initial setup, when somebody is at least paying attention.
Grants are per agent. An agent belongs to one environment, so the production agent and its development twin have separate lists, and on the agent's Access tab each tool is a switch whose change reaches the gateway within a few seconds.
The agent connects as an ordinary MCP client with a gateway token, and its tool list contains the tools it was granted and nothing else, under names like inventory__get_item (the server's slug, then the tool). Ask the agent to do something it has no grant for and the model will tell you it has no such tool, because as far as it can see there isn't one. The gateway still checks every call, since a client can always send a tool name it was never given. A call like that gets this back:
This agent doesn't have access to inventory__adjust_stock. An admin can grant it in Amiril.
The refusal comes from the gateway, and the request never reaches the tool server.
The gateway token belongs to one agent in one environment and can be revoked on its own. It lives in the agent's environment like any other secret, and all it reaches is that agent's granted tools. The tool server's own credentials never go near the agent. The gateway adds them on the way through, after the check. Amiril encrypts each key and token before storing it and won't show a saved one again, so you can replace a credential but you can't read it back.
The agent's Calls tab lists every call that went through the gateway, with the decision and how the tool server answered, though not the arguments or results, which aren't stored. Changes go in a separate access log: who granted what and when, tokens created, servers synced, and each call the gateway refused, with the reason.
Grants pile up, because people ask for access when they need it and nobody files a ticket to say an agent has stopped using a tool. The gateway sees every call that passes through it, so it knows which grants have gone quiet. A tool that was granted more than 30 days ago and hasn't been called since comes up as an access suggestion, and you answer it with Revoke or Dismiss. If the agent calls the tool again before you get round to it, the suggestion closes without you.
Traces add what the gateway can't see, which is the runs that went wrong and the tools an agent still calls from its own code. Amiril groups runs that share a problem into an issue, and an AI investigator reads a sample of those runs and writes up what went wrong. When an issue's runs come down to one tool the agent shouldn't need, the investigator can suggest revoking that tool, with those runs as its evidence.
The Agents page has a Needs review column that counts, for each agent, the grants unused in 30 days and the destructive tools it can call. There's a longer post on why access sits in the same product as monitoring, and one on MCP security for the attacks that grants like these narrow.
Most agents start out with their tools as functions in the agent's own code and an API key in its environment, rather than on an MCP server. The docs have a guide for moving a tool like that onto a tool server, and the rest of the setup is in the gateway overview. The MCP gateway page shows what the gateway does for each agent.
If you're writing the server yourself, or using a connector platform to get one, make it list one tool per action. A server that exposes a single "run any action" tool can only be granted whole, and then most of the above is wasted on it.
You don't have to begin with the gateway either. An agent appears on the Agents page as soon as its first trace arrives, along with the tools its traces show it calling. The inventory starts filling in before you change anything about access. A trace source is just your agent sending its OpenTelemetry traces to Amiril, which is a few lines at startup, so you can connect a trace source today and leave the gateway for later.