> ## Documentation Index
> Fetch the complete documentation index at: https://radarhq.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP clients

> Let MCP clients (Claude Code, Cursor, and others) sign in to a Self-Managed hub with your own identity provider, and reach clusters that use people's own tokens.

MCP clients (Claude Code, Cursor, …) can sign in to a Self-Managed hub with the same OIDC provider people use in the browser, instead of a personal access token. The hub publishes its resource metadata at `<hub.publicURL>/.well-known/oauth-protected-resource/mcp`, naming your issuer (`auth.oidc.issuer`) as the authorization server, and accepts that issuer's access tokens on `/mcp`.

Requires Hub 1.14.1 or newer.

## Requirements

* `hub.publicURL` is `https://` and reachable by the people running MCP clients.
* The access token your IdP issues carries the email claim (`auth.oidc.emailClaim`, default `email`), and the groups claim (`auth.oidc.groupsClaim`) if clusters bind IdP groups.
* The user is the same as their browser sign-in: both are keyed on the IdP's `sub`.

## Set up sign-in

> [!TIP]
>
> In Radar, **Settings → AI & MCP → MCP sign-in → Set up MCP sign-in** fills in the steps below with your hub's own values: a script (or portal checklist) for your IdP, the Helm command for how your clusters are reached, and the command to add the server to your MCP client. Use the steps below if you'd rather configure it by hand.

### In your IdP

If your clusters use [user tokens](https://radarhq.io/docs/cloud/self-hosted/user-tokens.md) (`auth.oidc.clusterAccess: token`), Keycloak and other IdPs need an extra step for the token exchange, marked *(User tokens only)*. Entra ID needs none.

> [tab] Microsoft Entra ID
>
> MCP clients send `resource=<hub.publicURL>/mcp`, and Entra only accepts it when it's the Application ID URI of the app that owns the requested scope. Use the app registration the hub already signs people in with ([why](#why-one-app-and-two-scopes)).
>
> > [tab] Portal
> >
> > 1. **Manifest** → in `api`, set `"requestedAccessTokenVersion": 2` → **Save**. Without it, access tokens for this app are v1, issued by `https://sts.windows.net/<tenant>/`: the hub rejects them on `/mcp`, and API servers that trust the v2 issuer reject the exchanged token. ID tokens are not affected.
> > 2. **Expose an API**:
> >
> >    * **Application ID URI** → **Add** → `https://<hub host>/mcp` (no trailing slash) → **Save**.
> >
> >    * **Add a scope** → **Scope name** `access_as_user`, **Who can consent** **Admins and users** (or **Admins only**, then grant admin consent), a display name and description for the consent screen, **State** **Enabled** → **Add scope**.
> >
> >    > [!WARNING]
> >    >
> >    > If **Application ID URI** already has a value (e.g. `api://<client ID>`), don't edit it: **Edit** replaces it, and anything that requests scopes through it stops working. The portal has no option to add a second URI. Add it in **Manifest** instead, then **Save**:
> >    >
> >    > ```json theme={null}
> >    > "identifierUris": ["api://<client ID>", "https://<hub host>/mcp"]
> >    > ```
> > 3. **Token configuration** → **Add optional claim** → **Access** → `email` → **Add**. If clusters bind IdP groups, edit the groups claim and tick **Access**.
> > 4. **Authentication** → **Add a platform** → **Mobile and desktop applications** → custom redirect URI `http://localhost:8765/callback` → **Configure**. MCP clients are public clients: they use PKCE and no secret.
>
> > [tab] Azure CLI
> >
> > ```bash theme={null}
> > APP="<application (client) ID>"
> > HUB="https://<hub host>"
> > GRAPH="https://graph.microsoft.com/v1.0/applications/$(az ad app show --id "$APP" --query id -o tsv)"
> > ```
> >
> > 1. v2 access tokens. Without them, the hub rejects this app's access tokens on `/mcp`, and API servers reject the exchanged token.
> >
> >    ```bash theme={null}
> >    az ad app update --id "$APP" --set api.requestedAccessTokenVersion=2
> >    ```
> >
> > 2. Application ID URI and the `access_as_user` scope. `--identifier-uris` replaces the whole list, so the command passes the app's existing URIs back with the new one.
> >
> >    ```bash theme={null}
> >    az ad app update --id "$APP" --identifier-uris $(az ad app show --id "$APP" --query 'identifierUris[]' -o tsv) "$HUB/mcp"
> >    az ad app show --id "$APP" --query api -o json | jq --arg id "$(uuidgen)" '{api: {oauth2PermissionScopes: (.oauth2PermissionScopes + [{
> >      id: $id, value: "access_as_user", type: "User", isEnabled: true,
> >      adminConsentDisplayName: "Use Radar over MCP", adminConsentDescription: "Lets MCP clients call Radar Hub as the signed-in user.",
> >      userConsentDisplayName: "Use Radar over MCP", userConsentDescription: "Lets MCP clients call Radar Hub as you."}])}}' > scope.json
> >    az rest --method PATCH --uri "$GRAPH" --body @scope.json
> >    ```
> >
> > 3. `email` and `groups` on the access token, keeping the claims the app already has. `groups` only takes effect with the app's groups claim set (`groupMembershipClaims`).
> >
> >    ```bash theme={null}
> >    az ad app show --id "$APP" --query optionalClaims -o json \
> >      | jq '{optionalClaims: ((. // {}) | .accessToken = ((.accessToken // []) + [{name: "email"}, {name: "groups"}] | unique_by(.name)))}' > claims.json
> >    az rest --method PATCH --uri "$GRAPH" --body @claims.json
> >    ```
> >
> > 4. Public client redirect for MCP clients. `--public-client-redirect-uris` replaces the whole list: add any redirects the app already has.
> >
> >    ```bash theme={null}
> >    az ad app update --id "$APP" --public-client-redirect-uris http://localhost:8765/callback
> >    ```

> [tab] Keycloak
>
> 1. A public client for MCP clients (e.g. `radar-mcp`, redirect `http://localhost:8765/callback`) with an **Audience** mapper adding the hub client (`auth.oidc.clientID`), a groups mapper on the access token, and an optional client scope `mcp` (**Include in token scope** on).
> 2. *(User tokens only)* Keycloak 26.2 or newer. On the hub client (`auth.oidc.clientID`): **Capability config → Standard Token Exchange** on, and an **Audience** mapper adding the hub client itself to access tokens (Keycloak only issues an audience its client scopes produce).

> [tab] Other IdPs
>
> 1. Any OIDC provider that issues JWT access tokens for the hub works. Register a public client with PKCE and the redirect `http://localhost:8765/callback`.
> 2. *(User tokens only)* The IdP must support the OAuth 2.0 token exchange grant (RFC 8693) for the hub's client. Okta (a custom authorization server with the Token Exchange grant enabled) and Auth0 (on-behalf-of token exchange) both support it, but we haven't tested them yet. Google Workspace has no token exchange, so it can't be used for MCP clients on clusters that use user tokens.

### In the hub

Save the values for your IdP as `radar-hub-mcp.yaml`. As written, they work with Hub roles and IdP groups. If your clusters use user tokens, uncomment the `tokenExchange` lines ([what it does](#clusters-on-user-tokens)).

> [tab] Microsoft Entra ID
>
> ```yaml radar-hub-mcp.yaml theme={null}
> auth:
>   oidc:
>     mcpOAuth:
>       enabled: true
>       scopes: ["https://<hub host>/mcp/access_as_user", "openid", "profile", "email", "offline_access"]
>       audience: "<application (client) ID>"   # Entra v2 tokens carry it as aud
>       requiredScope: access_as_user            # keeps this app's ID tokens off /mcp
>
>       # User tokens (clusterAccess: token): uncomment.
>       # tokenExchange:
>       #   strategy: entra-obo
>       #   # With clusterToken: access_token, the hub requests the API scope from auth.oidc.scopes.
>       #   # Set it yourself only if auth.oidc.scopes has no API scope or more than one.
>       #   # Never the MCP scope (access_as_user).
>       #   # scopes: ["api://<client ID>/cluster.access"]
> ```

> [tab] Keycloak
>
> ```yaml radar-hub-mcp.yaml theme={null}
> auth:
>   oidc:
>     mcpOAuth:
>       enabled: true
>       scopes: ["mcp", "openid", "profile", "email", "offline_access"]
>       audience: "<hub client ID>"
>       requiredScope: mcp                       # keeps the hub client's ID tokens off /mcp
>
>       # User tokens (clusterAccess: token): uncomment.
>       # tokenExchange:
>       #   strategy: rfc8693
> ```

> [tab] Other IdPs
>
> ```yaml radar-hub-mcp.yaml theme={null}
> auth:
>   oidc:
>     mcpOAuth:
>       enabled: true
>       scopes: []        # empty = openid email profile offline_access
>       audience: ""      # empty = <hub.publicURL>/mcp
>       # If audience is the hub's own client ID, set requiredScope to a scope only
>       # MCP clients request: the hub refuses to start otherwise.
>       # requiredScope: "<scope>"
>
>       # User tokens (clusterAccess: token): uncomment.
>       # tokenExchange:
>       #   strategy: rfc8693
>       #   # The audience defaults to the hub's client ID (clusterTokenAudience with
>       #   # clusterToken: access_token). Override it, or set scopes if your IdP
>       #   # selects the target by scope.
>       #   # audience: "<audience>"
>       #   # scopes: ["<scope>"]
> ```

Then apply them:

```bash theme={null}
helm upgrade radar-hub skyhook/radar-hub \
  --namespace radar-hub \
  --reset-then-reuse-values \
  -f radar-hub-mcp.yaml
```

### Connect your MCP client

Each user adds the server with the client ID of the app MCP clients sign in through: the Entra app's **Application (client) ID**, the Keycloak public client (e.g. `radar-mcp`), or the client you registered. Entra has no dynamic client registration, so the client ID is required there.

```bash theme={null}
claude mcp add --transport http radar https://<hub host>/mcp \
  --client-id '<client ID>' --callback-port 8765
```

Then `/mcp` → `radar` → **Authenticate**.

On Entra, every MCP client signs in as the same app, so the Agents page lists one client per person rather than one per tool.

## Clusters on user tokens

With `auth.oidc.clusterAccess: token`, the hub doesn't forward the MCP access token to clusters. It exchanges it at your IdP for a token your API servers accept, with the same audience as browser sign-in, and relays that. Without `tokenExchange`, MCP sign-in works, but clusters refuse live calls from MCP clients.

* The exchanged token is an access token, even when browser sign-in relays the ID token: the email and groups claims must be on access tokens too.
* Entra ID with `clusterToken: access_token`: the hub requests the API scope from `auth.oidc.scopes`. If `auth.oidc.scopes` has no API scope or more than one, set `tokenExchange.scopes`.

## Why one app and two scopes

On Entra ID:

* **One app.** Entra gives each person a different `sub` in every app, and the hub keys people on `sub`: MCP sign-in through a second app would be a different user from the same person's browser sign-in. On-behalf-of also only exchanges tokens issued to the hub's own app.
* **Two scopes.** `cluster.access` is the scope your API servers require; `access_as_user` is the one `/mcp` requires (`requiredScope`). As long as both sides check their scope, a token meant for a cluster isn't accepted on `/mcp`, and the reverse. The hub refuses to start with the MCP scope in `tokenExchange.scopes`.

## Troubleshooting

| Error | Cause |
| - | - |
| `AADSTS9010010` (resource doesn't match the requested scopes) | The Application ID URI isn't exactly `<hub.publicURL>/mcp`, or no scope in `mcpOAuth.scopes` belongs to that app. |
| `AADSTS65005` (scope doesn't exist) | The scope in `mcpOAuth.scopes` isn't defined under **Expose an API**. |
| `AADSTS50011` (redirect URI mismatch) | The client's callback isn't registered under **Mobile and desktop applications**, or `--callback-port` differs. |
| Hub returns 401 after sign-in | `mcpOAuth.audience` isn't the client ID, `requestedAccessTokenVersion` isn't 2, the token has no email claim (`auth.oidc.emailClaim`), or it lacks `requiredScope`. |
| Browser sign-in refused: "/mcp would accept this token" | `clusterToken: access_token`, and `auth.oidc.scopes` requests the MCP scope. Request a different scope there. |
| MCP calls answer 403 "refused to issue a Kubernetes token" | The exchange was refused; the IdP's reason follows (consent, Conditional Access, Keycloak "Requested audience not available"). |
| MCP sign-in works, but clusters answer `token_rejected` and Radar logs "Kubernetes rejected the token" | The exchanged token lacks the scope your API servers require. Set `tokenExchange.scopes` to the API scope browser sign-in requests (e.g. `api://<client ID>/cluster.access`). |
| MCP calls answer 503 "identity provider is unavailable" | The IdP token endpoint is down or rate-limiting. |
| `/.well-known/oauth-protected-resource/mcp` returns 404 | `mcpOAuth.enabled` is off, or something in front of the hub doesn't route `/.well-known/` to it. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.