The Snowflake MCP server implements the Model Context Protocol to connect any MCP-compatible client with Snowflake databases. It allows you to execute SQL queries, automatically manages database connections, and supports both password and key pair authentication methods.
git clone https://github.com/davidamom/snowflake-mcp.git
pip install -r requirements.txt
Configure your MCP client to use the Snowflake MCP server. Below is an example for Claude Desktop:
{
"mcpServers": {
"snowflake": {
"command": "C:\\Users\\YourUsername\\path\\to\\python.exe",
"args": ["C:\\path\\to\\snowflake-mcp\\server.py"]
}
}
}
Example configurations for different operating systems:
Windows:
{
"mcpServers": {
"snowflake": {
"command": "C:\\Users\\YourUsername\\anaconda3\\python.exe",
"args": ["C:\\Path\\To\\snowflake-mcp\\server.py"]
}
}
}
MacOS/Linux:
{
"mcpServers": {
"snowflake": {
"command": "/usr/bin/python3",
"args": ["/path/to/snowflake-mcp/server.py"]
}
}
}
Create a .env
file in the project root directory with your Snowflake settings:
# Snowflake Configuration - Basic Info
SNOWFLAKE_USER=your_username # Your Snowflake username
SNOWFLAKE_ACCOUNT=YourAccount.Region # Example: MyOrg.US-WEST-2
SNOWFLAKE_DATABASE=your_database # Your database
SNOWFLAKE_WAREHOUSE=your_warehouse # Your warehouse
# Authentication - Choose one method
The server supports two authentication methods:
Password Authentication
SNOWFLAKE_PASSWORD=your_password # Your Snowflake password
Key Pair Authentication
SNOWFLAKE_PRIVATE_KEY_FILE=/path/to/rsa_key.p8 # Path to private key file
SNOWFLAKE_PRIVATE_KEY_PASSPHRASE=your_passphrase # Optional: passphrase if key is encrypted
For key pair authentication, you must first set up key pair authentication with Snowflake. For instructions, refer to Snowflake documentation on key pair authentication.
If both methods are configured, the server will use key pair authentication.
Once configured, the server will start automatically when your MCP client needs it. For testing purposes, you can start the server manually:
python server.py
You can also run the server using Docker:
docker build -t snowflake-mcp .
{
"mcpServers": {
"snowflake-docker": {
"command": "docker",
"args": [
"run",
"-i",
"snowflake-mcp"
],
"env": {
"SNOWFLAKE_USER": "your_username",
"SNOWFLAKE_ACCOUNT": "your_account",
"SNOWFLAKE_DATABASE": "your_database",
"SNOWFLAKE_WAREHOUSE": "your_warehouse",
"SNOWFLAKE_PASSWORD": "your_password"
}
}
}
}
For key pair authentication with Docker, mount your private key file:
{
"mcpServers": {
"Snowflake-Docker": {
"command": "docker",
"args": [
"run",
"-i",
"-v",
"/path/to/your/key.p8:/app/rsa_key.p8:ro",
"-v",
"/path/to/export/dir/:/export/",
"snowflake-mcp"
],
"env": {
"SNOWFLAKE_USER": "your_username",
"SNOWFLAKE_ACCOUNT": "your_account",
"SNOWFLAKE_DATABASE": "your_database",
"SNOWFLAKE_WAREHOUSE": "your_warehouse",
"SNOWFLAKE_PRIVATE_KEY_FILE": "/app/rsa_key.p8"
}
}
}
}
The server provides these key features:
Automatic Connection Management
Query Execution
Data Export
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.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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.
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.