convez.ai
MCP ServerDados & AnalyticsIntermediário
chenzhaoxuan0

Snowflake MCP Server

chenzhaoxuan0/snowflake-mcp

Acesso seguro ao Snowflake via MCP com queries SQL controladas

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP para integração com Snowflake data warehouse, permitindo consultas SQL, exploração de schemas e gerenciamento de recursos através da API REST do Snowflake. Implementa autenticação segura via DAuth com tokens programáticos e oferece controle granular sobre operações de leitura e escrita.

Instalação

$npx convez-ai chenzhaoxuan0/snowflake-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Exploração de estrutura de dados e schemas no Snowflake
  • Execução de queries SELECT e operações analíticas
  • Automação de pipelines de dados e ETL via Claude
  • Integração de BI e relatórios em tempo real

Veredito

MCP robusto e bem arquitetado para Snowflake com segurança em primeiro plano. A autenticação DAuth Type 3 e validação SQL nativa (bloqueio de writes por padrão) oferecem proteção adequada, mas requer configuração cuidadosa de credenciais e permissões. Essencial para equipes que usam Snowflake e precisam de integração nativa com Claude.

README

A tradução para o português deste README ainda está na fila.

snowflake-mcp

A Snowflake data warehouse MCP server powered by Dedalus.

Tools

ToolDescriptionRead/Write
list_databasesList Snowflake databasesRead
list_schemasList schemas in a databaseRead
list_tablesList tables in a schemaRead
describe_tableDescribe columns of a tableRead
run_queryRun SQL query (SELECT-only by default)Read/Write
list_warehousesList Snowflake warehousesRead

Environment Variables

VariableRequiredDescription
SNOWFLAKE_ACCOUNTYesAccount identifier (e.g., xy12345.us-east-1)
SNOWFLAKE_TOKENYesProgrammatic Access Token or OAuth token
SNOWFLAKE_TOKEN_TYPENoToken type header (default: PROGRAMMATIC_ACCESS_TOKEN)
SNOWFLAKE_WAREHOUSENoDefault warehouse
SNOWFLAKE_DATABASENoDefault database context
SNOWFLAKE_SCHEMANoDefault schema context
MCP_SERVER_SLUGNoMarketplace slug used to derive the default connection name (default: Zx/snowflake-mcp)
DEDALUS_API_KEYYesDedalus platform API key
DEDALUS_API_URLNoDedalus API base URL
DEDALUS_AS_URLNoDedalus auth server URL (default: https://as.dedaluslabs.ai)

Auth Architecture

Type 3 DAuth (SQL API REST). This server uses the Snowflake SQL API (POST /api/v2/statements) with a Bearer token managed through DAuth dispatch. All requests go through ctx.dispatch() — tool code never reads the token.

Users must create a Programmatic Access Token in Snowflake:

CREATE PROGRAMMATIC ACCESS TOKEN my_mcp_token
  ROLE = SYSADMIN
  EXPIRY = 90 DAYS;

See docs/auth-architecture.md for details.

For Dedalus hosted deployments, the connection name is derived from the server slug:

Zx/snowflake-mcp -> Zx-snowflake-mcp

Use that same name when providing runtime credentials.

run_query Safety

  • Default: Only SELECT, SHOW, DESCRIBE, WITH, EXPLAIN, and USE statements are allowed
  • allow_writes=True: Enables INSERT, UPDATE, DELETE, CREATE, DROP, etc. A warning is included in the result
  • Multi-statement SQL with writes is rejected unless allow_writes=True
  • Results are truncated at max_rows (default 100, max 1000)
  • Identifiers are quoted to prevent SQL injection

Quick Start

uv sync
cp .env.example .env
# Edit .env with your Snowflake account and token
uv run python src/main.py

Testing

uv run pytest tests/test_tools.py tests/test_sql_safety.py tests/test_transport.py tests/test_security.py -v

# Live tests (requires Snowflake credentials)
uv run pytest tests/test_connection_live.py -v

Examples

# List databases
result = await client.call_tool("list_databases", {})

# List schemas in a database
result = await client.call_tool("list_schemas", {"database": "SNOWFLAKE_SAMPLE_DATA"})

# Describe a table
result = await client.call_tool("describe_table", {
    "table": "CUSTOMER",
    "database": "SNOWFLAKE_SAMPLE_DATA",
    "schema": "TPCH_SF1"
})

# Run a read-only query
result = await client.call_tool("run_query", {
    "sql": "SELECT COUNT(*) AS cnt FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER"
})

Source Decision

Build native (Python REST via SQL API). No official Snowflake MCP exists. The SQL API REST with DAuth-managed PAT token is the only approach that achieves full Type 3 DAuth compliance. See docs/source-selection.md for details.

License

MIT

Ver o original no GitHub

Bom para

Relacionados