MCP Enterprise-Managed Authorization Guide
Guide how to connect an MCP server to Flip Ask AI using Enterprise-Managed Authorization (ID-JAG) instead of a static API key
This guide explains how to connect an MCP server to Flip Ask AI using the Enterprise-Managed Authorization extension of the Model Context Protocol (MCP). With this setup, Flip acts as the enterprise identity provider: for every Flip user who talks to a custom agent, Flip issues a short-lived identity assertion, and your MCP Authorization Server exchanges it for an access token that is scoped to that user. No long-lived API key for the MCP server is stored anywhere.
The guide is written for two readers at once:
- the team operating the MCP Authorization Server and the MCP server, who needs to validate Flip's assertions
- the Flip administrator who registers the MCP Authorization Server and the MCP connector in the admin console
If your MCP server only needs a static API key, you do not need this guide.
How it works
Enterprise-Managed Authorization uses the Identity Assertion JWT Authorization Grant (ID-JAG) defined in draft-ietf-oauth-identity-assertion-authz-grant. Flip implements the MCP client and enterprise IdP roles. You implement the MCP Authorization Server and the MCP server.
Whenever a Flip user's conversation with a custom agent needs tools from your MCP server, the following happens:
- Ask AI obtains an ID-JAG for the user from the Flip identity provider. The ID-JAG is a signed JWT addressed to your MCP Authorization Server.
- Ask AI sends the ID-JAG to the MCP Authorization Server's token URL using the
urn:ietf:params:oauth:grant-type:jwt-bearergrant, authenticated with the client ID and client secret you issued to Flip. - Your MCP Authorization Server validates the ID-JAG, maps the user to an account on your side and returns an access token.
- Ask AI calls your MCP server with
Authorization: Bearer <access token>.
Prerequisites
- Your MCP Authorization Server supports the Enterprise-Managed Authorization extension. It must accept an ID-JAG issued by Flip as an authorization grant on its token endpoint, using the
urn:ietf:params:oauth:grant-type:jwt-bearergrant type, and return an access token for the MCP server. See Validating the ID-JAG on your side for what this involves. - Your users have a matching identity on your side. Flip can identify the user to your MCP Authorization Server by their Flip email address or their Flip username (see User identifier). Whichever you choose must be present for every user who should use the MCP server and must be resolvable to an account in your system.
Information to exchange
Before the setup can start, the following information needs to be exchanged:
What the MCP Authorization Server provides to Flip
| Value | Used as | Notes |
|---|---|---|
| Issuer identifier of your MCP Authorization Server | Issuer in Flip, aud claim in the ID-JAG | Usually the https URL of your MCP Authorization Server, e.g. https://auth.example.com/realms/example. |
| Token URL | Token URL in Flip | Absolute https URL of the token endpoint where Flip redeems the ID-JAG. |
| Client ID for Flip Ask AI | Ask AI client ID in Flip, client_id claim in the ID-JAG | The client you registered for Flip at your MCP Authorization Server. |
| Client secret for that client | Client Secret on the MCP connector | Flip stores it encrypted per organisation and never returns it via API. |
| Scopes Ask AI should request | Scopes in Flip, scope claim in the ID-JAG | At least one scope is required. If your MCP Authorization Server does not define scopes, use profile. |
| MCP server URL | MCP connector URL | Only if it differs from what the administrator already has. |
What Flip provides to the MCP Authorization Server
| Value | Where to find it |
|---|---|
| Flip issuer | https://{domain}/auth/realms/{organisation-id}. Becomes the iss claim of every ID-JAG. |
| Discovery document | https://{domain}/auth/realms/{organisation-id}/.well-known/openid-configuration |
| JWKS endpoint | https://{domain}/auth/realms/{organisation-id}/protocol/openid-connect/certs. Also listed as jwks_uri in the discovery document. |
| User identifier mapping | Whether aud_sub carries the user's email, username, or is omitted. |
The same endpoints are described in more detail in the OIDC Public Client Implementation Guide.
Setup in the Flip admin console
Step 1: Register the MCP Authorization Server
In the admin console, open Ask AI → MCP Authorization Servers and choose Add authorization server.
| Field | What to enter |
|---|---|
| Name | A display name for the MCP Authorization Server. |
| Issuer | The issuer identifier of your MCP Authorization Server. This value becomes the aud claim of the ID-JAG. |
| Token URL | The MCP Authorization Server's token endpoint. |
| User identifier | None, Email or Username. Controls the aud_sub claim, see User identifier. |
Under Connected clients, connect the Flip client Ask AI:
| Field | What to enter |
|---|---|
| Ask AI client ID | The client ID the MCP Authorization Server issued to Flip. It is signed into the ID-JAG as client_id and is sent as client_id in the token request. |
| Scopes | One or more scopes, e.g. profile. Flip requests all of them in every ID-JAG. |
Step 2: Create the MCP connector
Create or edit a custom agent and add an MCP connector for your MCP server as described in How to Set Up Custom Agents with MCP Servers. Under Authentication, choose MCP Enterprise Authentication, select the MCP Authorization Server from step 1 and enter the Client Secret it issued.
When you save the connector, Flip immediately runs the full exchange for you, the logged-in administrator, and fetches the tool list from the MCP server.
⚠️ Set up the connector as a real user
The administrator who saves the connector must be a regular Flip user whose email or username (whichever is configured as user identifier) resolves to an account at the MCP Authorization Server.
If the exchange fails, the connector form shows the error, including the HTTP status and response body returned by the MCP Authorization Server's token endpoint. See Troubleshooting.
The ID-JAG issued by Flip
Flip signs the ID-JAG with the same key material it uses for its OIDC tokens (RS256 by default). The JWS header carries the type oauth-id-jag+jwt, as required by the specification. Tokens are valid for 5 minutes.
Decoded example (values shortened, signature omitted):
| Claim | Meaning |
|---|---|
iss | The Flip issuer, https://{domain}/auth/realms/{organisation-id}. |
aud | The Issuer you entered when registering the MCP Authorization Server. Always a single value. |
sub | Flip's stable, opaque user ID. Identical to the sub you receive from Flip OIDC tokens. |
client_id | The Ask AI client ID you entered for the connected client. |
scope | Space-separated list of the scopes you configured for the connected client. |
aud_sub | The user's identifier at your MCP Authorization Server, according to the configured user identifier. Omitted when the user identifier is None. |
typ | Always IDJAG. |
sid | Flip session ID of the user. |
jti, iat, exp | Standard JWT ID and timestamps. exp is at most 5 minutes after iat. |
User identifier (aud_sub)
The aud_sub claim is defined by the ID-JAG specification as "the Resource Authorization Server's identifier for the End-User". Flip fills it from one of the user's profile fields:
- Email — the user's Flip email address. Be aware that not all users in an organisation necessarily have an email address, and it may not be a company address.
- Username — the user's Flip username. Many organisations use the employee ID as the Flip username, which makes this the natural choice when your system also identifies employees by that ID.
- None — no
aud_subclaim. Use this if you link accounts by Flip'ssubyourself.
If the selected field is empty for a user, Flip does not issue an ID-JAG for that user, and the MCP server is unavailable in their conversation.
The token request sent to your MCP Authorization Server
Flip redeems the ID-JAG with an application/x-www-form-urlencoded POST to your token URL:
Things to note:
- Client authentication uses
client_secret_post, i.e.client_idandclient_secretin the form body. HTTP Basic authentication (client_secret_basic) andprivate_key_jwtare not supported. - No
scopeorresourceparameter is sent with the token request. The granted scopes are carried inside the assertion'sscopeclaim. - Flip does not follow redirects from the token endpoint and treats any non-2xx response as a failure.
Your response must be a JSON object containing a non-empty access_token string, following RFC 6749 §5.1:
Flip uses the access token as a Bearer token for all requests to the MCP server during the conversation turn. Flip does not refresh the token within a turn; issue tokens that live at least a few minutes.
Validating the ID-JAG on your side
Your MCP Authorization Server must validate every assertion before issuing an access token. At minimum:
- Header type: the JWS
typheader isoauth-id-jag+jwt. - Signature: verify against the keys published at the Flip JWKS endpoint. Resolve it via the discovery document (
jwks_uri) and cache the keys, honouring thekidheader. Keys rotate. - Issuer:
issequals the Flip issuer you agreed on,https://{domain}/auth/realms/{organisation-id}. - Audience:
audequals your own issuer identifier, exactly as entered in Flip. - Expiry:
expis in the future,iatis not in the future. Allow a small clock skew. - Client binding:
client_idin the assertion matches the client that authenticated the token request. - Replay (recommended): reject a
jtiyou have already seen within its validity window. - User resolution: map
aud_sub(orsub, if you store Flip's user ID) to an account, and apply your own access policy. Return an OAuth error if the user is not allowed to use the MCP server.
Return standard OAuth 2.0 error responses (invalid_grant, invalid_client, invalid_scope, ...) with a short error_description. Flip forwards status and body to the administrator, which makes configuration mistakes much faster to find.
Troubleshooting
- Error messages: when saving an MCP connector fails, the console shows the HTTP status and the body returned by the token endpoint. End users in chat only see a generic message; details are not exposed to them.
- Flip cannot hand over tokens for inspection. Production systems do not log tokens or their claims. To debug claim values, log the incoming assertion on your MCP Authorization Server in a test environment.
- Issuer mismatch: check that the setup and the affected users use the customer-facing domain, and that the MCP Authorization Server validates
issagainsthttps://{domain}/auth/realms/{organisation-id}for that domain. Testing environments have a different domain and therefore a different issuer than production. - Audience mismatch: compare the
audclaim with the Issuer field in Flip character by character, including scheme and trailing slashes. invalid_client: the client ID entered in Flip or the client secret on the connector does not match the registration at the MCP Authorization Server. Re-enter the secret on the connector.- The tool list cannot be fetched during setup: the administrator saving the connector has no matching identity at the MCP Authorization Server. Repeat the setup as a real user with a valid identifier.
- Access works in one Flip environment but not another: the Flip issuer differs per environment and per organisation, and the MCP Authorization Server must accept each one.
Additional resources
- Enterprise-Managed Authorization on modelcontextprotocol.io
- Full extension specification in the MCP ext-auth repository
- Identity Assertion Authorization Grant (IETF draft)
- RFC 7523: JWT Profile for OAuth 2.0 Client Authentication and Authorization Grants
- RFC 8693: OAuth 2.0 Token Exchange
- OIDC Public Client Implementation Guide for the Flip identity provider endpoints
For questions or assistance, please contact your Customer Success representative.