Snowflake MCP server

Run SQL queries and other interactions against Snowflake databases
Back to servers
Setup instructions
Provider
Isaac Wasserman
Release date
Dec 13, 2024
Language
Python
Package
Stats
164 stars

The Snowflake MCP Server allows you to connect Claude to your Snowflake database, enabling SQL query execution and data insights extraction through the Model Context Protocol. This server exposes database schema information and provides tools for reading and writing data to Snowflake.

Installation Options

Installing via Smithery

The easiest way to install Snowflake MCP Server for Claude Desktop is through Smithery:

npx -y @smithery/cli install mcp_snowflake_server --client claude

Installing via UVX

Using Individual Parameters

Add the following configuration to your Claude Desktop config file:

"mcpServers": {
  "snowflake_pip": {
    "command": "uvx",
    "args": [
      "--python=3.12",
      "mcp_snowflake_server",
      "--account", "your_account",
      "--warehouse", "your_warehouse",
      "--user", "your_user",
      "--password", "your_password",
      "--role", "your_role",
      "--database", "your_database",
      "--schema", "your_schema"
    ]
  }
}

Using TOML Configuration (Recommended)

This approach allows you to manage multiple connection profiles:

"mcpServers": {
  "snowflake_production": {
    "command": "uvx",
    "args": [
      "--python=3.12",
      "mcp_snowflake_server",
      "--connections-file", "/path/to/snowflake_connections.toml",
      "--connection-name", "production"
    ]
  },
  "snowflake_staging": {
    "command": "uvx",
    "args": [
      "--python=3.12",
      "mcp_snowflake_server",
      "--connections-file", "/path/to/snowflake_connections.toml",
      "--connection-name", "staging"
    ]
  }
}

Manual Local Installation

  1. First, install the Claude AI Desktop App from https://claude.ai/download

  2. Install uv:

curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create a .env file with your Snowflake credentials:
SNOWFLAKE_USER="xxx@your_email.com"
SNOWFLAKE_ACCOUNT="xxx"
SNOWFLAKE_ROLE="xxx"
SNOWFLAKE_DATABASE="xxx"
SNOWFLAKE_SCHEMA="xxx"
SNOWFLAKE_WAREHOUSE="xxx"
SNOWFLAKE_PASSWORD="xxx"
SNOWFLAKE_PRIVATE_KEY_PATH=/absolute/path/key.p8
# Alternatively, use external browser authentication:
# SNOWFLAKE_AUTHENTICATOR="externalbrowser"
  1. Test locally:
uv --directory /absolute/path/to/mcp_snowflake_server run mcp_snowflake_server
  1. Add the server to your claude_desktop_config.json:
"mcpServers": {
  "snowflake_local": {
    "command": "/absolute/path/to/uv",
    "args": [
      "--python=3.12",
      "--directory", "/absolute/path/to/mcp_snowflake_server",
      "run", "mcp_snowflake_server"
    ]
  }
}

Using the MCP Server

Available Resources

The server exposes these resources:

  • memo://insights: A dynamically updated memo containing data insights discovered during analysis
  • context://table/{table_name}: Individual table schema information (if prefetch is enabled)

Available Tools

Query Tools

  • read_query: Execute SELECT queries

    Input: 
    - query: "SELECT * FROM your_table LIMIT 10"
    Returns: Array of result objects
    
  • write_query: Execute INSERT, UPDATE, or DELETE queries (requires --allow-write flag)

    Input:
    - query: "INSERT INTO your_table (column1, column2) VALUES ('value1', 'value2')"
    Returns: Number of affected rows
    
  • create_table: Create new tables (requires --allow-write flag)

    Input:
    - query: "CREATE TABLE new_table (id INT, name VARCHAR)"
    Returns: Confirmation message
    

Schema Tools

  • list_databases: List all available databases
  • list_schemas: List all schemas in a database
    Input:
    - database: "your_database"
    Returns: Array of schema names
    
  • list_tables: List all tables in a schema
    Input:
    - database: "your_database"
    - schema: "your_schema"
    Returns: Array of table metadata
    
  • describe_table: Get detailed column information for a table
    Input:
    - table_name: "database.schema.table"
    Returns: Array of column definitions
    

Analysis Tools

  • append_insight: Add new data insights
    Input:
    - insight: "The average transaction amount is increasing 5% month-over-month"
    Returns: Confirmation of addition
    Effect: Updates the memo://insights resource
    

Configuration Options

When setting up your server, you can use these additional options:

  • --allow-write: Enable write operations (disabled by default)
  • --log-dir: Specify directory for log files
  • --log-level: Set logging verbosity (DEBUG/INFO/WARNING/ERROR/CRITICAL)
  • --exclude-tools: Disable specific tools

Example Usage Scenarios

Basic Data Exploration

Ask Claude to:

  • "List all the tables in my database"
  • "Describe the schema of the customers table"
  • "Show me the first 10 orders with their customer information"

Data Analysis

Ask Claude to:

  • "Analyze monthly sales trends for the past year"
  • "Find correlations between customer demographics and purchase amounts"
  • "Identify the top-performing products by region"

Data Modification (with --allow-write enabled)

Ask Claude to:

  • "Create a new table to store analysis results"
  • "Update customer status for inactive accounts"
  • "Delete test records from the development database"

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "snowflake_pip" '{"command":"uvx","args":["--python=3.12","mcp_snowflake_server","--account","your_account","--warehouse","your_warehouse","--user","your_user","--password","your_password","--role","your_role","--database","your_database","--schema","your_schema"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "snowflake_pip": {
            "command": "uvx",
            "args": [
                "--python=3.12",
                "mcp_snowflake_server",
                "--account",
                "your_account",
                "--warehouse",
                "your_warehouse",
                "--user",
                "your_user",
                "--password",
                "your_password",
                "--role",
                "your_role",
                "--database",
                "your_database",
                "--schema",
                "your_schema"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

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

2. Add this to your configuration file:

{
    "mcpServers": {
        "snowflake_pip": {
            "command": "uvx",
            "args": [
                "--python=3.12",
                "mcp_snowflake_server",
                "--account",
                "your_account",
                "--warehouse",
                "your_warehouse",
                "--user",
                "your_user",
                "--password",
                "your_password",
                "--role",
                "your_role",
                "--database",
                "your_database",
                "--schema",
                "your_schema"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later