modelscope·@sfc-gh-tjia/snowflake-generic-mcp
暂无描述。
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.
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.txt
cp .env.example .env
nano .env # Add your Snowflake credentials
npx @modelcontextprotocol/inspector python snowflake_mcp_server.py
Required:
SNOWFLAKE_ACCOUNT=your-account-identifier # e.g., abc12345.us-east-1.snowflakecomputing.com
SNOWFLAKE_USERNAME=your-username
Authentication (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=externalbrowser
Optional:
SNOWFLAKE_WAREHOUSE=your_warehouse
SNOWFLAKE_DATABASE=your_database
SNOWFLAKE_SCHEMA=your_schema
SNOWFLAKE_ROLE=your_role
SNOWFLAKE_MAX_ROWS=100
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
ALTER USER your_username SET RSA_PUBLIC_KEY='your-public-key-content';
Connect the MCP server to your AI assistant for natural language database interactions.
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"]
}
}
}
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"]
}
}
}
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:
IMPORTANT SECURITY NOTICE: This server executes raw SQL queries on your Snowflake instance. Always follow these security practices:
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;
chmod 600 /path/to/rsa_key.p8Environment Variables Not Set:
.env file format (no quotes, no spaces around =)Connection Errors:
Authentication Failures:
Path Issues:
which uv or which pythonServer Logs:
export MCP_LOG_LEVEL=DEBUG
python snowflake_mcp_server.py
Client Logs:
~/Library/Logs/Claude/mcp*.log
-…审计 npm 包依赖项以查找安全漏洞,提供详细的报告和修复建议,并集成 MCP。
通过API层将克劳德桌面版直接连接到数据库,使其能够探索数据库结构、编写SQL查询、分析数据集和创建报告。该API层还包含用于表探索和查询执行的工具。
DBCode 是一个 Visual Studio Code 扩展,允许你管理许多数据库,包括 PostgreSQL、MySQL、SQL Server、DuckDB、Redis、MongoDB 等更多数据库。 DBCode 提供了运行 MCP 服务器的选项,可以访问这些数据库、它们的模式以及执行查询的能力。
AI 首选的统一数据访问通道,支持30多种数据源(阿里云全系/主流数据库/数仓)的安全访问。
后端服务,实现了模型控制面板协议,可连接到 Apache Doris 数据库,允许用户执行 SQL 查询、管理元数据,并且有可能利用大语言模型(LLMs)完成自然语言到 SQL 的转换等任务。
提供对Excel文件的操纵功能。此服务器启用工作簿创建、数据操纵、格式设置和高级Excel功能。