Snowflake MCP
Snowflake MCP server enables AI-driven Snowflake Cortex data querying, management, and SQL orchestration for efficient analytics.
How to Install and Use Snowflake MCP
Snowflake MCP is a server that helps you manage Snowflake Cortex AI tools, objects, and SQL queries. It works with MCP clients like Claude Desktop and fast-agent to provide smart AI features for your Snowflake data. Here’s a simple guide explaining how to install and use Snowflake MCP.
Preparing the Configuration File
Before you run Snowflake MCP, you need to set up a configuration file. This file tells the server what services and tools to use.
Start by creating a folder and copying the example config file there. You can do this on your computer’s terminal or command prompt:
mkdir -p ${HOME}/.mcp/
cp services/configuration.yaml ${HOME}/.mcp/tools_config.yaml
Then, open the copied file with a text editor like nano or Notepad and update the settings to fit your Snowflake environment. You will list your Cortex services and turn on extras like object and query management by setting them to True:
agent_services:
- service_name: example_agent
description: >
Agent service that manages example tasks.
database_name: your_database
schema_name: your_schema
search_services:
- service_name: example_search
description: >
Search service to query unstructured data.
database_name: your_database
schema_name: your_schema
analyst_services:
- service_name: example_analyst
semantic_model: YOUR_DB.YOUR_SCHEMA.YOUR_SEMANTIC_VIEW
description: >
Analyst service for semantic data queries.
other_services:
object_manager: True
query_manager: True
semantic_manager: True
sql_statement_permissions:
- Alter: True
- Create: True
- Drop: True
- Select: True
- Insert: True
# Add or change permissions as needed
- Unknown: False
Save and close the file after editing.
Setting Up Snowflake Connection
Next, Snowflake MCP needs your connection details. You provide these as environment variables or command line arguments. Here are the main environment variables you should set, replacing the placeholders with your info:
export SNOWFLAKE_ACCOUNT=<your_account>
export SNOWFLAKE_USER=<your_username>
export SNOWFLAKE_PASSWORD=<your_password> # For password auth; or use keys below
If you use key pair authentication, add:
export SNOWFLAKE_PRIVATE_KEY="$(cat <path_to_private_key.p8>)"
export SNOWFLAKE_PRIVATE_KEY_FILE_PWD=<your_key_password>
Snowflake MCP supports various authentication methods including username/password, key pairs, OAuth, and multi-factor auth.
Running Snowflake MCP Locally
With your config and environment ready, you can start the MCP server locally using this command:
uvx snowflake-labs-mcp --service-config-file ${HOME}/.mcp/tools_config.yaml
This runs the server with the default transport (stdio) for local development or testing.
Running Snowflake MCP in a Docker Container
For better deployment or sharing with others, use Docker to run Snowflake MCP. Follow these steps:
- Build the Docker image:
docker build -f docker/server/Dockerfile -t mcp-server-snowflake .
- Run the container with your environment and config:
For username/password authentication:
docker run -d \
--name mcp-server-snowflake \
-p 9000:9000 \
-e SNOWFLAKE_ACCOUNT=${SNOWFLAKE_ACCOUNT} \
-e SNOWFLAKE_USER=${SNOWFLAKE_USER} \
-e SNOWFLAKE_PASSWORD=${SNOWFLAKE_PASSWORD} \
-v ${HOME}/.mcp/tools_config.yaml:/app/services/tools_config.yaml:ro \
mcp-server-snowflake
For key pair authentication:
docker run -d \
--name mcp-server-snowflake \
-p 9000:9000 \
-e SNOWFLAKE_ACCOUNT=${SNOWFLAKE_ACCOUNT} \
-e SNOWFLAKE_USER=${SNOWFLAKE_USER} \
-e SNOWFLAKE_PRIVATE_KEY="${SNOWFLAKE_PRIVATE_KEY}" \
-e SNOWFLAKE_PRIVATE_KEY_FILE_PWD=${SNOWFLAKE_PRIVATE_KEY_FILE_PWD} \
-v ${HOME}/.mcp/tools_config.yaml:/app/services/tools_config.yaml:ro \
mcp-server-snowflake
- Check the container is running:
docker ps
- Test the MCP server endpoint:
curl http://localhost:9000/snowflake-mcp
Connecting MCP Clients to Snowflake MCP
Once Snowflake MCP is running, connect your client apps like Claude Desktop or fast-agent by pointing them to the MCP server URL.
For local containers, the URL looks like this:
http://localhost:9000/snowflake-mcp
For example, add this URL to Claude Desktop’s config:
{
"mcpServers": {
"mcp-server-snowflake": {
"url": "http://localhost:9000/snowflake-mcp"
}
}
}
Or in fast-agent’s config YAML:
mcp:
servers:
mcp-server-snowflake:
url: "http://localhost:9000/snowflake-mcp"
Replace localhost with your server’s host if you run MCP on a different machine.
This step-by-step guide should get Snowflake MCP up and running smoothly. Make sure your configuration matches your Snowflake environment and that permissions allow the actions you want. For more details, always check the MCP GitHub page and documentation.