Snowflake
Connect the Speakeasy AI Control Plane to a Snowflake-managed MCP server that exposes an existing Cortex Agent.
Use a Snowflake role/security administrator account to create and assign a non-privileged runtime role. You also need ACCOUNTADMIN, or an organization-approved delegated role with global CREATE INTEGRATION, for the OAuth integration only. Obtain the connecting usernames, default warehouse, approved MCP server object names, and an existing Cortex Agent’s database, schema, name, and complete agent-tool grants from the security, application, and agent owners. You need an existing, approved MCP database and schema, or a Snowflake object or security owner who can create them. Obtain a server-creator role with CREATE MCP SERVER on the target schema, USAGE on the target database and schema, and USAGE on the existing Cortex Agent and its database and schema. Sign in at app.snowflake.com.
Snowflake-managed MCP servers and Cortex Agents are unavailable in the People’s Republic of China. Snowflake-managed MCP servers are also unsupported in government regions.
Open a Snowflake SQL workspace
- Select Projects > Workspaces.
- Select + beside a folder, or select + Add New on first use.
- Select SQL File.
- In the workspace context controls, select the organization-approved role for the statement group you are running.
- Select an available warehouse.
- Before pasting any SQL from this guide, replace every complete angle-bracket placeholder, including the
<and>characters, with the corresponding value supplied by the named owner. - Paste each completed statement into the blank SQL file.
- Select the complete statement.
- Invoke Run selected with
Ctrl+Enteron Windows/Linux orCommand+Returnon macOS.
When a code block contains multiple statements, select and run each completed statement separately.
Create and assign the MCP access role
-
Obtain the approved non-privileged role name, connecting usernames, default warehouse, existing Cortex Agent database, schema, and name, and complete agent-tool grants from the security and agent owners.
-
With
USERADMINor a delegated role holding account-levelCREATE ROLE, run:CREATE ROLE IF NOT EXISTS <mcp_access_role>; -
With
ACCOUNTADMINor the role authorized to grant Snowflake database roles, run:GRANT DATABASE ROLE SNOWFLAKE.CORTEX_AGENT_USERTO ROLE <mcp_access_role>; -
With the role that owns
<mcp_access_role>or holdsMANAGE GRANTS, run this statement for each connecting user:GRANT ROLE <mcp_access_role> TO USER <username>; -
With the security or agent owner role, run:
GRANT USAGE ON WAREHOUSE <warehouse_name>TO ROLE <mcp_access_role>;GRANT USAGE ON DATABASE <agent_database>TO ROLE <mcp_access_role>;GRANT USAGE ON SCHEMA <agent_database>.<agent_schema>TO ROLE <mcp_access_role>;GRANT USAGE ON AGENT <agent_database>.<agent_schema>.<agent_name>TO ROLE <mcp_access_role>; -
Have the agent owner grant
<mcp_access_role>every additional privilege required by the objects configured in the existing Cortex Agent. -
With the role authorized to alter each user, run:
ALTER USER <username>SET DEFAULT_ROLE = '<mcp_access_role>'DEFAULT_WAREHOUSE = '<warehouse_name>';
Create the Cortex Agent MCP server
-
Obtain the approved MCP server database, schema, and name, and the MCP tool name, title, and description from the application owner.
-
Confirm that the approved MCP database and schema already exist.
-
If either object is absent, have the Snowflake object or security owner create it through your organization’s approved process.
-
Retain the resulting MCP database and schema names.
-
Obtain the approved
<mcp_server_creator_role>name from the security owner. -
Confirm that
<mcp_server_creator_role>is assigned to the Snowflake user who will create the MCP server. -
Have the security owner grant the server-creator role access to the MCP namespace and existing Cortex Agent:
GRANT USAGE ON DATABASE <mcp_database>TO ROLE <mcp_server_creator_role>;GRANT USAGE ON SCHEMA <mcp_database>.<mcp_schema>TO ROLE <mcp_server_creator_role>;GRANT CREATE MCP SERVER ON SCHEMA <mcp_database>.<mcp_schema>TO ROLE <mcp_server_creator_role>;GRANT USAGE ON DATABASE <agent_database>TO ROLE <mcp_server_creator_role>;GRANT USAGE ON SCHEMA <agent_database>.<agent_schema>TO ROLE <mcp_server_creator_role>;GRANT USAGE ON AGENT <agent_database>.<agent_schema>.<agent_name>TO ROLE <mcp_server_creator_role>; -
Form and record the fully qualified Cortex Agent identifier as
<cortex_agent_fqn> = <agent_database>.<agent_schema>.<agent_name>. -
Switch to
<mcp_server_creator_role>. -
Run:
CREATE MCP SERVER <mcp_database>.<mcp_schema>.<mcp_server_name> FROM SPECIFICATION $$ tools: - title: "<approved_title>" name: "<mcp_tool_name>" type: "CORTEX_AGENT_RUN" identifier: "<cortex_agent_fqn>" description: "<approved_description>" $$;- Retain the exact MCP database, schema, and server name.
- Ask the account or network security owner whether the Snowflake account uses PrivateLink.
- Select your user name.
- Select Connect a tool to Snowflake.
- In the Account Details dialog, copy Account/Server URL.
- If the account uses PrivateLink, have the account or network security owner confirm that the copied Account/Server hostname is the public hostname, not the PrivateLink hostname.
- For
<account_url>, use the confirmed public Account/Server hostname from the copied value without the leadinghttps://or a trailing/.USE_PRIVATELINK_FOR_AUTHORIZATION_ENDPOINT = TRUEaffects browser authorization, not the public MCP Server URL. - Form the account-specific MCP Server URL:
https://<account_url>/api/v2/databases/<mcp_database>/schemas/<mcp_schema>/mcp-servers/<mcp_server_name>- Retain the URL for the Speakeasy AI Control Plane setup.
Grant access to the MCP server
With the security owner role, run:
GRANT USAGE ON DATABASE <mcp_database> TO ROLE <mcp_access_role>;
GRANT USAGE ON SCHEMA <mcp_database>.<mcp_schema> TO ROLE <mcp_access_role>;
GRANT USAGE ON MCP SERVER <mcp_database>.<mcp_schema>.<mcp_server_name> TO ROLE <mcp_access_role>;If authorization succeeds but initialization fails, confirm the user’s DEFAULT_ROLE, DEFAULT_WAREHOUSE, role assignment, and warehouse USAGE. If the MCP server is visible but the Agent tool cannot run, confirm SNOWFLAKE.CORTEX_AGENT_USER, Cortex Agent USAGE, parent namespace USAGE, and every privilege required by the agent’s configured tools.
Create the OAuth integration
Before you continue: Confirm that each connecting user’s
DEFAULT_ROLEis the non-privileged<mcp_access_role>. Snowflake blocksACCOUNTADMIN,SECURITYADMIN,GLOBALORGADMIN, andORGADMINfrom custom Snowflake OAuth by default, even when listed inALLOWED_ROLES_LIST.
-
Obtain the approved integration name.
-
Ask the account or network security owner whether the Snowflake account uses PrivateLink.
-
Switch to
ACCOUNTADMIN, or an organization-approved delegated role with globalCREATE INTEGRATION. -
For a PrivateLink account, add
USE_PRIVATELINK_FOR_AUTHORIZATION_ENDPOINT = TRUEon a new line immediately beforeALLOWED_ROLES_LIST. -
Run:
CREATE SECURITY INTEGRATION <integration_name>TYPE = OAUTHOAUTH_CLIENT = CUSTOMENABLED = TRUEOAUTH_CLIENT_TYPE = 'CONFIDENTIAL'OAUTH_REDIRECT_URI = 'https://ai.speakeasy.com/mcp/remote_login_callback'OAUTH_USE_SECONDARY_ROLES = NONEALLOWED_ROLES_LIST = ('<mcp_access_role>'); -
Keep this exact integration-owner role selected for Copy the OAuth credentials.
An unquoted integration name is stored in uppercase. Retain that case-sensitive uppercase name for the next step.
Copy the OAuth credentials
Do not capture the result because it exposes secrets.
-
Still using the role that created and owns the integration, run:
WITH oauth_secrets AS (SELECT PARSE_JSON(SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('<INTEGRATION_NAME>')) AS secret_values)SELECTsecret_values:"OAUTH_CLIENT_ID"::STRING AS "OAUTH_CLIENT_ID",secret_values:"OAUTH_CLIENT_SECRET"::STRING AS "OAUTH_CLIENT_SECRET"FROM oauth_secrets; -
Use the uppercase, case-sensitive integration name in single quotes.
-
Copy the result cell under
OAUTH_CLIENT_IDas Client ID. -
Copy the result cell under
OAUTH_CLIENT_SECRETas Client Secret. -
Store both values in the approved password manager.
-
Switch away from the integration-owner role.
If either cell shows NULL, rerun the query with the uppercase keys exactly as shown. Snowflake matches these key names case-sensitively.
Snowflake returns the credentials as one JSON string with uppercase keys. If you run SYSTEM$SHOW_OAUTH_CLIENT_SECRETS on its own, the single result cell looks like this, with values redacted:
{"OAUTH_CLIENT_SECRET_2":"REDACTED_SECONDARY_SECRET","OAUTH_CLIENT_SECRET":"REDACTED_CLIENT_SECRET","OAUTH_CLIENT_ID":"REDACTED_CLIENT_ID"}| Snowflake key | Speakeasy field |
|---|---|
OAUTH_CLIENT_ID | Client ID |
OAUTH_CLIENT_SECRET | Client Secret |
OAUTH_CLIENT_SECRET_2 | Not used. Do not use this secondary secret for initial setup. |
Add the server in Speakeasy
- In the Speakeasy AI Control Plane sidebar, under MCP Gateway, select MCP.
- Click Add new to open Add MCP server.
- Choose Hosted remotely.
- On New remote MCP server, paste the account-specific URL retained in Create the Cortex Agent MCP server into MCP server URL.
- Leave User session issuer at its default.
- Click Verify connectivity.
- Under Identity, select User Identity if it is not already selected.
- Click Save.
Snowflake does not support automatic client registration, so Speakeasy keeps the server Disabled and says to finish setup in Settings > Identity. This is expected.
Connect your credentials
Open the server’s Settings and find the Identity section.
- Confirm that User Identity is selected.
- Under Choose an identity provider, confirm the preselected provider is on your Snowflake account hostname (
<account_url>). A provider badged Will be created is expected. If no Snowflake provider is offered, follow the custom provider steps below instead. - Under the provider, choose Manual.
- Paste the Client ID into Client ID.
- Paste the Client Secret into Client secret. The secret is required even though the field says “Optional”.
- Open Advanced and enter
session:role:allin Scope. Do not leave it blank. - Click Save. If asked to confirm, click Save changes.
If no Snowflake provider is offered, create one:
-
Open the picker and click Create a custom identity provider. This opens Remote Identity Providers.
-
Click New Remote Identity Provider.
-
Enter
https://<account_url>in Issuer URL, using the public account hostname from Create the Cortex Agent MCP server. -
Under Endpoints, enter this value in Authorization Endpoint:
https://<account_url>/oauth/authorize -
Enter this value in Token Endpoint:
https://<account_url>/oauth/token-request -
Keep the derived Slug and click Create.
-
On the new provider, click Add Client.
-
Set Client Type to Manual.
-
Paste the Client ID into Client ID and the Client Secret into Client Secret (optional).
-
Enter
session:role:allin Scope (override). -
Confirm the displayed Redirect URI matches the
OAUTH_REDIRECT_URIyou set in Create the OAuth integration. -
Click Create.
-
Return to the server’s Settings > Identity and select that provider.
-
Choose Existing client, pick the new client under Client, and click Save.
Turn the server on:
- In Settings > Danger Zone > Server Availability, turn on Enable MCP server.
- Confirm it shows Enabled.
When a person first uses the server, Snowflake’s OAuth flow opens in a browser. Each user signs in with their own Snowflake credentials and consents to the non-privileged default role. The resulting session uses that user’s DEFAULT_ROLE.
This guide covers setup only. For anything beyond it — billing, tool behavior, limits — see Snowflake’s MCP documentation.