Skip to main content

Configuring Authentication for MCP Servers

When you create an MCP server in the AI Gateway, authentication works in two directions:

  • Who connects to your MCP server? This is called Agent Authentication. It's how your team members, AI assistants, or automated pipelines prove their identity before using the server.
  • How does your MCP server connect to the app behind it? This is called App Authentication. It's the credential the gateway uses when it calls Gmail, Slack, GitLab, or whatever service your MCP server wraps.

You can configure both on any MCP server in the MCP Registry: open the server, select the Configuration tab, and find them under Access.

Quick Start: Which setup do I need?​

Find your situation below and jump to the relevant section.

I want to...What to configure
Let my team use this MCP server from Cursor, Claude Desktop, or VS CodeAgent Auth → Interactive (SSO)
Let a CI/CD pipeline or script use this MCP serverAgent Auth → Passthrough
Connect to an app that uses OAuth (Google, Slack, GitLab, etc.)App Auth → OAuth 2.1 Authorization
Let people reach an app through the trust my identity provider already has with itApp Auth → Cross App Access
Connect to an app using an API key or token my IT team gave meApp Auth → API Key or Bearer Token
Connect to an app whose identity provider (such as Microsoft Entra ID) requires a certificate instead of a client secretApp Auth → OAuth 2.1 Client Assertion
The upstream app needs two different credentials in the same requestAdditional Outbound Headers

Agent Authentication​

"Who is allowed to connect to my MCP server?"

This controls how AI clients (like Cursor or Claude Desktop) or automated systems authenticate before they can use the tools on your MCP server.

To configure:

  1. Open the MCP server from the MCP Registry.
  2. Select the Configuration tab, then Agent Authentication under Access.
  3. Select Edit.

You'll see two options:

Interactive (SSO)​

Choose this when: Your team members will connect from an AI coding assistant like Cursor, Claude Desktop, Windsurf, or VS Code.

When a user connects, they'll see a familiar SSO login prompt in their browser. After they log in, the MCP server knows who they are, and every action runs under their own account and permissions.

This is the recommended option for most teams. It means:

  • Each person logs in as themselves
  • Actions in the connected app (sending an email, creating a ticket) happen under their identity
  • You get full visibility into who did what

Passthrough​

Choose this when: The connecting system already has its own credentials and you want the gateway to forward them as-is. Common for internal services, scripts, or testing.

With Passthrough, the gateway doesn't add or check any credentials — it simply forwards whatever the caller sends.

Optional: Add JWT validation for extra security

If you're using Passthrough but still want to verify that incoming requests carry a valid token, enable Require JWT Validation. When enabled, the gateway checks the token before forwarding the request:

  1. Toggle on Require JWT Validation in the Passthrough configuration.
  2. Your IT team can provide the JWKS URL (a URL where the gateway can look up signing keys) or a JWKS JSON blob. Enter one of these.
  3. Optionally enter the expected Issuer and Audience if your IT team specifies them.

If the token is missing or invalid, the request is rejected. If you leave JWT validation off, everything passes through without checks.

Restricting which headers get forwarded

Under "Restricted Inbound Headers," you can block specific header patterns from being forwarded to the upstream service. For example, adding x-internal-* ensures that any headers matching that pattern are stripped before the request reaches the upstream app. The gateway always blocks sensitive headers like authorization and cookie automatically.


App Authentication​

"What credentials does the gateway use when calling the upstream app?"

This controls how your MCP server authenticates to the service it wraps — for example, how it proves to Gmail that it's allowed to read your email.

To configure:

  1. Open the MCP server from the MCP Registry.
  2. Select the Configuration tab, then App Authentication under Access.
  3. Select Edit. To switch types, select Change Authentication Type.
  4. Make your changes and select Apply.
  5. Select Save changes to put them into effect.

Until you select Save changes, nothing changes for the server, and you can discard your edits.

Which type should I choose?​

If the app uses...ChooseWho provides the credentials
OAuth login (Google, Slack, GitLab, Atlassian)OAuth 2.1 AuthorizationUsually nothing: the gateway reads the app's details and can register itself. Otherwise your IT team's OAuth app
An identity provider, such as Okta, that already trusts the appCross App AccessYour IT team (a Requesting App registered in your identity provider)
A service account or machine-to-machine OAuthOAuth 2.1 Client CredentialsYour IT team (client ID, client secret, token URL)
A service account that signs in with a certificate (for example, Microsoft Entra ID)OAuth 2.1 Client AssertionYour IT team (client ID, token URL, private key, certificate)
An API keyAPI KeyYour IT team or the app's dashboard
A bearer token / access tokenBearer TokenYour IT team or the app's dashboard
A self-contained JWT (signed token with claims)JWT BearerYour IT team or the app's dashboard
Username and passwordBasic AuthenticationYour IT team
No auth, or the agent supplies its own credentialsPassthroughNothing to configure

OAuth 2.1 Authorization​

This is the most common setup for apps like Gmail, Google Drive, Slack, or GitLab. It uses an OAuth consent flow so that each user authorizes the gateway to act on their behalf. Each person connects their own account once; see Connect your apps.

The OAuth 2.1 Configuration form fills in as much as it can for you.

Discovery​

When the app publishes its OAuth details, the gateway reads them and fills in the form. Fields filled this way are marked Discovered, and everything stays editable. If you change a discovered value, you can reset it to what the app published.

If the app doesn't publish its OAuth details, the form says "This server doesn't publish OAuth metadata we could read." Enter the Authorization URL and Token URL from the app's documentation. Select Discover again to try again, for example after the app's URL changes.

Callback​

The callback is the address the app sends people back to after they approve access. Many apps ask you to register it as an allowed redirect URL.

OptionWhen to use it
Latest (recommended)Every new MCP server. This is the AI Gateway's current callback, and it supports every option on this form.
v1Only when an OAuth app your IT team already registered with the app lists the v1 callback as its redirect URL, and you can't add the latest one.

Each option shows its URL with a copy button. New MCP servers use Latest. A server that was set up before the latest callback existed keeps v1 until you change it.

v1 supports fewer options: Client ID metadata document isn't available, you can't choose how your own client authenticates, and some Advanced settings, such as the connecting user's email as a login hint and refresh parameters, are hidden.

Client registration​

The app needs to know who the gateway is before it lets people sign in. Choose how the gateway identifies itself:

OptionWhat it meansWhen it's offered
Client ID metadata document (recommended)The gateway identifies itself with a public document at a URL, shown on the form with View document. Nothing is registered with the app in advance and there's no secret to manage.When the app supports it. Not with the v1 callback.
Dynamic registrationThe AI Gateway registers itself with the app when you save.When the app supports self-registration.
Use my own clientUse an OAuth app your IT team has registered with the app.Always.

The form recommends what the app supports, so in most cases you can keep the selected option.

When you choose Use my own client, the form shows the redirect URI to add to your OAuth app. Sign-in fails until the OAuth app allows that exact redirect URI. Then fill in:

FieldWhat to enter
Client IDYour OAuth app's client ID. Required.
Client secretYour OAuth app's client secret. Leave it empty for a public client.
Client authenticationHow the gateway proves it's your OAuth app: Client secret (HTTP Basic), Client secret (POST body), None (public client with PKCE), Private key generated by Cequence, or Upload private key.

With Private key generated by Cequence, the key is created when you save, and the form then shows the details to give your IT team. With Upload private key, provide the private key and certificate in PEM format.

Scopes​

Scopes control what the gateway can do in the app on each person's behalf. The list suggests the scopes the app offers, and starts with the ones the app asks for. Type to add a scope that isn't suggested, select Add all to add every suggestion, or Clear to start again. Scopes the app requires can't be removed.

For apps from the App Catalog, Auto-add Scopes adds the scopes needed by the tools you selected.

Advanced​

Most apps work without changing anything in Advanced. It holds settings some apps need:

  • Prompt: whether the app asks people to sign in, choose an account or approve access again each time. Some apps, such as Snowflake, reject this setting; select Don't send a prompt for those.
  • Login hint: pre-fill the sign-in page, with the connecting person's email or a fixed value.
  • Resource: the resource identifier some apps require, and which requests carry it.
  • Parameters: extra values some apps need on the sign-in, token or refresh requests, such as access_type=offline for Google.
  • Issuer and Revocation URL: usually discovered from the app.

Cross App Access​

Use Cross App Access when your identity provider, such as Okta, already has a trust relationship with the app. Each person connects once by signing in with your identity provider, not with the app. From then on, the gateway gets a short-lived token for them through your identity provider, and the app's own credentials never pass through Cequence or the agent.

Before you start, set up a Cross App Connection for your identity provider:

  1. Open Settings → Auth Profiles and select New Cross App Connection.
  2. Enter a Name and your identity provider's Discovery issuer, then select Fetch to fill in the Authorize URL and Token URL.
  3. Choose how Account matching works (see below).
  4. Under Requesting App credentials, enter the Client ID and Client secret of the app your IT team registered for Cequence in your identity provider. Register the redirect URI shown on the form with that app.
  5. Check Default scopes, which starts with offline_access, then select Create.

Account matching decides how the gateway confirms that the identity provider's account belongs to the person signed in to the gateway:

OptionWhen to use it
Your organization's domains (recommended)Matches accounts whose email is at a domain your organization owns. Enter them under Trusted email domains. Public mail services, such as gmail.com, are refused.
Verified emailMatches when the identity provider marks the email as verified. Okta and Google do; Microsoft Entra ID usually doesn't.
Trust allMatches any email the identity provider sends. Use only for a directory where people can't change their own email.

To use it on an MCP server:

  1. In App Authentication, select Edit, then Change Authentication Type, and choose Cross App Access.
  2. Choose the Cross App Connection.
  3. Check the details the form discovered from the app, and the Scopes. The scopes the app asks for are selected; others it offers are suggested.
  4. Optionally add Access rules to limit who can use the server. With no rules, everyone who signs in can.
  5. Select Apply, then Save changes.

Each person then selects Connect on the server once, the same as for any other app that acts as them. See Connect your apps.

OAuth 2.1 Client Credentials​

Use this when the gateway should authenticate as a service account rather than an individual user. There's no user login involved — the gateway uses a fixed set of credentials.

Your IT team will provide:

  • Token URL — where to request tokens
  • Client ID and Client Secret — the service account credentials
  • Scopes — what the service account is allowed to do

OAuth 2.1 Client Assertion​

Use this when the gateway should authenticate as a service account, but the app's identity provider expects a certificate instead of a client secret. Microsoft Entra ID app registrations that use certificate credentials are the most common case.

Instead of sending a secret, the gateway proves who it is by signing each sign-in request with your private key. The identity provider checks the signature against the certificate uploaded to the app registration, then issues an access token. The gateway attaches that token to every request it sends to the app, and reuses it until shortly before it expires.

Client assertion credentials always apply to your whole organization. They can't be made personal to one user.

Before you start, have your IT team upload the certificate to the app registration. In Microsoft Entra ID, that's Certificates & secrets → Upload certificate, after which Entra shows the certificate's Thumbprint.

To configure:

  1. In App Authentication, select Edit.
  2. Select Change Authentication Type, then choose OAuth 2.1 Client Assertion.
  3. Fill in the fields below, then select Create Token.
  4. Select Apply, then Save changes.
FieldWhat to enter
Token NameA name that helps you recognize this credential later
Token URLThe identity provider's token endpoint. For Microsoft Entra ID: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token
Client IDThe app's client ID. In Microsoft Entra ID, this is the Application (client) ID
ScopesComma-separated. For Microsoft Entra ID, use the resource followed by /.default, for example https://graph.microsoft.com/.default
Private keyPaste the private key or select Choose file. It must be an unencrypted RSA key of 2048 bits or larger, in PEM format. The key is stored encrypted and is never shown again
Certificate thumbprintEnter the thumbprint exactly as Microsoft Entra ID shows it
Certificate expiry (optional)The date the certificate expires

If your private key file also contains the certificate, you don't need to enter the thumbprint. The gateway reads the thumbprint and expiry from the certificate.

Advanced options holds three more settings:

  • Certificate: paste the certificate instead of typing its thumbprint, and the gateway reads the thumbprint and expiry from it.
  • Signing algorithm: RS256 (default) or PS256. Leave this as RS256 unless your identity provider requires PS256.
  • Assertion lifetime (seconds): how long each signed sign-in request stays valid, between 60 and 600 seconds (default 300).

By default, the token is sent on the Authorization header. If the app expects it on a different header, enter that name in Header Name.

When you select Create Token, the gateway checks that the key is valid, that the certificate hasn't expired, and that the certificate belongs to the key. If something doesn't match, you'll see a message explaining what to fix.

Replacing the key or certificate

Plan to replace the certificate before it expires. To switch to a new key or certificate, open App Authentication again, select Change Token, create a new credential with the new private key, then select Apply and Save changes. The MCP server switches to the new credential shortly after you save.

If the gateway can't get an access token, for example because the identity provider rejects the certificate, tool calls to the app fail with an authentication error. The gateway never sends those calls to the app without credentials.

API Key​

Some apps (like Datadog, Proofpoint, or internal APIs) use a simple API key. Your IT team or the app's admin console will provide:

  • Key Name — the header or parameter name (for example, X-API-Key or api-key)
  • Key Value — the actual key
  • Location — whether the key goes in a header or a query parameter

Bearer Token​

Similar to an API key, but sent in the standard Authorization: Bearer <token> format. Paste the token your IT team provides.

JWT Bearer​

Use this when the upstream app requires a self-contained JWT (JSON Web Token) with embedded claims and a digital signature. This is common with identity-aware APIs that validate tokens independently rather than checking them against a central server.

Your IT team will provide the token or the credentials needed to generate one. The gateway stores and manages the token securely.

Basic Authentication​

Username and password. Enter the credentials your IT team provides.

Passthrough​

The gateway doesn't add any credentials. Use this when the agent calling the MCP server already includes the right credentials and you just want them forwarded.


When One Credential Isn't Enough​

Some apps require more than one credential in the same request. For example:

  • Azure AI Search needs a service-level API key plus the user's SSO token on a separate header.
  • An internal API might need both a service token and the caller's identity forwarded.

This is where Additional Outbound Headers come in. They let you attach extra headers to every request the gateway sends to the upstream app — on top of whatever you configured in App Authentication.

How to add an additional header​

  1. In App Authentication, select Edit.
  2. Scroll down to Additional Outbound Headers.
  3. Select + Add Header.
  4. Pick from the menu of common patterns, or choose Custom header to set one up manually.
  5. Fill in the details, select Apply, then Save changes.

Common patterns​

The + Add Header menu gives you ready-made options for the most common scenarios:

OAuth2 service token​

"The upstream app needs a service-level OAuth token."

The gateway will automatically fetch a fresh token using OAuth client credentials and attach it to the header you specify. Your IT team provides the token URL, client ID, and client secret.

Forward caller's token​

"The upstream app needs to know who the user is, through their SSO token."

The gateway takes the token the user used to authenticate and attaches it to a header you specify. Useful when the upstream app accepts user tokens on a custom header.

On behalf of caller​

"The upstream app needs a token that's scoped to the current user, but issued by a different identity provider."

The gateway takes the user's token, exchanges it with a downstream identity provider for a new token scoped to that specific service, and attaches the result. Your IT team provides the exchange endpoint details.

Stored API key / credential​

"I've already saved an API key or token in the AI Gateway's token vault, and I want to use it here."

Select a credential from your vault. You can choose whether it applies to the whole organization or is matched per-user.

Pass caller identity​

"The upstream app needs the caller's user ID or email in a header."

Sets a header to a value like the caller's user ID or email, drawn from their authentication token.

Custom header​

"None of the above fit. I need to set a specific header with a specific value."

Configure a header from scratch: pick the header name, source type, and value.


Real-World Examples​

Example 1: "My team wants to use Gmail from Cursor"​

SettingValue
Agent AuthenticationInteractive (SSO)
App AuthenticationOAuth 2.1 Authorization (pre-configured for Gmail)
Additional HeadersNone needed

Your team members open Cursor, connect to the Gmail MCP server, and see a Google login prompt. After signing in, they can ask their AI assistant to read emails, send messages, and manage labels — all under their own Gmail account.

Example 2: "A nightly script needs to pull data from Datadog"​

SettingValue
Agent AuthenticationPassthrough
App AuthenticationAPI Key (Datadog API key from your IT team)
Additional HeadersNone needed

The script sends requests without any special auth headers. The gateway adds the Datadog API key automatically on every outbound request.

Example 3: "Azure AI Search needs both a service key and the user's token"​

SettingValue
Agent AuthenticationInteractive (SSO)
App AuthenticationBearer Token (Azure service API key)
Additional HeadersForward caller's token → header x-ms-query-source-authorization with prefix Bearer

The gateway sends the service API key on the Authorization header and the user's SSO token on x-ms-query-source-authorization. Azure AI Search uses both to authorize the request.

Example 4: "We're building a chatbot that performs GitHub actions on behalf of each user"​

A common pattern for agentic platforms: you're building a chatbot or AI assistant where end users interact through a chat interface, and the AI performs actions in GitHub (creating issues, reviewing PRs, merging code) on their behalf. Each user should only be able to do what they can do in the actual GitHub web app — same repositories, same permissions.

SettingValue
Agent AuthenticationInteractive (SSO)
App AuthenticationOAuth 2.1 Authorization (configured for GitHub)
Additional HeadersNone needed

What the user experiences:

The user only ever logs into your chatbot platform — they don't need to know the AI Gateway exists. Behind the scenes, two things happen (both feel seamless to the user):

  1. Signing in to the platform (automatic). When the chatbot connects to the MCP server, the gateway's Interactive (SSO) auth kicks in. If your chatbot platform and the AI Gateway share the same identity provider (for example, Okta, Google Workspace, Entra ID), the user is already authenticated — no extra login prompt. They just start chatting.

  2. Connecting their GitHub account (one-time). The first time a user tries a GitHub action — say they ask "list my open pull requests" — the gateway notices they haven't linked their GitHub account yet. The chatbot surfaces a prompt like "To use GitHub, please connect your account" with an authorization link. The user clicks it, sees GitHub's familiar consent screen ("Authorize this app to access your repositories"), approves it, and they're back in the chat. This happens once. The gateway stores their GitHub token and uses it automatically from that point on.

After that initial setup, it just works:

  • User A asks "list my open pull requests" → the gateway calls GitHub using User A's token → returns only PRs from repos User A has access to.
  • User B asks the same question → completely different results, because the gateway uses User B's token.
  • If User A can't push to a repo in GitHub's web UI, they can't push through the chatbot either — same permissions, enforced automatically.

Why this is the right approach:

  • No shared service account. Each user's actions go through their own GitHub credentials, so there's no risk of one user seeing another's private repos.
  • Same permissions as the web app. The gateway uses the user's own OAuth token, so permissions match exactly.
  • Full audit trail. Commits, issue comments, and PR reviews show up as the actual user in GitHub — not as a generic "bot" account.
  • Scales to any number of users. The gateway manages tokens per-user automatically. You don't need to create individual API keys or service accounts for each person.
  • Works for any OAuth-based app. This same pattern applies to Slack, Google Workspace, Jira, GitLab, Salesforce — not just GitHub. Users connect each app once, and the gateway handles the rest.

What to ask your IT team​

When setting up authentication, you may need to gather a few details. Here's a quick checklist of what to ask for, depending on your setup:

If you're configuring...Ask your IT team for...
OAuth 2.1 Authorization with your own clientAn OAuth app registered with the app, with the gateway's redirect URI allowed; its Client ID, and Client Secret if it has one
Cross App AccessYour identity provider's issuer, and the Client ID and Client Secret of a Requesting App registered for Cequence, with the gateway's redirect URI allowed
OAuth 2.1 Client CredentialsToken URL, Client ID, Client Secret, Scopes
OAuth 2.1 Client AssertionToken URL, Client ID, Scopes, the private key (unencrypted PEM), and the certificate or its thumbprint and expiry date
API KeyKey name, key value, and where it goes (header or query)
Bearer TokenThe token value
JWT BearerThe JWT token or credentials to generate one
Basic AuthenticationUsername and password
JWT Validation (Passthrough)JWKS URL (or JWKS JSON), expected Issuer, expected Audience
Token Exchange (On behalf of caller)Exchange endpoint URL, Client ID, Client Secret, audience URL

Tips​

  • Start simple. Most MCP servers only need Interactive (SSO) for agent auth and OAuth 2.1 Authorization for app auth. You can always add more later.
  • Keep the recommended OAuth options. For a new MCP server, the Latest callback and the recommended client registration work for most apps; choose v1 or Use my own client only when your IT team already has an OAuth app set up.
  • Use the pre-built recipes. When adding outbound headers, the + Add Header menu has ready-made options for the most common patterns — you don't need to configure everything from scratch.
  • You can change authentication after creation. If you pick the wrong type initially, you can always go back to App Authentication and switch.
  • Track certificate expiry dates. If you use OAuth 2.1 Client Assertion, set a reminder to replace the certificate before it expires.
  • Credentials are stored securely. API keys, tokens, and OAuth secrets entered in the portal are encrypted and stored in the platform's secret manager.