Snowflake documents MCP connectors for Cortex Agents in its own guide. Check the feature’s release status there before depending on it, because syntax and limits can change.
What you are setting up
Prerequisites
- A Snowflake account where you can create API integrations and external MCP servers, and run Cortex agents.
- An identity provider where you can create an OIDC application, registered in TrueFoundry. See Identity Providers.
- An MCP server that validates JWTs from the same IdP, or one you can place behind the exchange in Part 2. To build one, see MCP server getting started.
- A gateway URL that Snowflake can reach over HTTPS with a valid public certificate and a hostname without underscores.
Why the connector needs an identity provider
Snowflake’s MCP connector authenticates with OAuth only: authorization code with a client secret, a public client (no secret), or dynamic client registration. It cannot send a static API key or header. The gateway validates tokens but does not issue them for this flow, so your IdP does the sign-in and issues the token, and the gateway accepts that token from the IdP you registered. That one design explains the rest of the page: the user signs in once at the IdP, Snowflake keeps the refresh token, and every tool call after that carries a token the gateway can verify.Choosing between passthrough and on-behalf-of
For the gateway-side details of each mode, see MCP Gateway authentication and security.
Part 1: Passthrough
The signed-in user’s token travels from the connector to your MCP server. The gateway checks it and decides whether the call may proceed, but it does not change the token.1
Create the connector application in your IdP
Create an OIDC application of type Web with the authorization code grant and refresh tokens enabled. Set the redirect URI to the callback Snowflake documents for MCP connectors:Note the application’s client ID and client secret, and the issuer’s authorization and token endpoints. Allow the scopes your MCP server needs, plus
offline_access so Snowflake can refresh the token.If your account uses PrivateLink, the callback URL is different. Snowflake derives it from
SYSTEM$ALLOWLIST_PRIVATELINK and appends /oauth/complete-secret.2
Register the IdP in TrueFoundry
Add the IdP so the gateway can validate its tokens. Set
audiences to the audience your IdP puts in tokens for the gateway, and map the token to an agent and a user:name_claim: cid identifies the connector application, and acting_on_behalf_of_slug_claim: sub identifies the Snowflake user it acts for. See Identity Providers for the issuer, key and audience fields.3
Register the Cortex agent in the Agent Registry
Create an entry keyed to the connector application’s client ID. The gateway reads
cid out of the token and matches it against this entry:proxy_via_gateway.enabled: false registers the agent for governance only: the gateway does not proxy calls to it. The registry entry creates no new credential. It is a governance record for the connector application your IdP already issues tokens to. See Agent Registry.4
Register the MCP server with token passthrough
snowflake-connector agent the MCP Server User role on my-mcp-server. An agent with no grant is refused, not passed through.5
Create the API integration in Snowflake
API_ALLOWED_PREFIXES must be a prefix of the server URL you use in the next step. CREATE OR REPLACE is not supported for external MCP integrations, so change an existing one with ALTER API INTEGRATION, or drop and create it again.6
Point an external MCP server at the gateway
https://<gateway>/<tenant>/mcp/<server-name>/server. Register one external MCP server per gateway MCP server you want the agent to use.7
Give the Cortex agent the server
Updating the specification replaces it, so include everything the agent already uses:The role that runs the agent needs
USAGE on the external MCP server and on the API integration.8
Connect and run
Each user signs in once. In Snowsight, open the connector and choose Connect. To do the same from SQL, which you need before calling the agent over its REST API, run this in a Snowsight worksheet:Open the link in the result and sign in at your IdP. Snowflake completes the exchange itself, stores the tokens, and shows OAuth Flow Completed. If the page instead shows a code and state without completing, run
SYSTEM$FINISH_OAUTH_FLOW('<query-string-from-the-redirect>') in the same session.Run the agent and ask for something that needs the tool. In the gateway’s Request Traces you should see the call attributed to snowflake-connector, acting for the Snowflake user.What your MCP server receives
Your server gets the user’s access token exactly as the IdP issued it. A decoded token from a test run looks like this (your IdP’s claim names and extras differ):What you can enforce
Part 2: On-behalf-of
The gateway receives the same user token as in Part 1 but does not forward it. It exchanges it at your IdP, using RFC 8693 token exchange, for a fresh token whose audience is your MCP server. The user’s broad token never leaves the gateway.1
Set up token exchange in your IdP
You need a second authorization server for your MCP server’s audience, a trusted-server link from the user authorization server to it, and a service application that is allowed the Token Exchange grant. For Okta, follow Okta setup for On-Behalf-Of. Note the service application’s client ID and secret.
The gateway uses the inbound token as the
subject_token, so the user token and the exchange target must come from the same IdP organization.2
Store the service application's secret
Save the client secret as a TrueFoundry secret and reference it by its fully qualified name, so it never appears in a manifest. See Manage secrets.
3
Register the MCP server with token exchange
snowflake-connector agent the MCP Server User role on my-mcp-server, exactly as in Part 1.What your MCP server receives
A token minted for your server, naming the user and the service application:401 if there is no caller token to exchange.
What you can enforce
Everything in Part 1, plus:Comparison, limits, and scale
- The connector supports the MCP tools capability only. Resources, prompts and sampling are not available to Cortex agents.
- Each Snowflake user completes their own sign-in for each integration.
- Snowflake’s MCP connector page does not list egress IP ranges. If your gateway sits behind an IP allowlist, confirm the current ranges with Snowflake before relying on it.
- Register one agent entry per connector application, not per Snowflake user. Users are identified by
sub.