MCP OAuth with FusionAuth and three details that block clients
FusionAuth works as the OAuth 2.1 server for an MCP platform if you verify dynamic client registration, token audience and RFC 9728 metadata first.
Chatis Santos · October 19, 2026 · 7 min read · For engineers
FusionAuth can be the only authorization server for a shared MCP platform. Most of the setup is ordinary OpenID Connect: Google as the identity provider, one application for the MCP clients, team membership carried as roles in the JWT. The parts that bite are three details the MCP spec expects and FusionAuth or your gateway may not do by default, dynamic client registration, the token audience and protected resource metadata, and each of them can stop Claude.ai, Claude Code or Cursor from connecting at all. I'd spend one day checking them against the FusionAuth version you run before any team builds on the platform.
This is the identity plane of the MCP (Model Context Protocol) platform I put together for Northfield Energy. It covers getting a token into the client and getting the gateway to trust it.
How the pieces map in FusionAuth
FusionAuth is the OAuth 2.1 authorization server, the MCP gateway is the resource server and teams are FusionAuth groups. Only FusionAuth ever sees a Google token. The gateway and everything behind it see a FusionAuth JWT.
- Identity provider. Google, restricted to the
northfield-energy.comWorkspace domain, with auto-registration into the application and "link on email" so existing FusionAuth users map cleanly. - Application. One application,
Northfield Engineering MCP, configured for authorization code with PKCE and refresh tokens. One shared application is fine to start (the exception is in the next paragraph). Split it per client type later if you want separate audiences for Claude.ai, Claude Code and agents, and add the device grant later if CLI-only tools need it. - Roles. One role per team on that application (
team-data,team-platform,team-fleet), plus a couple of cross-cutting ones (eng-allas the default role on registration,mcp-admin). - Groups. A group is a team and grants the team's role, so adding someone to the data engineering group gives them
team-data. Manage groups with the FusionAuth Terraform provider from the same registry repo that holds the MCP manifests, so a change toteams.yamlis a PR instead of a console click. - The token. Roles land in the
rolesclaim. If you want team membership and permissions kept separate, add ateamsclaim with a JWT populate lambda.
The gateway validates issuer, audience, signature and expiry on every request, then checks the roles claim against the role list in each tool's manifest, on both tools/list and tools/call, so a user only sees the tools their roles allow. Whether AgentCore Gateway can filter tools/list per role is still on the verification list. If it can only deny tools/call, the coarser fallback is a FusionAuth application per gateway, which is the exception to the single-application advice above. How the filtering works, and why I want tools hidden rather than refused, is in role-filtered tools/list.
The sign-in flow as the client sees it
The flow is standard authorization code with PKCE.
- The engineer adds the gateway URL as a custom connector in Claude.ai, Cursor or Claude Code.
- The client fetches the gateway's protected resource metadata, finds FusionAuth from it and registers itself as an OAuth client (or uses a client ID you pre-registered).
- The client starts authorization code with PKCE. FusionAuth redirects to Google, and the engineer signs in with their Northfield account.
- FusionAuth issues an access token carrying
roles. The client sends it as a bearer on every MCP request and refreshes it silently. - The gateway validates the token and applies per-tool policy.
Step 2 depends on the gateway serving the right metadata and on FusionAuth accepting a registration it has never seen. Step 4 depends on the token naming the right audience.
Detail 1: dynamic client registration
MCP clients such as Claude.ai expect to register themselves with the authorization server using Dynamic Client Registration (DCR, RFC 7591). Whether FusionAuth supports that depends on the version and plan you run, and I couldn't settle it from outside Northfield's environment. Without it the connector flow stops at step 2.
If it does not, there are two workarounds and both are fine:
- Pre-registered clients. One OAuth client per client type, and engineers paste the client ID into the connector's advanced settings. Claude supports that.
- A DCR shim. A small service in front of FusionAuth that accepts the registration request and maps it onto a pre-created client. More moving parts, but the engineer sees the zero-config flow.
I'd take the first option until someone complains, because the shim is code the platform team has to keep working as clients change, and clients change often.
Detail 2: the token audience
The MCP spec wants access tokens scoped to the resource the client is calling, which here is the gateway. FusionAuth sets aud to the application's client ID by default. With one gateway and one application you can get away with the default, as long as the gateway's inbound authorizer accepts exactly that client ID and rejects anything else, including a token minted for another FusionAuth application. I'd still set the audience to the gateway's identifier (through application configuration or a populate lambda) and have the gateway validate that, because once a second gateway sits behind the same application, a client-ID audience makes a token for one gateway good for all of them.
Keep the access token lifetime short and lean on refresh tokens either way. If you run more than one gateway (the architecture doc recommends two to four), there is a question I could not answer without a spike: can one FusionAuth sign-in cover several gateways, through resource indicators or per-gateway audiences, or is it one sign-in per gateway? Either answer is workable and only changes the onboarding doc.
One more consequence of the audience rule is that a token with aud set to the gateway is good for nothing else, so a tool must never forward it to Salesforce, Databricks or Google. The spec forbids passthrough, and the reasoning is in never pass the user's token downstream.
Detail 3: protected resource metadata
The gateway must serve /.well-known/oauth-protected-resource (RFC 9728) pointing at FusionAuth. This is how a client that has only been given the gateway URL finds the authorization server, and without it the flow never starts.
Confirm that whichever gateway you pick emits it. Northfield's platform team had already chosen Bedrock AgentCore, and whether AgentCore Gateway does is on my verification list. I didn't check it against the current AgentCore docs when I wrote the papers, so confirm it there first. If it does not serve it, the fix is a thin reverse proxy in front of each gateway that serves the metadata and forwards everything else.
Agents and other non-human callers
Agents built on AgentCore and scheduled jobs get their own tokens and their own roles, never a person's. In FusionAuth that is the client credentials grant through Entities (check that your plan includes them), with grants mapped to the same role names humans use. AgentCore workload identity is the alternative, but it means the gateway trusts a second issuer, so I'd stay with Entities. When an agent acts for a person, carry the person as a separate claim and have the gateway authorize on the intersection of the two sets of roles.
What the phase 0 spike tests
The one-day check on the three details sits inside a phase 0 of about two weeks that settles the whole identity and gateway question. What ships in phase 0 is small on purpose: the FusionAuth application with the Google identity provider, one hello-world MCP behind the gateway and connections from Claude.ai, Claude Code and one AgentCore agent.
The exit gate is that DCR (or the pre-registered client workaround), the audience and the role claims all work with real clients, and the gateway filters tools by role. None of the three failures changes the architecture. A missing metadata document or unsupported DCR gets a thin proxy in front of the gateway, and a wrong audience is a FusionAuth or authorizer config change.
What I'd test, and how:
| Question | Answered by |
|---|---|
| Does this FusionAuth version support DCR? | Connect Claude.ai with no pre-registered client |
Which aud value does the gateway accept, and does it reject a token from another app? |
Mint two tokens, send both |
Does the gateway serve /.well-known/oauth-protected-resource? |
curl it from outside the VPC |
Do the roles claims reach the gateway, and does tools/list change per role? |
Two test users in two groups |
| Can one sign-in cover more than one gateway? | Stand up a second gateway |
| Does the client credentials grant work on this plan? | One agent token, one tool call |
The failure I'm trying to prevent is a team building its first real MCP and then finding out that Claude Code cannot complete the handshake. Cursor is not in the phase 0 list. V1 client scope is still an open decision at Northfield, and each client added is one more OAuth client to register and test.
If you're deciding this
I'd keep FusionAuth as the only issuer, run the spike before any team commits code and take the pre-registered client route for DCR until a real engineer asks for the zero-config flow. A spike plan or a FusionAuth application config takes me about a day to check, if you'd like a second pair of eyes on yours.
- 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.
- Never pass the user's token to a downstream system
MCP token passthrough is banned by the spec. Stop the FusionAuth token at the gateway, give each backend its own credential and check aud per gateway.