
Warehouse Mcp
io.github.kalehdoo由 GitHub 账号 kalehdoo 发布v0.4.2更新于 Oct 24, 2026
Production MCP server for Postgres, Oracle, Snowflake, BigQuery, Redshift, DuckDB, MotherDuck.
概览
一个只读 MCP 服务器,让助手查询和浏览 Postgres、Oracle、Redshift、Snowflake、BigQuery、DuckDB 与 MotherDuck 数据仓库。
- 可以做什么
- 对已配置的仓库执行方言感知的只读 SELECT 查询,并在文本列中搜索字面值。浏览目录:列出 schema 和表、描述表、按模式查找列、读取外键和视图定义。剖析数据:抽样行、统计行数、计算列统计、高频值和按时间分桶。从可选的 YAML 业务词汇表和表文档层读取语义说明。
- 适用场景
- 适合让助手在无写入权限的情况下基于真实数据仓库回答问题,例如分析师探索表结构、剖析列或针对受支持的引擎起草 SQL。
- 运行要求
- 通过 npx(Node 20)或 Docker 镜像在本地运行。需设置 WAREHOUSE_TYPE 及对应的连接变量:Postgres 用 PG_HOST、PG_DATABASE、PG_USER、PG_PASSWORD;Oracle 用 ORACLE_USER、ORACLE_PASSWORD、ORACLE_CONNECT_STRING;Snowflake 用 SNOWFLAKE_ACCOUNT、SNOWFLAKE_USER、SNOWFLAKE_PRIVATE_KEY_PATH;BigQuery 用 BIGQUERY_PROJECT、GOOGLE_APPLICATION_CREDENTIALS;DuckDB 用 DUCKDB_PATH,MotherDuck 另需 MOTHERDUCK_TOKEN。需要能访问仓库的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Warehouse Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
warehouse-mcp
Production MCP (Model Context Protocol) server for your data warehouse. Read-only enforcement, five-tier role-based access, optional warehouse-role impersonation (for native RLS / CLS), JSONL audit log, optional output PII masking, optional semantic-metadata layer (glossary + table docs) with per-session toggle. Self-host the Docker image, install via npx, or wait for the upcoming managed cloud variant.
Status: v0.4.x — production-ready for the v1 warehouse list. See CHANGELOG for what shipped in each release.
Demo Videos
Warehouse MCP in action using Cursor
Supported warehouses
Databricks SQL is a fast-follow.
Tools exposed (16, all read-only)
Roles (five tiers)
Per-key role assigned via MCP_API_KEYS=key:role[:set_role=warehouse_role][:semantic=on|off]. The optional set_role= directive issues SET ROLE on Postgres/Redshift so the warehouse's own RLS / CLS / masking policies enforce per-key access — no policy duplication in MCP. The optional semantic=on|off directive overrides SEMANTIC_DEFAULT for that one key, controlling whether the session sees the warehouse://semantic/* resources (see docs/semantic-metadata.md).
For deployments with multiple existing DB roles (finance, hr, payroll, etc.) and many human users, see docs/multi-role-deployment.md — walks through mapping ~10 DB roles to MCP keys, the recommended <area> / <area>_restricted pattern, and when to graduate from static keys to OIDC.
Sample mcp connection json(change based on your role):
{ "mcpServers": { "warehouse-admin-semanticon": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer admin-key-change-me" ] }, "warehouse-admin-semanticoff": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer admin-key-nosemantic" ] }, "warehouse-reader-semanticon": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer reader-key-change-me" ] }, "warehouse-reader-semanticoff": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer reader-key-nosemantic" ] }, "warehouse-reader-restricted-semanticon": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer restricted-key-change-me" ] }, "warehouse-reader-restricted-semanticoff": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer restricted-key-nosemantic" ] }, "warehouse-metadata-only-semanticon": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer metadata-only-key-change-me" ] }, "warehouse-metadata-only-semanticoff": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer metadata-only-key-nosemantic" ] }, "warehouse-docs-viewer-only": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "http://localhost:3001/mcp", "--header", "Authorization: Bearer docs_viewer_key_change_me" ] } } }
Quick start
Option A — Docker compose (5-minute demo with seeded Postgres)
Option B — Docker against your own warehouse
The same image bundles every adapter; pick one with WAREHOUSE_TYPE plus the matching credentials. For credentials, prefer --env-file (or your secrets manager) over inline -e flags so passwords don't end up in shell history.
Option C — npx (no container)
Then point an AI client at it. Drop-in configs:
For a step-by-step walkthrough from "I have a warehouse" to "Claude is querying it", see the onboarding guide. For common errors, see troubleshooting.
Local development
For testcontainers integration tests against real Postgres: npm run test:integration (Docker required).
env setup
- MCP_API_KEYS
- WAREHOUSE_TYPE
- SEMANTIC_DIR
Optional: Semantic metadata (v0.4+)
Teach the AI agent what your warehouse means, not just what's in it. Drop YAML files describing your business glossary and table semantics into a directory, point SEMANTIC_DIR at it, and the agent gets two access channels into the same in-memory index:
- MCP resources at
warehouse://semantic/*— what tool-aware clients (Cursor, MCP Inspector) read proactively before issuing queries. - MCP tools
glossary_lookup,schema_lookup,table_lookup— same data via the tool channel, for clients (Claude Desktop) whose UI is tool-centric and may suppress resource-only servers. Pure in-memoryMap.gets — no warehouse I/O, no audit cost beyond a normal tool log line.
Format follows dbt's schema.yml v2 with one extension (meta.schema: per model). Customers using dbt can point SEMANTIC_DIR at their existing models/ directory and reuse most of what they have. See docs/semantic-metadata.md and the starter docs/semantic-templates/.
Per-session toggle
Whether a session sees the semantic layer is independent of whether the YAMLs are loaded — SEMANTIC_DIR controls loading; SEMANTIC_DEFAULT=on|off and the per-key semantic=on|off option (or include_semantic JWT claim) control per-session visibility. The YAMLs are always loaded and validated at boot so you can flip a kill-switch without restarting. Three precedence layers, highest first:
- Per-JWT claim —
include_semantic: true|false(OIDC). - Per-API-key option —
semantic=on|offinMCP_API_KEYS. - Server default —
SEMANTIC_DEFAULT=on|off(defaulton).
Each tool-call audit row records the resolved include_semantic value so you can correlate query quality with semantic exposure after the fact.
Optional: OpenTelemetry tracing
Off by default. Set OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318/v1/traces in your env and the server will emit per-tool-call spans. Resource attributes: service.name=warehouse-mcp, service.version=<package.json version>. Span attributes: warehouse.tenant, warehouse.role. Works with any OTLP/HTTP backend (Grafana Tempo, Honeycomb, Datadog APM, New Relic, SigNoz).
Optional: Output PII masking
Off by default. Set GUARDRAIL_PII_MASK=on and the server masks emails, SSNs, formatted phones, IPv4 addresses, and Luhn-validated credit cards in result rows. Mask level depends on the caller's role: admin sees raw, reader sees partial (a***@example.com), reader_restricted sees full redaction tags.
How it works
Read the architecture doc for the request flow — what files execute when an MCP client makes a call, how the guardrail pipeline composes around the tool handler, and the recipes for adding a new tool / guardrail / adapter. Single-page orientation for operators, security reviewers, and contributors.
Security
Read the threat model before deploying. It covers the OWASP Top 10 mapping, what the codebase mitigates, and what is left to your deployment (TLS, secrets management, network isolation, cost guardrails). Report vulnerabilities per SECURITY.md.
Contributing
Issues and PRs welcome. Start with CONTRIBUTING.md — it covers the dev workflow, the adapter contract, and how to add a new warehouse. By participating you agree to the Code of Conduct.
License
Apache-2.0
来源:README.md,提交 4ee3454
工具
0版本历史
1- v0.4.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分