docs/dev-guides/agent-context/snowflake.md
Give Snowflake Cortex Agents access to your enterprise data context in DataHub — business definitions, ownership, lineage, and quality signals — so they can generate better SQL and answer data questions accurately.
Snowflake connects to the DataHub MCP Server as an External MCP Server, using OAuth2 with Dynamic Client Registration (DCR). Each user signs in with their own DataHub credentials (including SSO), and tokens are scoped per-user and refreshed automatically.
ACCOUNTADMIN role (for initial setup of the API integration and MCP server object)Run as ACCOUNTADMIN:
CREATE API INTEGRATION datahub_mcp_api_integration
API_PROVIDER = external_mcp
API_ALLOWED_PREFIXES = ('https://mcp.datahub.com')
API_USER_AUTHENTICATION = (
TYPE = OAUTH_DYNAMIC_CLIENT,
OAUTH_RESOURCE_URL = 'https://mcp.datahub.com/mcp'
)
ENABLED = TRUE;
If you prefer to point directly at your tenant URL, replace both https://mcp.datahub.com values with https://<tenant>.acryl.io and https://<tenant>.acryl.io/integrations/ai/mcp respectively.
CREATE EXTERNAL MCP SERVER datahub_mcp_server
WITH DISPLAY_NAME = 'DataHub'
URL = 'https://mcp.datahub.com/mcp'
API_INTEGRATION = datahub_mcp_api_integration;
Open Snowflake Intelligence and select your agent. Click Connect next to the DataHub connector — Snowflake walks each user through the DataHub OAuth flow once, then reuses the credential on subsequent calls.
<p align="center"> </p>CREATE API INTEGRATION and CREATE EXTERNAL MCP SERVER both require ACCOUNTADMIN.OAUTH_RESOURCE_URL exactly matches the MCP endpoint (https://mcp.datahub.com/mcp or https://<tenant>.acryl.io/integrations/ai/mcp).Links: Cortex Agents Docs · Agent Context Kit · MCP Server Guide
This integration works through UDFs created by the DataHub CLI. Once set up, your Cortex Agent calls DataHub tools alongside your Snowflake tables.
pip install datahub-agent-context[snowflake]ACCOUNTADMIN role (for initial setup)You can either let the CLI execute the SQL directly, or generate the SQL files and run them yourself.
Option A: Execute directly
datahub agent create snowflake \
--sf-account YOUR_ACCOUNT \
--sf-user YOUR_USER \
--sf-password YOUR_PASSWORD \
--sf-role YOUR_ROLE \
--sf-warehouse YOUR_WAREHOUSE \
--sf-database YOUR_DATABASE \
--sf-schema YOUR_SCHEMA \
--datahub-url https://your-datahub.acryl.io \
--datahub-token YOUR_TOKEN \
--enable-mutations \
--execute
Use --sf-authenticator externalbrowser for SSO instead of --sf-password.
Option B: Generate SQL
Drop --execute and --sf-password to generate SQL files instead. Then run them in order in a Snowflake worksheet:
@00_configuration.sql;
@01_network_rules.sql;
@02_datahub_udfs.sql;
@03_stored_procedure.sql;
@04_cortex_agent.sql;
Customize the agent's prompt, model, and tools in the Snowflake UI, then open Snowflake Intelligence and select the DataHub Agent.
When new tools are released, re-run the UDF and agent SQL:
@02_datahub_udfs.sql;
@04_cortex_agent.sql;
ACCOUNTADMIN. After that, SNOWFLAKE_INTELLIGENCE_ADMIN is sufficient.SHOW USER FUNCTIONS LIKE 'datahub%'; to verify.eyJ).