Snowflake MCP Server
Provides secure access to Snowflake data warehouses, enabling AI assistants to execute SQL queries, analyze data, and retrieve insights through natural language interactions with configurable security controls and authentication methods.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Snowflake MCP Servershow me the top 10 customers by revenue this quarter"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
General-Purpose Snowflake MCP Server
A secure Model Context Protocol (MCP) server that provides AI assistants with safe, efficient access to your Snowflake data warehouse. Execute SQL queries, analyze data, and get insights through natural language interactions.
For more detail information and example usages, reference the Blog.
Key Features
🔐 Multiple Authentication: Password, private key, and SSO support
🛡️ Security First: Environment-based config, no hard-coded credentials
⚡ Performance Optimized: Configurable limits and efficient query execution
🔍 Smart Error Handling: Detailed messages with troubleshooting guidance
📊 Rich Query Results: Formatted tables with metadata and row counts
🧠 AI-Ready: Natural language to SQL through MCP protocol
🏗️ Universal Compatibility: Works with any MCP-compatible AI client
Quick Start
1. Install
git clone https://github.com/sfc-gh-tjia/snowflake-generic-mcp.git
cd snowflake-generic-mcp
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt2. Configure
cp .env.example .env
nano .env # Add your Snowflake credentials3. Test
npx @modelcontextprotocol/inspector python snowflake_mcp_server.pyConfiguration
Environment Variables
Required:
SNOWFLAKE_ACCOUNT=your-account-identifier # e.g., abc12345.us-east-1.snowflakecomputing.com
SNOWFLAKE_USERNAME=your-usernameAuthentication (choose one):
# Option 1: Password
SNOWFLAKE_PASSWORD=your-password
# Option 2: Private Key (recommended)
SNOWFLAKE_PRIVATE_KEY_PATH=/path/to/rsa_key.p8
SNOWFLAKE_PRIVATE_KEY_PASSPHRASE=passphrase # optional
# Option 3: SSO
SNOWFLAKE_AUTHENTICATOR=externalbrowserOptional:
SNOWFLAKE_WAREHOUSE=your_warehouse
SNOWFLAKE_DATABASE=your_database
SNOWFLAKE_SCHEMA=your_schema
SNOWFLAKE_ROLE=your_role
SNOWFLAKE_MAX_ROWS=100Private Key Setup (Recommended)
Generate key pair:
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pubAdd public key to Snowflake:
ALTER USER your_username SET RSA_PUBLIC_KEY='your-public-key-content';AI Tool Integration
Connect the MCP server to your AI assistant for natural language database interactions.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"snowflake": {
"command": "/opt/homebrew/bin/uv",
"args": ["--directory", "/path/to/your/project", "run", "snowflake_mcp_server.py"]
}
}
}Cursor
Option 1: Project-specific in Cursor Settings → Tools & Integration → MCP tools
Option 2: Global config in ~/.cursor/mcp.json
{
"mcpServers": {
"snowflake": {
"command": "/opt/homebrew/bin/uv",
"args": ["--directory", "/absolute/path/to/your/project", "run", "snowflake_mcp_server.py"]
}
}
}Example Usage
Once connected, you can interact with your Snowflake data using natural language:
"What tables are available in my database?"
"Show me the schema of the users table"
"Find all customers who made purchases this month"
"Analyze sales trends for Q4"
"Help me optimize this slow query"
"Count records in each table"
"Show me the top 10 customers by revenue"The server handles:
Query execution with proper formatting and metadata
Error handling with helpful troubleshooting suggestions
Security logging for dangerous operations
Performance limits to prevent resource exhaustion
Security Best Practices
⚠️ IMPORTANT SECURITY NOTICE: This server executes raw SQL queries on your Snowflake instance. Always follow these security practices:
Use private key authentication instead of passwords
Create dedicated Snowflake user with minimal permissions:
CREATE USER mcp_user PASSWORD = 'secure_password';
GRANT USAGE ON WAREHOUSE COMPUTE_WH TO USER mcp_user;
GRANT USAGE ON DATABASE your_db TO USER mcp_user;
GRANT SELECT ON ALL TABLES IN SCHEMA your_db.public TO USER mcp_user;Secure private keys:
chmod 600 /path/to/rsa_key.p8Use environment variables - never hard-code credentials
Use project-specific configurations for sensitive environments
⚠️ SQL Injection Risk: This server executes any SQL query provided by AI assistants. Ensure:
Your Snowflake user has minimal required permissions
No admin or elevated privileges for the MCP user
Consider using read-only access for sensitive environments
Monitor query logs for unexpected operations
Network Security: Ensure proper firewall rules and VPN access if required
Troubleshooting
Common Issues
Environment Variables Not Set:
Check
.envfile format (no quotes, no spaces around=)Set variables in shell profile for global access
Connection Errors:
Verify account identifier format (include region if needed)
Check network connectivity and warehouse status
Verify credentials and permissions
Authentication Failures:
For private key: Ensure public key is set in Snowflake
For SSO: Test browser login first
Check if user account is locked
Path Issues:
Use absolute paths in configuration files
Verify paths with
which uvorwhich python
Debug Mode
Server Logs:
export MCP_LOG_LEVEL=DEBUG
python snowflake_mcp_server.pyClient Logs:
Claude Desktop:
~/Library/Logs/Claude/mcp*.logCursor: Output panel → "MCP Logs"
License
MIT License - see LICENSE file for details.
Available Tools
1 toolexecute_snowflake_sql_queryA
Execute any SQL query on Snowflake.
⚠️ SECURITY WARNING: This tool executes raw SQL queries on your Snowflake instance.
Ensure proper user permissions and network security. Consider query restrictions
for production environments.
Args:
query: The SQL query to execute (required)
database: Override the default database (optional)
schema: Override the default schema (optional)
warehouse: Override the default warehouse (optional)
Returns:
Formatted string containing query results or error message
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| database | No | ||
| schema | No | ||
| warehouse | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively warns about security risks, permissions, and network considerations, and mentions that it returns formatted results or error messages. However, it lacks details on rate limits, query execution limits, or specific error handling, which holds it back from a perfect score.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear purpose statement, security warning, and parameter/return sections. It is appropriately sized and front-loaded, but the security warning could be more concise, and some sentences are slightly verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of executing SQL queries and the lack of annotations, the description does a good job covering purpose, security, parameters, and returns. With an output schema present, it doesn't need to detail return values, but it could benefit from more context on error scenarios or performance implications.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It lists all four parameters with brief explanations (e.g., 'override the default'), adding meaningful context beyond the schema. However, it does not provide examples or detailed constraints, such as valid formats for database names, preventing a score of 5.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as 'Execute any SQL query on Snowflake,' which specifies the verb (execute) and resource (SQL query on Snowflake). However, since there are no sibling tools, it cannot differentiate from alternatives, preventing a score of 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes a security warning that implies usage in secure contexts and suggests considering restrictions for production, but it does not explicitly state when to use this tool versus alternatives or provide clear exclusions. The guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
execute_snowflake_sql_query
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear and distinct purpose: executing SQL queries on Snowflake.
The single tool name 'execute_snowflake_sql_query' follows a clear verb_noun pattern. Since there is only one tool, consistency is inherently perfect with no deviations or mixed conventions.
A single tool for a Snowflake server feels too thin for the apparent scope, as it only provides raw SQL execution without any higher-level operations like listing tables, managing schemas, or handling data workflows. This is a borderline case leaning toward under-scoped.
The tool surface is severely incomplete for a Snowflake domain, lacking CRUD/lifecycle coverage. There are significant gaps such as no tools for browsing databases, tables, or schemas, and no support for common operations like data loading or user management, which will likely cause agent failures.
Related MCP Connectors
Query BigQuery, Snowflake, Redshift & Azure Synapse with natural language
- mcpOAuthcom.keboola
Connect your AI assistants to Keboola and expose your data, transformations, SQL queries, ...
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.