snowflake-mcp

snowflake-mcp

Enables AI agents to execute SQL queries and explore Snowflake databases using natural language, with schema discovery, table inspection, and readonly mode.

Category
访问服务器

README

<p align="center"> <img src="assets/logo-600.png" alt="Snowflake MCP" width="600"> </p>

Snowflake MCP Server

A Model Context Protocol (MCP) server that enables AI agents to execute SQL queries against Snowflake databases.

Users can use natural language to query Snowflake databases, like:

  • "Get me the top 10 products by revenue"
  • "Show me the total revenue for the last 30 days"
  • "Describe the structure of the orders table"
  • "Explore the database and summarize what data is available"
  • "Build a query to find customers who haven't ordered in 90 days"

Features

  • Execute SQL queries directly from AI agents like Cursor, Claude Desktop, etc.
  • Schema Discovery: Browse databases, schemas, tables, and views
  • Table Inspection: Describe table structures, view sample data, check row counts
  • Query Safety: Readonly mode, row limits, and query timeouts
  • Multiple Output Formats: Table, JSON, or CSV
  • Query Explanation: Get execution plans for queries
  • MCP Prompts: Guided workflows for common tasks
  • Support for both password and SSO (browser-based) authentication
  • Configurable default warehouse, database, schema, and role

Prerequisites

  • Node.js 18 or later

Usage

Cursor

Add to your Cursor MCP settings (~/.cursor/mcp.json):

SSO Authentication (Recommended)

{
  "mcpServers": {
    "snowflake": {
      "command": "npx",
      "args": ["-y", "snowflake-mcp"],
      "env": {
        "SNOWFLAKE_ACCOUNT": "your-org-your-account",
        "SNOWFLAKE_USERNAME": "your-username",
        "SNOWFLAKE_AUTHENTICATOR": "externalbrowser",
        "SNOWFLAKE_WAREHOUSE": "your-warehouse",
        "SNOWFLAKE_DATABASE": "your-database",
        "SNOWFLAKE_SCHEMA": "your-schema"
      }
    }
  }
}

A browser window will open for authentication on first query.

Password Authentication

{
  "mcpServers": {
    "snowflake": {
      "command": "npx",
      "args": ["-y", "snowflake-mcp"],
      "env": {
        "SNOWFLAKE_ACCOUNT": "your-org-your-account",
        "SNOWFLAKE_USERNAME": "your-username",
        "SNOWFLAKE_PASSWORD": "your-password",
        "SNOWFLAKE_ROLE": "your-role",
        "SNOWFLAKE_WAREHOUSE": "your-warehouse",
        "SNOWFLAKE_DATABASE": "your-database",
        "SNOWFLAKE_SCHEMA": "your-schema",
        "SNOWFLAKE_READONLY": "true"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "snowflake": {
      "command": "npx",
      "args": ["-y", "snowflake-mcp"],
      "env": {
        "SNOWFLAKE_ACCOUNT": "your-org-your-account",
        "SNOWFLAKE_USERNAME": "your-username",
        "SNOWFLAKE_AUTHENTICATOR": "externalbrowser"
      }
    }
  }
}

Configuration

Variable Required Default Description
SNOWFLAKE_ACCOUNT Yes - Your Snowflake account identifier (e.g., ORG-ACCOUNT)
SNOWFLAKE_USERNAME Yes - Snowflake username
SNOWFLAKE_AUTHENTICATOR No externalbrowser Authentication method: externalbrowser (SSO) or snowflake (password)
SNOWFLAKE_PASSWORD Conditional - Required if authenticator is snowflake, not needed for externalbrowser
SNOWFLAKE_ROLE No - Role to use for the session (uses account default if not set)
SNOWFLAKE_WAREHOUSE No - Warehouse to use (uses account default if not set)
SNOWFLAKE_DATABASE No - Database to use (uses account default if not set)
SNOWFLAKE_SCHEMA No - Schema to use (uses account default if not set)
SNOWFLAKE_READONLY No false Set to true to block write operations (INSERT, UPDATE, DELETE, etc.)

Finding Your Connection Settings

You can find your connection settings in Snowsight (Snowflake's web interface):

  1. Sign in to Snowsight
  2. Click on your username in the bottom-left corner to open the user menu
  3. Select Connect a tool to Snowflake
  4. Open the Config File tab
  5. Select the Warehouse, Database, Schema you want to use
  6. Copy values from the generated config file

Available Tools

Query Execution

execute_query

Execute a SQL query against Snowflake.

Parameter Type Required Default Description
query string Yes - The SQL query to execute
max_rows number No 100 Maximum number of rows to return
timeout number No - Query timeout in seconds
format string No table Output format: table, json, or csv

explain_query

Get the execution plan for a SQL query without running it.

Parameter Type Required Description
query string Yes The SQL query to explain

Connection

test_connection

Test the connection to Snowflake and return connection info including current user, role, warehouse, database, schema, and version.

Schema Discovery

list_databases

List all accessible databases in Snowflake.

list_schemas

List all schemas in a database.

Parameter Type Required Description
database string No Database name (uses current if not specified)

list_tables

List all tables in a schema.

Parameter Type Required Description
database string No Database name
schema string No Schema name

list_views

List all views in a schema.

Parameter Type Required Description
database string No Database name
schema string No Schema name

Table Inspection

describe_table

Get detailed information about a table's structure including columns, types, and constraints.

Parameter Type Required Description
table string Yes Table name (can include database.schema.table)

get_table_sample

Get a sample of rows from a table to understand its data.

Parameter Type Required Default Description
table string Yes - Table name
limit number No 5 Number of sample rows to return

get_table_row_count

Get the total number of rows in a table.

Parameter Type Required Description
table string Yes Table name

get_primary_keys

Get primary key columns for a table.

Parameter Type Required Description
table string Yes Table name

MCP Resources

schema://current

Returns information about the current database schema, including:

  • Current database and schema names
  • List of all tables
  • List of all views

Access this resource to get a quick overview of the connected schema without running queries.

MCP Prompts

analyze_table

Analyze a table's structure, sample data, and get query suggestions.

Parameter Type Required Description
table_name string Yes The table to analyze

explore_database

Explore and summarize the structure of a database.

Parameter Type Required Description
database_name string No Database to explore (uses current if not specified)

query_builder

Help build a SQL query based on natural language description.

Parameter Type Required Description
description string Yes Natural language description of desired query
tables string No Comma-separated list of relevant tables

Security Considerations

  • SSO authentication is recommended for production use as it avoids storing passwords in configuration files
  • Readonly mode (SNOWFLAKE_READONLY=true) is recommended when you only need to query data
  • Never commit configuration files containing credentials to version control
  • Consider using environment variables or a secrets manager for sensitive values
  • The server executes queries with the permissions of the configured Snowflake user—ensure appropriate access controls are in place
  • The max_rows parameter helps prevent accidentally returning massive result sets

License

MIT License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选