Interact with your Snowflake data warehouse through natural language.
Snowflake MCP Server šæ
A Model Context Protocol (MCP) server that enables Claude to interact with your Snowflake data warehouse through natural language.
š What is this?
Instead of logging into Snowflake UI and writing SQL manually, simply ask Claude in natural language and let it query your data warehouse for you!
This MCP server gives Claude the ability to:
- ā Execute SQL queries on Snowflake
- ā List tables in your schemas
- ā Describe table structures
- ā Check data freshness (when tables were last updated)
How It's Different
| Traditional Approach | With Snowflake MCP |
|---|---|
| Open Snowflake UI ā Write SQL ā Run ā Copy results | Ask Claude ā Get insights instantly |
| Context switching between tools | Everything in one conversation |
| Remember exact table/column names | Claude helps you discover schema |
| Repetitive daily checks | Automate monitoring workflows |
š Table of Contents
- Quick Start
- Installation
- Configuration
- Available Tools
- Usage Examples
- How It Works
- Security
- Extending
- Troubleshooting
- FAQ
- Contributing
- License
š Quick Start
See QUICKSTART.md for a 5-minute setup guide!
# 1. Clone the repo
git clone https://github.com/Legolasan/snowflake_mcp.git
cd snowflake_mcp
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure credentials
cp .env.example .env
nano .env # Add your Snowflake credentials
# 4. Test connection
python test_connection.py
# 5. Add to Claude Code (see Configuration section)
š¦ Installation
Prerequisites
- Python 3.8 or higher
- Snowflake account with access credentials
- Claude Code CLI (for MCP integration) - Get it here
Note: You do NOT need a separate Claude API key! The MCP server runs locally and only requires Snowflake credentials. See FAQ for details.
Install Dependencies
pip install -r requirements.txt
This installs:
mcp- Model Context Protocol SDKsnowflake-connector-python- Snowflake database driverpython-dotenv- Environment variable management
āļø Configuration
1. Snowflake Credentials
Copy the example environment file:
cp .env.example .env
Edit .env with your Snowflake credentials:
SNOWFLAKE_USER=your_username
SNOWFLAKE_PASSWORD=your_password
SNOWFLAKE_ACCOUNT=abc12345.us-east-1
SNOWFLAKE_WAREHOUSE=COMPUTE_WH
SNOWFLAKE_DATABASE=PROD_DB
SNOWFLAKE_SCHEMA=PUBLIC
Finding your account identifier:
- Your Snowflake URL:
https://abc12345.us-east-1.snowflakecomputing.com - Your account ID:
abc12345.us-east-1
ā ļø Security: Never commit .env to git! It's protected by .gitignore.
2. Claude Code MCP Configuration
Add this to your Claude Code MCP settings:
File: ~/.config/claude-code/mcp.json
Option A: Using .env file (Recommended)
{
"mcpServers": {
"snowflake": {
"command": "bash",
"args": [
"-c",
"source /path/to/snowflake_mcp/.env && python /path/to/snowflake_mcp/server.py"
]
}
}
}
Option B: Direct environment variables
{
"mcpServers": {
"snowflake": {
"command": "python",
"args": ["/path/to/snowflake_mcp/server.py"],
"env": {
"SNOWFLAKE_USER": "your_username",
"SNOWFLAKE_PASSWORD": "your_password",
"SNOWFLAKE_ACCOUNT": "your_account",
"SNOWFLAKE_WAREHOUSE": "COMPUTE_WH",
"SNOWFLAKE_DATABASE": "your_database",
"SNOWFLAKE_SCHEMA": "PUBLIC"
}
}
}
}
3. Restart Claude Code
After updating the MCP configuration, restart Claude Code to load the server.
š ļø Available Tools
1. `query_snowflake`
Execute any SQL query on Snowflake and get formatted results.
Parameters:
sql(required): SQL query to executelimit(optional): Max rows to return (default: 100)
Example prompts:
- "Show me the top 10 customers by revenue"
- "How many orders were placed yesterday?"
- "What's the average order value this month?"
2. `list_tables`
List all tables in a schema with row counts.
Parameters:
schema(optional): Schema name (defaults to configured schema)
Example prompts:
- "What tables are available?"
- "List all tables in the ANALYTICS schema"
3. `describe_table`
Get detailed structure of a table (columns, types, constraints).
Parameters:
Tools (3)
query_snowflakeExecute any SQL query on Snowflake and get formatted results.list_tablesList all tables in a schema with row counts.describe_tableGet detailed structure of a table (columns, types, constraints).Environment Variables
SNOWFLAKE_USERrequiredSnowflake usernameSNOWFLAKE_PASSWORDrequiredSnowflake passwordSNOWFLAKE_ACCOUNTrequiredSnowflake account identifierSNOWFLAKE_WAREHOUSErequiredSnowflake warehouse nameSNOWFLAKE_DATABASErequiredSnowflake database nameSNOWFLAKE_SCHEMArequiredSnowflake schema nameConfiguration
{"mcpServers": {"snowflake": {"command": "bash", "args": ["-c", "source /path/to/snowflake_mcp/.env && python /path/to/snowflake_mcp/server.py"]}}}