How authentication works
There are two independent auth layers - keep them distinct:- Inbound - how a user or client authenticates to the TrueFoundry Gateway. See Authentication & Security.
- Outbound - how the Gateway authenticates to Snowflake. This guide covers the outbound layer, using Snowflake OAuth (authorization code flow).
Single account vs. multiple accounts. If all your users share one Snowflake account, one security integration plus one Gateway registration is enough - per-user OAuth + RBAC handles isolation, and setup is fully one-click for end users afterward. If each customer has its own Snowflake account, a single client ID/secret can’t span accounts (the MCP URL is account-specific and there’s no DCR), so each account’s
ACCOUNTADMIN runs the integration SQL once and you register a separate Snowflake MCP entry per account in TrueFoundry.Prerequisites
- A TrueFoundry account with permission to add MCP servers, and your TrueFoundry control-plane base URL (used to build the OAuth callback). You’ll also need an MCP Server Group.
- A Snowflake account on a paid/standard tier - the SQL-execution tool is blocked on trial accounts.
- Snowflake
ACCOUNTADMIN(or a role with the globalCREATE INTEGRATIONprivilege) to create the OAuth security integration. - A running or resumable warehouse.
- Your Snowflake account URL,
https://<account_url>- use hyphens, not underscores. See Connecting with a URL.
Snowflake setup
Run all SQL in a Snowsight SQL Worksheet (Projects → Worksheets), not the “Add data / Ingestion” screen.1
Create the MCP server object
The MCP server is a Snowflake object you declare with Supported tool types:
CREATE MCP SERVER; its spec lists exactly which tools are reachable. The database, schema, and server name you choose here become part of the connector URL, so pick a writable, non-system schema (not INFORMATION_SCHEMA, which is read-only) and avoid $ in the names.- SQL execution (minimal)
- With Cortex tools
The simplest setup - no Cortex prerequisites:
CORTEX_SEARCH_SERVICE_QUERY, CORTEX_ANALYST_MESSAGE (semantic views only, not semantic models), SYSTEM_EXECUTE_SQL, CORTEX_AGENT_RUN, and GENERIC (UDF/procedure).Limits worth knowing: max 50 tools per MCP server; tool responses are truncated at 250 KB; and MCP server objects are not replicated in failover groups (recreate them on the secondary account). Verify a server with
SHOW MCP SERVERS and DESCRIBE MCP SERVER.2
Create the OAuth security integration
Only Retrieve the client ID and secret with
ACCOUNTADMIN can run this. Use OAUTH_CLIENT = CUSTOM, and set the redirect URI to the callback shown on the TrueFoundry Add MCP Server form:SYSTEM$SHOW_OAUTH_CLIENT_SECRETS (the integration name must be uppercase):3
Create a non-admin role, grant access, set user defaults
The authenticating user must land on a non-privileged default role (admin roles are blocked for OAuth), with a default warehouse set, and needs
USAGE on the MCP server plus per-tool privileges - access to the server alone does not grant access to the tools.4
Allow Gateway egress (network policy / PrivateLink)
If the Snowflake account has network policies enabled, allowlist TrueFoundry’s egress IPs. The Gateway connects server-to-server from TrueFoundry infrastructure, not from the end user’s browser - so browser-based access working does not imply the Gateway can connect.
If the account uses PrivateLink, register the public account URL in the Gateway and keep the token endpoint on the public URL - the server-to-server token call can’t resolve a PrivateLink hostname.
Compute the MCP server URL
The Snowflake managed MCP URL has this format:Register in TrueFoundry
- In your MCP Server Group, click Add MCP Server and select Connect any Remote MCP Server.
- Enter the MCP server URL and select OAuth2 as the authentication type, with grant type Authorization Code.
- Fill in the OAuth2 fields:
- Authorization URL:
https://<account_url>/oauth/authorize - Token URL:
https://<account_url>/oauth/token-request - Client ID / Client Secret: the values from
SYSTEM$SHOW_OAUTH_CLIENT_SECRETS - Code Challenge Methods Supported:
S256 - JWT Source: Access Token
- Scopes:
refresh_token
- Authorization URL:
- Set access control (teams/users), then Save.
- Open the server’s Tools section (or Add Tool/MCP Servers in the Playground) and click Connect Now. After OAuth succeeds, the Snowflake tools appear and can be tried from the Agent Playground.
Scopes. Snowflake OAuth has only two scope values, both optional:
refresh_token and session:role:<role>. Keep refresh_token - without it, sessions expire roughly every 10 minutes and users are re-prompted. Drop session:role:<role>: the managed MCP server ignores it (it uses DEFAULT_ROLE) and it adds a case-sensitivity failure mode. Snowflake expects the scope value space-delimited.Security notes
- Use
read_only: truefor SQL tools unless agents must write data. - Grant access to underlying Cortex resources separately;
USAGEon the MCP server alone is not enough. - Each user operates under their own Snowflake RBAC permissions, resolved through their
DEFAULT_ROLE. - Rotate the OAuth client secret periodically and prefer storing it in the TrueFoundry secrets store.