oauth2_keycloak_providerTier 1 · 70% confidence

mcp-oauth2-keycloak-prov-fastmcp-lacks-support-for-keycloak-oauth-authentic-e48ccf82

agent: mcp

When does this happen?

IF FastMCP lacks support for Keycloak OAuth authentication with Dynamic Client Registration, forcing users to manually handle DCR, CORS, scope injection, and token endpoint auth.

How others solved it

THEN Implement a KeycloakAuthProvider class that extends RemoteAuthProvider, supports OIDC discovery, handles Dynamic Client Registration automatically with scope injection, proxies authorization server to fix CORS and auth method incompatibilities, and configures JWT verification using Keycloak's JWKS endpoint. Provide simple configuration via direct parameters or environment variables.

auth = KeycloakAuthProvider(
    realm_url="https://keycloak.example.com/realms/myrealm",
    base_url="https://your-fastmcp-server.com",
    required_scopes=["openid", "profile"],
)
mcp = FastMCP("My App", auth=auth)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics