Prerequisites
- Tyk Gateway and Tyk Dashboard, both v5.14.0 or later
- Tyk Developer Portal v1.19.0 or later
- A running instance of your Identity Provider (a local
docker run quay.io/keycloak/keycloak start-devinstance is sufficient for testing with Keycloak) - An MCP proxy already configured and published as a Product in the Portal. See Creating a New Product
Configure Your Identity Provider
- Create a realm (or equivalent tenant/organization boundary in your IdP) With Keycloak, create a dedicated realm for this MCP proxy (or reuse an existing one). All the steps below happen inside that realm.
-
Create a Client Scope for the Product/Plan
Create a scope whose name matches the OAuth 2.0 scope you will assign to the Product and Plan in the Portal. Its type must be Optional - this ensures the scope is only issued when the Portal explicitly requests it during Dynamic Client Registration, rather than being attached to every client by default.
This page uses a Product named “MCP Bronze” as a worked example, with two scopes:
product_mcp_bronzefor the Product itself andbronze_planfor its Plan. Create both now - substitute your own Product and Plan names throughout. In Keycloak:- In the left navigation, select Client scopes.
- Select Create client scope (top right).
- Set Name to
product_mcp_bronze. - Leave Description empty.
- Set Type to Optional.
- Leave Protocol as OpenID Connect.
- Select Save.
- Repeat steps 2-7 for a second scope named
bronze_plan. - On the Client scopes list page, select the checkboxes for
product_mcp_bronzeandbronze_plan, then select Assign type > Optional.
Both scopes now appear on the Client scopes page with type Optional, and are assigned to the realm as optional scopes. Both steps (creating the scope and assigning it to the realm) are required for Dynamic Client Registration to work; skipping the assignment fails registration with
403 Forbidden(“Client scopes not allowed”). -
Obtain an initial access token
Most IdPs use an initial access token to authorize the Portal to register OAuth 2.0 clients on a Consumer’s behalf. Some IdPs use a different mechanism instead - see Authorize the Portal for the exceptions (Gluu, Auth0).
This step is IdP-side only - the token you generate here is pasted into the Portal’s OAuth 2.0 Providers screen in Register Your Identity Provider in the Portal below, in the Registration access token field.
In Keycloak:
- In the left navigation, select Clients.
- Select the Initial access token tab.
- Select Create.
- Set Expiration to
1Days and Count to5(how many clients this token may register - a small headroom for retries while testing). Leave Web origins empty. - Select Save.
- Copy the token value shown. Keycloak displays it only once - if you lose it, generate a new one.
Configure PRM on the Gateway
This step is done in Tyk Dashboard’s API Designer, on the MCP proxy’s Tyk OAS definition, and is identical regardless of which IdP you use. See MCP Gateway: OAuth 2.1 Authentication for the MCP-specific overview, or OAuth 2.0 with an External IdP for the fulloauth2 scheme field reference.
The
oauth2 security scheme does not validate a token’s JWT signature itself - it only handles scope enforcement, PRM publishing, and token exchange. JWT authentication must also be configured on the same API, or Tyk’s auth chain rejects the request before the oauth2 scheme is ever reached. The Dashboard enforces this: selecting OAuth 2.0 as the only authentication method shows the warning “OAuth 2.0 requires JWT authentication. Add JSON Web Token (JWT) to Authentication Methods to continue.” The steps below configure both together, via Multiple Authentication Mechanisms.- Open the Authentication settings In Tyk Dashboard, open the MCP proxy’s OAS definition and go to its Authentication settings.
-
Enable Multiple Authentication Mechanisms
On the Server step of the API Designer, set Authentication to Multiple Authentication Mechanisms. Under Authentication methods, select both JSON Web Token (JWT) and OAuth 2.0. Both are required together - see the note above. Set Base identity provider to JSON Web Token (JWT) - this is the method whose identity Tyk uses when Legacy mode is active.

-
Configure the JWT method
Within the JSON Web Token (JWT) method, set:
It’s recommended to configure the JWKS URI centrally via the Identity Provider Registry instead of directly on this method, particularly since the Portal also manages this IdP through Dynamic Client Registration. Configuring it here means the JWKS URI is embedded in this API’s OAS definition - if the Portal and Dashboard ever write to the same definition concurrently, one can silently overwrite the other’s change. Deleting a DCR-registered Product from the Portal also doesn’t reliably clean up JWKS/scope config left directly on an API definition, leaving it orphaned. The Identity Provider Registry avoids both problems by keeping IdP configuration as its own resource, decoupled from any single API definition - see What Is the Identity Provider Registry for the full reasoning. -
Configure the OAuth 2.0 method’s Protected Resource Metadata panel
Within the OAuth 2.0 method, open the Protected Resource Metadata panel and set:
This is static mode - the Portal will show this authorization server directly to Consumers, rather than runtime-discovery guidance. See Mirror and Static PRM for the difference. A read-only Effective scopes_supported preview below the panel shows exactly what the published PRM document will advertise - it stays empty until scopes exist in the OAS flows catalog, Required scopes policy, or a per-operation/per-primitive override, none of which this walkthrough configures.
-
Leave Required scopes and Token Exchange as-is for this walkthrough
The OAuth 2.0 method also has Scope Check (a Required scopes policy enforced independently of DCR) and Token Exchange panels. Neither is required for this walkthrough - leave Enforce scope check off unless you also want API-level scope enforcement beyond what DCR already provides.
The
oauth2scheme’s Required scopes policy (scopeCheck) is configured entirely in Tyk Dashboard - the Developer Portal does not yet surface or manage it. This is on the immediate roadmap. This does not affect the DCR scope assignment on Products and Plans covered later in this page, which the Portal already manages via Dynamic Client Registration - that is a separate, existing mechanism. - Select Save MCP Proxy
Register Your Identity Provider in the Portal
-
Enable the Identity Provider Registry
If not already enabled, set
TYK_PORTAL_ENABLEIDPREGISTRY=trueand restart the Portal. See Identity Provider Registry for why this is the recommended approach. -
Create the OAuth 2.0 Provider
In the Admin Portal, navigate to OAuth 2.0 Providers and select Add provider (or equivalent). Under Identity provider details, set:
Before saving, select Test the connection with the identity provider to confirm the Portal can reach your IdP. Full field reference: Connection Settings.
-
Add a Client Type
Under Client types for Identity provider, select Add ClientType. Add at least one - for a first test,
client_credentialsgrant withclient_secret_basictoken endpoint authentication is the simplest to validate manually. This section is referred to as Client Profiles elsewhere in the documentation - see Client Profiles for the full field reference. Selecting Add ClientType opens a form:

-
Assign the scope to the Product and Plan
Both scopes must already exist in your IdP before the Product or Plan is published - see OAuth 2.0 Scopes.
On the Product:The Scopes field only registers a value once it’s committed as a tag - press Enter after typing each scope name. Clicking Save Changes immediately after typing, without pressing Enter first, saves the record but silently drops whatever you typed, leaving Scopes empty with no error shown. This applies on both the Product and the Plan.
- Navigate to Products and open your MCP Product.
- Select the Dynamic Client Registration tab.
- Select Enable dynamic client registration.
- Enter
product_mcp_bronzein the Scopes field. - Set Identity provider to the OAuth 2.0 Provider you created earlier (Keycloak for this worked example).
- Under Specify client types, select the Client Type you created in the previous step.
- Select Save Changes.
On the Plan:
- Navigate to Plans and open the Plan.
- Select Advanced Settings.
- In the Scopes field, enter
bronze_plan. - Select Save Changes.
Approve a Test Access Request
- As a Consumer, submit an access request for the Product, selecting the Client Profile you created.
- As an Owner, approve the request. The Portal registers a real OAuth 2.0 client in your IdP at this point, using the initial access token from earlier.
- Retrieve the issued credential from the Developer App. See Where Developers Find Token Information for what the credential card shows.
Test the End-to-End Flow with the Inspector
- Open the MCP proxy’s Product detail page and open the Inspector. See Test MCP Tools with the Embedded MCP Inspector if you haven’t used it before.
-
Request a token from your IdP directly, using the Client ID and Secret from the credential in the previous step, and requesting both the
product_mcp_bronzeandbronze_planscopes. The credential card tells you which authorization server to use, but does not provide a runnable command - for Keycloak, request a token withclient_credentialslike this:Take theaccess_tokenvalue from the JSON response and enter it into the Inspector’s connection form asBearer <access_token>in the Authorization header field. - Call a tool. A successful response confirms PRM discovery, IdP token issuance, and Gateway-side token validation are all working together correctly.

Related
- MCP Gateway: OAuth 2.1 Authentication - MCP-specific PRM and token exchange overview
- OAuth 2.0 with an External IdP - full
oauth2security scheme field reference, including scope enforcement and its JWT dependency - Identity Provider Registry - how IdP configuration is centrally managed
- Dynamic Client Registration - full DCR setup reference, including provider-specific instructions for Keycloak, Okta, Auth0, Curity, and Gluu
- Access Protected MCP Proxies with OAuth 2.1 - what the Consumer sees once access is approved
- Test MCP Tools with the Embedded MCP Inspector - using the Inspector generally