Home / MCP / Snowflake MCP Server

Snowflake MCP Server

Provides access to Snowflake databases through MCP to run queries and manage connections securely.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "snowflake": {
            "command": "python",
            "args": [
                "server.py"
            ],
            "env": {
                "SNOWFLAKE_USER": "your_username",
                "SNOWFLAKE_ACCOUNT": "YourAccount.Region",
                "SNOWFLAKE_DATABASE": "your_database",
                "SNOWFLAKE_WAREHOUSE": "your_warehouse",
                "SNOWFLAKE_ROLE": "your_role",
                "SNOWFLAKE_PASSWORD": "your_password",
                "SNOWFLAKE_PRIVATE_KEY_FILE": "/path/to/rsa_key.p8",
                "SNOWFLAKE_PRIVATE_KEY_PASSPHRASE": "your_passphrase"
            }
        }
    }
}

You can use the Snowflake MCP Server to access Snowflake databases from any MCP-compatible client. It implements the Model Context Protocol, allowing you to run SQL queries, manage connections automatically, handle results and errors, and authenticate with Snowflake using either passwords or key pairs.

How to use

Start your MCP client and point it to the Snowflake MCP server configuration. The server exposes a tool to run SQL queries against your Snowflake databases and returns structured results that your client can consume. You can rely on automatic connection management, which handles initial connections, timeouts, reconnections, and cleanup when you stop using the service. Use either password-based authentication or key pair authentication as configured in Snowflake.

How to install

Prerequisites: you need Python installed on your machine. You also need a MCP client configured to communicate with the server via standard input/output. Install the server dependencies and set up your environment as follows.

# 1. Ensure Python is installed
python --version

# 2. Clone the project repository (replace with your actual clone path)
# git clone https://github.com/davidamom/snowflake-mcp.git

# 3. Navigate to the server directory and install dependencies
cd snowflake-mcp
pip install -r requirements.txt

Additional setup and usage notes

Configure how the server connects to Snowflake by creating a configuration file at the project root. The configuration defines the Snowflake connection details, the authentication method, and how the server should be started by your MCP client.

Configuration details

Create a .env file in the project root and populate it with your Snowflake connection information and authentication method.

Security and authentication

Two authentication methods are supported. You can use password authentication or key pair authentication. If both are configured, key pair authentication is preferred.

Running with Docker

You can run the server inside a Docker container for consistent deployment. Build the image and start the container using the commands shown.

Notes on usage

The server handles the MCP communication via stdio. Your MCP client starts the server as part of its workflow, so manual startup is typically only needed for development or testing.

Notes on troubleshooting

If you encounter connection timeouts or authentication errors, verify your .env configuration, ensure the Snowflake account/region is correct, and confirm that the required Snowflake role has the necessary permissions for the queries you intend to run.

Care and maintenance

The server manages connection lifecycles automatically, creating connections lazily on first use, validating parameters, reconnecting on timeouts, and cleaning up resources when stopped.

Available tools

execute_query

Executes a SQL query on Snowflake and returns the results in a structured format.

export_to_csv

Executes a SQL query and exports the results to a CSV file, returning the number of rows and the file path.