mcp-snowflake-server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides database interaction with Snowflake, enabling SQL query execution, table management, and schema exploration. Includes tools for reading data, modifying data (with appropriate permissions), creating tables, listing available tables, and describing table structures.

Snowflake MCP 服务器


概述

模型上下文协议 (MCP) 服务器实现,提供与 Snowflake 的数据库交互。此服务器支持通过工具运行 SQL 查询,并将数据洞察和架构上下文作为资源公开。


成分

资源

  • memo://insights
    一份不断更新的备忘录,汇总已发现的数据见解。
    当通过append_insight工具附加新的见解时自动更新。
  • context://table/{table_name}
    (如果启用预取)每个表的模式摘要(包括列和注释)作为单独的资源公开。

工具

该服务器公开以下工具:

查询工具

  • read_query
    执行SELECT查询以从数据库读取数据。
    输入:
    • query (字符串):要执行的SELECT SQL 查询
      **返回:**查询结果作为对象数组
  • write_query (仅使用--allow-write启用)
    执行INSERTUPDATEDELETE查询。
    输入:
    • query (字符串):SQL 修改查询
      **返回:**受影响的行数或确认
  • create_table (仅使用--allow-write启用)
    在数据库中创建新表。
    输入:
    • query (字符串): CREATE TABLE SQL语句
      **返回:**表创建确认

架构工具

  • list_databases
    列出 Snowflake 实例中的所有数据库。
    **返回:**数据库名称数组
  • list_schemas
    列出特定数据库内的所有模式。
    输入:
    • database (字符串):数据库的名称
      **返回:**模式名称数组
  • list_tables
    列出特定数据库和模式中的所有表。
    输入:
    • database (字符串):数据库的名称
    • schema (字符串):模式的名称
      **返回:**表元数据数组
  • describe_table
    查看特定表的列信息。
    输入:
    • table_name (字符串):完全限定表名( database.schema.table
      **返回:**包含名称、类型、可空性、默认值和注释的列定义数组

分析工具

  • append_insight
    向备忘录资源添加新的数据见解。
    输入:
    • insight (字符串):通过分析发现的数据洞察
      **返回:**确认洞察力的增加
      **效果:**触发memo://insights资源的更新

与 Claude Desktop 一起使用

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Snowflake Server:

npx -y @smithery/cli install mcp_snowflake_server --client claude

通过 UVX 安装

"mcpServers": { "snowflake_pip": { "command": "uvx", "args": [ "--python=3.12", // Optional: specify Python version <=3.12 "mcp_snowflake_server", "--account", "your_account", "--warehouse", "your_warehouse", "--user", "your_user", "--password", "your_password", "--role", "your_role", "--database", "your_database", "--schema", "your_schema" // Optionally: "--allow_write" // Optionally: "--log_dir", "/absolute/path/to/logs" // Optionally: "--log_level", "DEBUG"/"INFO"/"WARNING"/"ERROR"/"CRITICAL" // Optionally: "--exclude_tools", "{tool_name}", ["{other_tool_name}"] ] } }

本地安装

  1. 安装Claude AI 桌面应用程序
  2. 安装uv
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 使用您的 Snowflake 凭证创建一个.env文件:
SNOWFLAKE_USER="xxx@your_email.com" SNOWFLAKE_ACCOUNT="xxx" SNOWFLAKE_ROLE="xxx" SNOWFLAKE_DATABASE="xxx" SNOWFLAKE_SCHEMA="xxx" SNOWFLAKE_WAREHOUSE="xxx" SNOWFLAKE_PASSWORD="xxx" # Alternatively, use external browser authentication: # SNOWFLAKE_AUTHENTICATOR="externalbrowser"
  1. [可选] 修改runtime_config.json以设置数据库、模式或表的排除模式。
  2. 本地测试:
uv --directory /absolute/path/to/mcp_snowflake_server run mcp_snowflake_server
  1. 将服务器添加到您的claude_desktop_config.json
"mcpServers": { "snowflake_local": { "command": "/absolute/path/to/uv", "args": [ "--python=3.12", // Optional "--directory", "/absolute/path/to/mcp_snowflake_server", "run", "mcp_snowflake_server" // Optionally: "--allow_write" // Optionally: "--log_dir", "/absolute/path/to/logs" // Optionally: "--log_level", "DEBUG"/"INFO"/"WARNING"/"ERROR"/"CRITICAL" // Optionally: "--exclude_tools", "{tool_name}", ["{other_tool_name}"] ] } }

笔记

  • 默认情况下,写入操作是禁用的。使用--allow-write显式启用它们。
  • 该服务器支持通过排除模式过滤特定的数据库、模式或表。
  • 如果启用预取,服务器将公开额外的每个表上下文资源。
  • append_insight工具动态更新memo://insights资源。

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

Snowflake 集成实现读取和(可选)写入操作以及洞察跟踪

  1. Overview
    1. Components
      1. Resources
      2. Tools
    2. Usage with Claude Desktop
      1. Installing via Smithery
      2. Installing via UVX
      3. Installing Locally
    3. Notes
      1. License
        ID: 1z9lezliya