The Snowflake MCP Server implements the Model Context Protocol to provide AI applications with secure access to Snowflake databases. It handles SQL query execution, manages database connections, and works with any MCP-compatible client like Claude.
git clone https://github.com/davidamom/snowflake-mcp.git
pip install -r requirements.txt
Create a .env
file in the project root with your Snowflake credentials:
# 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
SNOWFLAKE_ROLE=your_role # Your role
# 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
If both methods are configured, key pair authentication takes priority.
Configure your MCP client to use the server. Below is an example for Claude Desktop:
{
"mcpServers": {
"snowflake": {
"command": "C:\\Users\\YourUsername\\anaconda3\\python.exe",
"args": ["C:\\Path\\To\\snowflake-mcp\\server.py"]
}
}
}
{
"mcpServers": {
"snowflake": {
"command": "/usr/bin/python3",
"args": ["/path/to/snowflake-mcp/server.py"]
}
}
}
Once configured, the server starts automatically when your MCP client needs it. For testing, you can manually start it with:
python server.py
For production environments, Docker is recommended:
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",
"SNOWFLAKE_ROLE": "your_role"
}
}
}
}
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_ROLE": "your_role",
"SNOWFLAKE_PRIVATE_KEY_FILE": "path_for_your_private_key",
"SNOWFLAKE_PRIVATE_KEY_PASSPHRASE": "your_password_for_private_key"
}
}
}
}
The Snowflake MCP Server provides:
The server exposes two main tools to MCP clients:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "snowflake" '{"command":"python","args":["server.py"]}'
See the official Claude Code MCP documentation for more details.
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 > 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": {
"command": "python",
"args": [
"server.py"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"snowflake": {
"command": "python",
"args": [
"server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect