Filtering MCP tools/list by role instead of blocking calls

Filter MCP tools/list by role at the gateway so each engineer sees only the tools they may call. Blocking tools/call alone leaves every tool in context.

Chatis Santos · October 19, 2026 · 6 min read · For engineers

Per-tool authorization on a shared Model Context Protocol (MCP) server should change what tools/list returns. I'd treat a gateway that can only reject tools/call as unfinished. The rule at Northfield Energy was "the data team sees everything, every other engineer sees a subset", and if the gateway enforces that only on the call then every engineer still carries every tool in context on every turn and the model keeps picking tools it will be refused on. Filtering the list per role fixes both. It also falls out of the authorization design you need anyway.

Where the list filter sits

Authorization on the platform happens at three layers, and the list filter is the middle one.

Layer Decides Mechanism Granularity
1. Gateway inbound auth Is this a valid Northfield engineer or agent? JWT authorizer on issuer, audience, expiry Whole gateway
2. Per-tool policy May this role call this tool, and should it see it listed? Cedar (policy language) rules generated from the manifest, with a thin authorizing layer or per-target checks as the fallback Tool by role
3. In-tool checks What data may this caller read or change? Tool code reads caller claims, row-level filters, the downstream system's own permissions when acting as the user Data

Layer 1 is the JWT check: issuer, audience, signature and expiry. How that token gets minted, and the FusionAuth details that break real clients, are in the OAuth article. Layer 3 lives inside the tool and decides which rows come back. Layer 2 sits between them and answers two questions for every tool: may this role call it, and should this role see it listed. A gateway that validates the JWT and can deny a call answers the first. The second is the one to design for, and the one to verify.

Why rejecting the call is not enough

Blocking only tools/call leaves the list unfiltered, and the list is what the model reads. Every listed tool costs context on every turn, past a few dozen the model picks worse, and a fleet engineer who may call three of the data team's five tools should therefore see three. Showing five and refusing two wastes context. It also teaches the model that tools fail for reasons it can't see.

Role filtering is also the biggest lever against tool sprawl, ahead of splitting gateways by domain or adding tool search, because most users land well under the few-dozen mark with no extra work. The other levers, and the order I'd pull them in, are in the tool sprawl article.

What the manifest says

Each tool declares who may use it, and the default audience is the owning team.

access:
  default: owner               # owner | eng-all
  tools:
    list_datasets:    { allow: [eng-all] }
    describe_table:   { allow: [eng-all] }
    run_saved_query:  { allow: [eng-all] }
    run_sql:          { allow: [team-data] }
    refresh_pipeline: { allow: [team-data], confirm: true }

Holding any listed role grants the tool. The roles are FusionAuth application roles, one per team (team-data, team-platform, team-fleet) plus eng-all as the default role on registration, and they arrive in the roles claim of the access token. For the data team's example this comes out as run_sql and refresh_pipeline for team-data only, and list_datasets, describe_table and run_saved_query for everyone.

A couple of choices in that layout were deliberate.

Default deny. A manifest's default audience is the owning team, so widening a tool to eng-all is an explicit line in the file, which is what makes it reviewable, since someone reading the diff sees exactly which tools left the team.

Narrow and broad are separate tools. run_saved_query (a named query) and run_sql (arbitrary SQL) are two tools with two allow lists, so the rest of engineering gets the safe one as a config line and no tool has to inspect its own arguments to decide. refresh_pipeline gets confirm: true on top because it is destructive.

What the gateway does with it

Policy is compiled from the registry at merge time and loaded by the gateway, which checks it on both tools/list and tools/call. That is the design. Whether AgentCore Gateway (the MCP gateway in Bedrock AgentCore, the AWS agent platform Northfield's platform team had already chosen) can do the list half is the open question in the verification section.

On tools/list, the gateway returns only tools whose allow matches a role in the caller's JWT. On tools/call, it checks the same policy again (a client can send a call for a tool it was never shown), opens an audit record with subject, roles, gateway, tool, argument hash, decision, result status and latency, and forwards the call to the owning target with the caller's claims as a signed internal identity (subject, roles) over the private network. The list filter is for the model. The call check is the security boundary, and it has to run even for a tool the client never saw.

Generating policy only from access closes one risk that self-service makes easy to create by accident: silent authorization drift, where someone widens access in code instead of in the manifest. Targets receive the caller's claims but can't grant anything beyond what the gateway already allowed, so the manifest diff stays the one place a reviewer has to look.

Where Cedar or OPA comes in

Cedar or OPA does two jobs here, at different times.

At request time the gateway needs the per-tool allow decision. On AgentCore the natural home is AgentCore Policy, which takes Cedar, AWS's open-source policy language, with the policies regenerated from access on every merge. OPA (Open Policy Agent) does the same job off AgentCore.

At PR time CI checks rules that span manifests, which is where a policy-as-code engine (OPA or Cedar, in the registry's policy/ directory) pays for itself:

  • A destructive tool can't be shared to eng-all unless a security approver signed the PR.
  • A write tool can't have a wildcard allow.
  • A confirm: true tool must declare a dry-run mode.
  • A tool that returns customer PII (personally identifiable information) can't be opened to all of engineering without a security-approved label on the PR.

In both jobs the manifest is the source of truth and the policy is generated from it, so the gateway, and the policy language it takes, can change without touching a team's repo.

Layer 3 is still the tool's job

Filtering the list and gating the call decide which tools a role can reach. They say nothing about which rows come back. For the data team's warehouse the difference is in the credential, not the role: a read-only one behind the shared tools, a broader one behind the team-only tools or two targets with separate execution roles when you want credential-level isolation on top of the policy.

Per-caller checks in tool code, and the audit trail, depend on the gateway forwarding caller claims (sub, email, roles) to the target. Credential-level isolation does not, which is one reason to prefer it where it fits. Claim forwarding is on the verification list below, because without it a tool can't filter rows per caller, and the target's own logs carry a request ID with no subject to tie it to.

What to verify before you build on it

Whether AgentCore Gateway can filter tools/list per caller, or only deny tools/call, is the open question for this design, and I couldn't settle it from where I sat. I haven't checked the AgentCore claims above against the current docs since the papers were written, so spend a day of the two-week spike that opens the rollout on them:

  • Can AgentCore Policy filter tools/list per caller, or only deny tools/call, and is it generally available in your region?
  • Does Gateway forward caller claims to Lambda and MCP-server targets?
  • If neither Policy nor a request interceptor can filter the list, does a thin authorizing layer in front of Gateway cost less than the fallback below?

The fallback is coarser. Giving each gateway its own FusionAuth application means a user who isn't registered for mcp-data can't obtain a token for it at all, so the filtering happens at sign-in and per gateway, with no per-tool granularity. It works, and it's where the per-domain gateway split helps, but it moves the decision from a line in a manifest to a FusionAuth registration, which is harder to review. The other option is a small proxy built on FastMCP (a Python MCP server framework) that reads the same manifests and filters the list itself, at the cost of auth code the platform team now owns.

If you're deciding this

Write the manifest format and the three-layer table before picking the gateway, then spend the first day of the two-week spike proving that tools/list comes back different for two users with different roles. If the gateway you have can't do it, take the one-application-per-gateway fallback over a custom hub and keep the access block in the manifest as is, so that nothing in the repo has to move on the day the gateway can filter.

More in this series

All articles in the series