Skip Navigation Links

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:

  1. 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.
  2. Ask AI sends the ID-JAG to the MCP Authorization Server's token URL using the urn:ietf:params:oauth:grant-type:jwt-bearer grant, authenticated with the client ID and client secret you issued to Flip.
  3. Your MCP Authorization Server validates the ID-JAG, maps the user to an account on your side and returns an access token.
  4. 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-bearer grant 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

ValueUsed asNotes
Issuer identifier of your MCP Authorization ServerIssuer in Flip, aud claim in the ID-JAGUsually the https URL of your MCP Authorization Server, e.g. https://auth.example.com/realms/example.
Token URLToken URL in FlipAbsolute https URL of the token endpoint where Flip redeems the ID-JAG.
Client ID for Flip Ask AIAsk AI client ID in Flip, client_id claim in the ID-JAGThe client you registered for Flip at your MCP Authorization Server.
Client secret for that clientClient Secret on the MCP connectorFlip stores it encrypted per organisation and never returns it via API.
Scopes Ask AI should requestScopes in Flip, scope claim in the ID-JAGAt least one scope is required. If your MCP Authorization Server does not define scopes, use profile.
MCP server URLMCP connector URLOnly if it differs from what the administrator already has.

What Flip provides to the MCP Authorization Server

ValueWhere to find it
Flip issuerhttps://{domain}/auth/realms/{organisation-id}. Becomes the iss claim of every ID-JAG.
Discovery documenthttps://{domain}/auth/realms/{organisation-id}/.well-known/openid-configuration
JWKS endpointhttps://{domain}/auth/realms/{organisation-id}/protocol/openid-connect/certs. Also listed as jwks_uri in the discovery document.
User identifier mappingWhether 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.

FieldWhat to enter
NameA display name for the MCP Authorization Server.
IssuerThe issuer identifier of your MCP Authorization Server. This value becomes the aud claim of the ID-JAG.
Token URLThe MCP Authorization Server's token endpoint.
User identifierNone, Email or Username. Controls the aud_sub claim, see User identifier.

Under Connected clients, connect the Flip client Ask AI:

FieldWhat to enter
Ask AI client IDThe 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.
ScopesOne 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):

ClaimMeaning
issThe Flip issuer, https://{domain}/auth/realms/{organisation-id}.
audThe Issuer you entered when registering the MCP Authorization Server. Always a single value.
subFlip's stable, opaque user ID. Identical to the sub you receive from Flip OIDC tokens.
client_idThe Ask AI client ID you entered for the connected client.
scopeSpace-separated list of the scopes you configured for the connected client.
aud_subThe user's identifier at your MCP Authorization Server, according to the configured user identifier. Omitted when the user identifier is None.
typAlways IDJAG.
sidFlip session ID of the user.
jti, iat, expStandard 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_sub claim. Use this if you link accounts by Flip's sub yourself.

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_id and client_secret in the form body. HTTP Basic authentication (client_secret_basic) and private_key_jwt are not supported.
  • No scope or resource parameter is sent with the token request. The granted scopes are carried inside the assertion's scope claim.
  • 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:

  1. Header type: the JWS typ header is oauth-id-jag+jwt.
  2. Signature: verify against the keys published at the Flip JWKS endpoint. Resolve it via the discovery document (jwks_uri) and cache the keys, honouring the kid header. Keys rotate.
  3. Issuer: iss equals the Flip issuer you agreed on, https://{domain}/auth/realms/{organisation-id}.
  4. Audience: aud equals your own issuer identifier, exactly as entered in Flip.
  5. Expiry: exp is in the future, iat is not in the future. Allow a small clock skew.
  6. Client binding: client_id in the assertion matches the client that authenticated the token request.
  7. Replay (recommended): reject a jti you have already seen within its validity window.
  8. User resolution: map aud_sub (or sub, 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 iss against https://{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 aud claim 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


For questions or assistance, please contact your Customer Success representative.