Skip to main content
This guide shows you how to configure the Snowflake connector for WRITER Agent. After setting up this connector, WRITER Agent can translate natural-language queries into Snowflake calls across Cortex tools (Analyst, Search, Agent), SQL operations, object management, and Semantic Manager functions for querying semantic views, dimensions, and metrics.

Set up the Snowflake connector

Configure the Snowflake connector in AI Studio under Connectors & Tools. The Snowflake connector requires organization-managed OAuth authentication.
The Snowflake connector only supports organization-managed OAuth. You must create an MCP Server and configure OAuth in your Snowflake account. WRITER-managed OAuth is not available for Snowflake.

Create a Snowflake MCP Server

Set up an MCP Server and OAuth in Snowflake:
  1. In the Snowflake web interface, open a SQL worksheet and set the database and schema context where the MCP Server should live
  2. Create the MCP Server:
    CREATE MCP SERVER <server_name>
     FROM SPECIFICATION $$
       tools:
         - name: "sql_exec_tool"
           type: "SYSTEM_EXECUTE_SQL"
           title: "SQL Execution Tool"
           description: "Execute SQL queries against the connected Snowflake database"
         - name: "analyst_tool"
           type: "CORTEX_ANALYST_MESSAGE"
           title: "Cortex Analyst Tool"
           identifier: "<database>.<schema>.<semantic_view>"
           description: "Query data using natural language through Cortex Analyst"
         - name: "search_tool"
           type: "CORTEX_SEARCH_SERVICE_QUERY"
           title: "Cortex Search Tool"
           identifier: "<database>.<schema>.<search_service>"
           description: "Search unstructured data using Cortex Search"
     $$;
    
    Snowflake currently supports the following MCP tool types:
    • SYSTEM_EXECUTE_SQL: Execute SQL queries against Snowflake
    • CORTEX_ANALYST_MESSAGE: Query data using natural language through semantic views
    • CORTEX_SEARCH_SERVICE_QUERY: Search unstructured data using Cortex Search
    • CORTEX_AGENT_RUN: Invoke a Cortex Agent
    • GENERIC: Call custom user-defined functions or stored procedures
  3. Grant the required Snowflake privileges based on the MCP tools you exposed in step 2:
     -- Allow the role to access the MCP Server
     GRANT USAGE ON MCP SERVER <server_name> TO ROLE <role_name>;
    
     -- Required for SYSTEM_EXECUTE_SQL
     GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE <role_name>;
     GRANT USAGE ON DATABASE <database> TO ROLE <role_name>;
     GRANT USAGE ON SCHEMA <database>.<schema> TO ROLE <role_name>;
     GRANT SELECT ON ALL TABLES IN SCHEMA <database>.<schema> TO ROLE <role_name>;
    
     -- Required only if you expose Cortex tools
     -- Cortex Analyst (semantic views)
     GRANT SELECT ON SEMANTIC VIEW <database>.<schema>.<semantic_view> TO ROLE <role_name>;
    
     -- Cortex Search
     GRANT USAGE ON CORTEX SEARCH SERVICE <database>.<schema>.<search_service> TO ROLE <role_name>;
    
  4. Create the security integration with the Writer redirect URI and refresh token support:
     CREATE OR REPLACE SECURITY INTEGRATION <integration_name>
     TYPE = OAUTH
     OAUTH_CLIENT = CUSTOM
     ENABLED = TRUE
     OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
     OAUTH_REDIRECT_URI = 'https://app.writer.com/mcp/oauth/callback'
     OAUTH_ISSUE_REFRESH_TOKENS = TRUE;
    
  5. Retrieve and copy your client ID and client secret for use in AI Studio:
    SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('<INTEGRATION_NAME>');
    
  6. Note your Snowflake MCP Server URL, which combines your tenant URL and MCP Server path for use in AI Studio:
    https://<account_identifier>.snowflakecomputing.com/api/v2/databases/<database>/schemas/<schema>/mcp-servers/<mcp_server_name>
    
For detailed instructions, see Snowflake’s managed MCP server guide.

Configure the connector in AI Studio

After creating your Snowflake MCP Server and OAuth integration:
  1. Navigate to Connectors & Tools in AI Studio
  2. Select the Snowflake connector
  3. Select who has access by default (all users or specific teams)
  4. Enter your Snowflake tenant URL (MCP Server URL), OAuth client ID, and client secret
  5. Complete the OAuth authorization flow

Next steps