AI MCP OAuth2

AI License Required Tech Preview

Configure the AI MCP Oauth2 pluginv3.12+

Configure the AI MCP Oauth2 plugin.

The AI MCP OAuth2 plugin is in a tech preview state. The OAuth 2.0 specification for MCP is still new and evolving, and most identity providers do not yet fully implement the required metadata and flows. As a result, the plugin behavior and configuration options may change in future releases.

Audience validation

This example sets insecure_relaxed_audience_validation to true to skip audience validation for MCP tokens if the authorization server doesn’t include the resource URL in the audience (aud) claim. This is defined in RFC 8707, but not all authorization servers implement it yet.

Environment variables

  • MCP_AUTH_URL: The MCP authentication resource endpoint.

  • KEYCLOAK_AUTHZ_URL: The Keycloak authorization server URL.

  • KEYCLOAK_INTROSPECTION_URL: The Keycloak token introspection endpoint. Kong Gateway uses this endpoint to verify access tokens sent by MCP client.

  • CLIENT_ID: The client ID used by Kong Gateway in introspection.

  • CLIENT_SECRET: The client secret used by Kong Gateway in introspection.

Set up the plugin

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!