aud claim. Read OAuth 2.0 Mode first if you have not already, it covers the parts of this flow that are the same for every provider.
1. Confirm your realm’s metadata
Keycloak exposes RFC 8414 metadata per realm at:registration_endpoint and jwks_uri are present.
2. Enable open client registration
- Open your Keycloak admin console and select your realm.
- Go to Realm settings → General.
- Confirm Client registration → Open is enabled. This allows Dynamic Client Registration without an initial access token, which is what lets MCP clients like Claude and Cursor register themselves automatically.
If your organization requires registration to stay locked down, you can instead configure an Initial Access Token and pre-register the specific MCP client you use, but this removes the zero-configuration behavior MCPCore otherwise gives you.
3. Add an audience mapper
Keycloak does not automatically setaud to the resource parameter a client sends. Instead, you add a protocol mapper that stamps a fixed audience value onto every token issued through a given client or client scope.
- Go to Client scopes, and either edit an existing scope applied to all clients (such as the default
profilescope) or create a new dedicated scope, for examplemcpcore-audience. - Open the Mappers tab, click Add mapper → By configuration → Audience.
- Set:
- Name:
mcpcore-audience - Included Custom Audience:
https://{your-subdomain}.mcpcore.io/mcp, this must match your MCPCore resource URL exactly, including the/mcppath - Add to access token: on
- Name:
- If you created a dedicated client scope, go to Realm settings → Client policies, or your realm’s default client scopes, and make sure it is assigned as a Default client scope so every dynamically registered client picks it up automatically.
If you run multiple MCPCore servers from the same Keycloak realm, each one needs its own client scope with its own audience mapper, since a single scope only stamps one fixed audience value.
4. Configure MCPCore
1
Open Server Settings
Go to your server’s Settings tab in the MCPCore dashboard.
2
Select OAuth 2.0
Under Security mode, select OAuth 2.0.
3
Paste the metadata URL
4
Leave Legacy token audience off
Since the audience mapper stamps your MCPCore resource URL onto every token, no fallback is needed.
5
Save
MCPCore validates the metadata URL and activates OAuth 2.0 mode.