Overview
Once Snowflake is connected, the Dema Agent can query data, run Cortex AI tools, and execute SQL through your Snowflake-managed MCP server. Useful for bringing governed warehouse data into an analysis alongside Dema metrics.Prerequisites
- A Snowflake account with an active Cortex MCP server deployed.
- A Snowflake role with permission to create security integrations (typically
ACCOUNTADMINor a role grantedCREATE INTEGRATION). - The database, schema, and name of your Cortex MCP server, plus your Snowflake account identifier in the form
{orgname}-{account}, so you can build the MCP server URL.
Connect Snowflake
Create an OAuth security integration in Snowflake
In a Snowflake worksheet, run the following. The
OAUTH_REDIRECT_URI is the fixed Dema callback URL, which you will use again when you connect:Fetch the client ID and client secret
Run:Copy the
OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET values from the result.Paste the credentials into Dema
In Dema, go to Agents → Settings → Integrations, find Snowflake, and click Connect. Enter:
- Client ID from the previous step
- Client secret from the previous step
- MCP URL in the form
https://{orgname}-{account}.snowflakecomputing.com/api/v2/databases/{db}/schemas/{schema}/mcp-servers/{name}, using the database, schema, and name of your Cortex MCP server
Permissions
Dema does not request named OAuth scopes in Snowflake. The Snowflake session runs with the role and warehouse you sign in with, so grant your authorizing user only the access the agent should have. A typical setup creates a dedicated role such asDEMA_AGENT_ROLE with USAGE on the warehouse and SELECT on the intended databases and schemas.
Troubleshooting
- Dema says the MCP URL is invalid. The MCP URL must be HTTPS and must be on
.snowflakecomputing.com. Use the{orgname}-{account}format (not a deprecated region-specific URL) and double-check the database, schema, and MCP server name. - Authorization fails. Make sure the security integration is
ENABLED = TRUEand thatOAUTH_REDIRECT_URIis exactlyhttps://app.dema.ai/agents/oauth/callback.

