Back to MCP Servers

Snowflake Labs Mcp

Open-source MCP server for Snowflake from official Snowflake-Labs supports prompting Cortex Agents, querying structured & unstructured data, object management, SQL execution, semantic view querying, and more. RBAC, fine-grained CRUD controls, and all authentication methods suppo…

databasesaiagent
By Snowflake-Labs
28591Updated 1 month agoPythonApache-2.0

Installation

npx -y mcp

Configuration

{
  "mcpServers": {
    "mcp": {
      "command": "npx",
      "args": ["-y", "mcp"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

Snowflake Cortex AI Model Context Protocol (MCP) Server

<a href="https://emerging-solutions-toolbox.streamlit.app/"> <img src="https://github.com/user-attachments/assets/aa206d11-1d86-4f32-8a6d-49fe9715b098" alt="image" width="150" align="right";"> </a>

This Snowflake MCP server provides tooling for Snowflake Cortex AI, object management, and SQL orchestration, bringing these capabilities to the MCP ecosystem. When connected to an MCP Client (e.g. Claude for Desktop, fast-agent, Agentic Orchestration Framework), users can leverage these features.

The MCP server currently supports the below capabilities:

  • Cortex Search: Query unstructured data in Snowflake as commonly used in Retrieval Augmented Generation (RAG) applications.
  • Cortex Analyst: Query structured data in Snowflake via rich semantic modeling.
  • Cortex Agent: Agentic orchestrator across structured and unstructured data retrieval
  • Object Management: Perform basic operations against Snowflake's most common objects such as creation, dropping, updating, and more.
  • SQL Execution: Run LLM-generated SQL managed by user-configured permissions.
  • Semantic View Querying: Discover and query Snowflake Semantic Views

Getting Started

Service Configuration

A simple configuration file is used to drive all tooling. An example can be seen at services/configuration.yaml and a template is below. The path to this configuration file will be passed to the server and the contents used to create MCP server tools at startup.

Cortex Services

Many Cortex Agent, Search, and Analyst services can be added. Ideal descriptions are both highly descriptive and mutually exclusive. Only the explicitly listed Cortex services will be available as tools in the MCP client.

Other Services

Other services include tooling for object management, query execution, and semantic view usage. These groups of tools can be enabled by setting them to True in the other_services section of the configuration file.

SQL Statement Permissions

The sql_statement_permissions section ensures that only approved statements are executed across any tools with access to change Snowflake objects. The list contains SQL expression types. Those marked with True are permitted while those marked with False are not permitted. Please see SQL Execution for examples of each expression type.

agent_services: # List all Cortex Agent services
  - service_name: <service_name>
    description: > # Describe contents of the agent service
      <Agent service that ...>
    database_name: <database_name>
    schema_name: <schema_name>
  - service_name: <service_name>
    description: > # Describe contents of the agent service
      <Agent service that ...>
    database_name: <database_name>
    schema_name: <schema_name>
search_services: # List all Cortex Search services
  - service_name: <service_name>
    description: > # Describe contents of the search service
      <Search services that ...>
    database_name: <database_name>
    schema_name: <schema_name>
  - service_name: <service_name>
    description: > # Describe contents of the search service
      <Search services that ...>
    database_name: <database_name>
    schema_name: <schema_name>
analyst_services: # List all Cortex Analyst semantic models/views
  - service_name: <service_name> # Create descriptive name for the service
    semantic_model: <semantic_yaml_or_view> # Fully-qualify semantic YAML model or Semantic View
    description: > # Describe contents of the analyst service
      <Analyst service that ...>
  - service_name: <service_name> # Create descriptive name for the service
    semantic_model: <semantic_yaml_or_view> # Fully-qualify semantic YAML model or Semantic View
    description: > # Describe contents of the analyst service
      <Analyst service that ...>
other_services: # Set desired tool groups to True to enable tools for that group
  object_manager: True # Perform basic operations against Snowflake's most common objects such as creation, dropping, updating, and more.
  query_manager: True # Run LLM-generated SQL managed by user-configured permissions.
  semantic_manager: True # Discover and query Snowflake Semantic Views and their components.
sql_statement_permissions: # List SQL statements to explicitly allow (True) or disallow (False).
  # - All: True # To allow everything, uncomment and set All: True.
  - Alter: True
  - Command: True
  - Comment: True
  - Commit: True
  - Copy: True
  - Create: True
  - Delete: True
  - Describe: True
  - Drop: True
  - Insert: True
  - Merge: True
  - Rollback: True
  - Select: True
  - Transaction: True
  - TruncateTable: True
  - Unknown: False # To allow unknown or unmapped statement types, set Unknown: True.
  - Update: True
  - Use: True

[!NOTE] Previous versions of the configuration file supported specifying explicit values for columns and limit for each Cortex Search service. Instead, these are now exclusively dynamic based on user prompt. If not specified, a search service's default search_columns will be returned with a limit of 10.

Connecting to Snowflake

The MCP server uses the Snowflake Python Connector for all authentication and connection methods. Please refer to the official Snowflake documentation for comprehensive authentication options and best practices.

The MCP server honors the RBAC permissions assigned to the specified role (as passed in the connection parameters) or default role of the user (if no role is passed to connect).

Connection parameters can be passed as CLI arguments and/or environment variables. The server supports all authentication methods available in the Snowflake Python Connector, including:

  • Username/password authentication
  • Key pair authentication
  • OAuth authentication
  • Single Sign-On (SSO)
  • Multi-factor authentication (MFA)

Connection Parameters

Connection parameters can be passed as CLI arguments and/or environment variables:

ParameterCLI ArgumentsEnvironment VariableDescription
Account--accountSNOWFLAKE_ACCOUNTAccount identifier (e.g. xy12345.us-east-1)
Host--hostSNOWFLAKE_HOSTSnowflake host URL
User--user, --usernameSNOWFLAKE_USERUsername for authentication
Password--passwordSNOWFLAKE_PASSWORDPassword or programmatic access token
Role--roleSNOWFLAKE_ROLERole to use for connection
Warehouse--warehouseSNOWFLAKE_WAREHOUSEWarehouse to use for queries
Passcode in Password--passcode-in-password-Whether passcode is embedded in password
Passcode--passcodeSNOWFLAKE_PASSCODEMFA passcode for authentication
Private Key--private-keySNOWFLAKE_PRIVATE_KEYPrivate key for key pair authentication
Private Key File--private-key-fileSNOWFLAKE_PRIVATE_KEY_FILEPath to private key file
Private Key Password--private-key-file-pwdSNOWFLAKE_PRIVATE_KEY_FILE_PWDPassword for encrypted private key
Authenticator--authenticator-Authentication type (default: snowflake)
Connection Name--connection-name-Name of connection from connections.toml (or config.toml) file

[!WARNING] Deprecation Notice: The CLI arguments --account-identifier and --pat, as well as the environment variable SNOWFLAKE_PAT, are deprecated and will be removed in a future release. Please use --account and --password (or SNOWFLAKE_ACCOUNT and SNOWFLAKE_PASSWORD) instead.

Transport Configuration

The MCP server supports multiple transport mechanisms. For detailed information about MCP transports, see FastMCP Transport Protocols.

TransportDescriptionUse Case
stdioStandard input/output (default)Local development, MCP client integration
sse (legacy)Server-Sent EventsStreaming applications
streamable-httpStreamable HTTP transportContainer deployments, remote servers

Usage

# Default stdio transport
uvx snowflake-labs-mcp --service-config-file config.yaml

# HTTP transport with custom endpoint
uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http --endpoint /my-endpoint

# For containers (uses streamable-http on port 9000)
uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http --endpoint /snowflake-mcp

Transport Customizations

Server customizations available for sse and streamable-http transports:

ParameterCLI ArgumentEnvironment VariableDefault
Host--server-hostSNOWFLAKE_MCP_HOST"0.0.0.0"
Port--portSNOWFLAKE_MCP_PORT9000
Endpoint--endpointSNOWFLAKE_MCP_ENDPOINT/mcp
Debug Logging--verboseSNOWFLAKE_MCP_VERBOSEfalse

Example:

export SNOWFLAKE_MCP_ENDPOINT="/my-mcp"
uvx snowflake-labs-mcp --service-config-file config.yaml --transport streamable-http

Using with MCP Clients

The MCP server is client-agnostic and will work with most MCP Clients that support basic functionality for MCP tools and (optionally) resources. Below are examples for local installation. For connecting to containerized deployments, see Connecting MCP Clients to Containers.

Claude Desktop

To integrate this server with Claude Desktop as the MCP Client, add the following to your app's server configuration. By default, this is located at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Set the path to the service configuration file and configure your connection method:

{
  "mcpServers": {
    "mcp-server-snowflake": {
      "command": "uvx",
      "args": [
        "snowflake-labs-mcp",
        "--service-config-file",
        "<path_to_file>/tools_config.yaml",
        "--connection-name",
        "default"
      ]
    }
  }
}

Cursor

Register the MCP server in Cursor by opening Cursor and navigating to Settings -> Cursor Settings -> MCP. Add the below:

{
  "mcpServers": {
    "mcp-server-snowflake": {
      "command": "uvx",
      "args": [
        "snowflake-labs-mcp",
        "--service-config-file",
        "<path_to_file>/tools_config.yaml",
        "--connection-name",
        "default"
      ]
    }
  }
}

Add the MCP server as context in the chat.

<img src="https://sfquickstarts.s3.us-west-1.amazonaws.com/misc/mcp/Cursor.gif" width="800"/>

For troubleshooting Cursor server issues, view the logs by opening the Output panel and selecting Cursor MCP from the dropdown menu.

fast-agent

Update the fastagent.config.yaml mcp server section with the configuration file path and connection name:

# MCP Servers
mcp:
    servers:
        mcp-server-snowflake:
            command: "uvx"
            args: ["snowflake-labs-mcp", "--service-config-file", "<path_to_file>/tools_config.yaml", "--connection-name", "default"]

<img src="https://sfqu

View source on GitHub