A Model Context Protocol (MCP) server that provides access to Snowflake databases for any MCP-compatible client.
This server implements the Model Context Protocol to allow any MCP client to:
MCP is a standard protocol that allows applications to communicate with AI models and external services. It enables AI models to access tools and data sources beyond their training data, expanding their capabilities through a standardized communication interface. Key features include:
The Snowflake-MCP server consists of several key components:
The system works through the following communication flow:
.env
fileThis architecture allows for seamless integration between AI applications and Snowflake databases while maintaining security and efficient connection management.
git clone https://github.com/davidamom/snowflake-mcp.git
pip install -r requirements.txt
Below is an example configuration for Claude Desktop, but this server works with any MCP-compatible client. Each client may have its own configuration method:
{
"mcpServers": {
"snowflake": {
"command": "C:\\Users\\YourUsername\\path\\to\\python.exe",
"args": ["C:\\path\\to\\snowflake-mcp\\server.py"]
}
}
}
Configuration parameters:
command
: Full path to your Python interpreter. Please modify this according to your Python installation location.args
: Full path to the server script. Please modify this according to where you cloned the repository.Example paths 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 and add the following configuration:
# 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
This MCP 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 on setting up key pair authentication, refer to Snowflake documentation on key pair authentication.
If both authentication methods are configured, the server will prioritize key pair authentication.
The server provides automatic connection management features:
Automatic connection initialization
Connection maintenance
Connection cleanup
The server will start automatically when configured with your MCP client. No manual startup is required in normal operation. Once the server is running, your MCP client will be able to execute Snowflake queries.
For development testing, you can start the server manually using:
python server.py
Note: Manual server startup is not needed for normal use. The MCP client will typically manage server startup and shutdown based on the configuration.
You can also run the server using Docker. This method is recommended for production environments and ensures consistent execution across different platforms.
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"
}
}
}
}
Note: The Docker implementation uses stdio for communication, so no ports need to be exposed.
If using key pair authentication with Docker, you'll need to mount your private key file:
docker run -i -v /path/to/your/key.p8:/app/rsa_key.p8:ro snowflake-mcp
And update your configuration accordingly:
{
"mcpServers": {
"Snowflake-Docker": {
"command": "docker",
"args": [
"run",
"-i",
"-v",
"/path/to/your/key.p8:/app/rsa_key.p8:ro",
"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 implementation consists of several key classes and modules:
The connection lifecycle is carefully managed to ensure reliability:
The server exposes the following tool to MCP clients:
This implementation follows best practices for both MCP protocol implementation and Snowflake database interaction.
This project is licensed under the MIT License. See the LICENSE file for details.
Copyright (c) 2025 David Amom
{
"mcpServers": {
"snowflake": {
"env": {},
"args": [
"C:\\path\\to\\snowflake-mcp\\server.py"
],
"command": "python"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.