Warehouse Mcp

io.github.kalehdoo由 GitHub 帳號 kalehdoo 發布v0.4.2更新於 Oct 24, 2026

Production MCP server for Postgres, Oracle, Snowflake, BigQuery, Redshift, DuckDB, MotherDuck.

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

一個唯讀 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。需要能連線至倉儲的網路。
安裝前請注意
它持有真實倉儲憑證:PG_PASSWORD、ORACLE_PASSWORD、MOTHERDUCK_TOKEN、Snowflake 私鑰檔案以及 BigQuery 服務帳戶 JSON。MCP_API_KEYS 定義帶角色的 bearer 金鑰,README 中的範例金鑰必須更換。查詢為唯讀,但結果可能含敏感資料;PII 遮罩預設關閉,需以 GUARDRAIL_PII_MASK 開啟。README 將 TLS、密鑰管理與成本防護留給部署方自行處理。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Warehouse Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

warehouse-mcp

[CI] [License: Apache 2.0]

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

WarehouseAdapter docs
Postgres 12+docs/adapters/postgres.md
Oracle 12c+ (Thin mode, no Instant Client)docs/adapters/oracle.md
Amazon Redshift (cluster + Serverless)docs/adapters/redshift.md
Snowflake (key-pair auth)docs/adapters/snowflake.md
Google BigQuerydocs/adapters/bigquery.md
DuckDB (local file or :memory:)docs/adapters/duckdb.md
MotherDuck (cloud-hosted DuckDB, md: paths)docs/adapters/duckdb.md

Databricks SQL is a fast-follow.

Tools exposed (16, all read-only)

ToolPurpose
queryExecute a SELECT (validator-enforced read-only, dialect-aware)
list_schemas, list_tables, describe_tableBrowse the catalog
find_columnsSearch column names across the warehouse with a LIKE pattern
get_foreign_keysDiscover declared FK relationships for safe joins
get_view_definitionRead the SQL body of a view (where business logic lives)
sample_table, count_rowsPeek at data, check size before scanning
column_stats, top_valuesProfile a single column
time_seriesBucket by hour/day/week/month/quarter/year — dialect-correct everywhere
search_valueFind a literal across a table's text columns
glossary_lookupRead business-glossary terms from the semantic layer (in-memory, no warehouse I/O)
schema_lookupRead schema-level docs — purpose, owner, refresh, table list
table_lookupRead full semantic doc for one table — description + column metadata

Roles (five tiers)

RoleTools allowed
semantic_onlyOnly the three semantic-lookup tools — zero warehouse access; pair with semantic=on for a docs-viewer persona
metadata_onlyCatalog discovery + semantic lookups — never reads row data
reader_restrictedAggregates / samples / time series — no arbitrary SELECT
readerAdds query and search_value (the general analyst tier)
adminEverything; future write tools when ENABLE_WRITE_TOOLS ships

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)

bash
git clone https://github.com/kalehdoo/warehouse-mcp.gitcd warehouse-mcpdocker compose up# server on http://localhost:3001, seeded ecommerce data in 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.

bash
# Postgres (REDSHIFT_* env vars for Redshift; same driver under the hood)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=postgres \  -e PG_HOST=db -e PG_DATABASE=analytics -e PG_USER=mcp_reader -e PG_PASSWORD=... \  -e MCP_API_KEYS="$(openssl rand -hex 24):reader" \  ghcr.io/kalehdoo/warehouse-mcp:latest
# Oracle (Thin mode, no Instant Client)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=oracle \  -e ORACLE_USER=MCP_READER -e ORACLE_PASSWORD=... \  -e ORACLE_CONNECT_STRING="db.host:1521/SERVICE" \  ghcr.io/kalehdoo/warehouse-mcp:latest
# Snowflake (key-pair, mount the .p8)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=snowflake \  -e SNOWFLAKE_ACCOUNT=xy12345.us-east-1 -e SNOWFLAKE_USER=MCP_READER \  -e SNOWFLAKE_PRIVATE_KEY_PATH=/keys/snowflake.p8 \  -e SNOWFLAKE_WAREHOUSE=COMPUTE_WH -e SNOWFLAKE_DATABASE=ANALYTICS \  -v /opt/keys:/keys:ro \  ghcr.io/kalehdoo/warehouse-mcp:latest
# BigQuery (mount the service-account JSON)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=bigquery \  -e GOOGLE_APPLICATION_CREDENTIALS=/keys/bq-sa.json \  -e BIGQUERY_PROJECT=my-gcp-project \  -v /opt/keys:/keys:ro \  ghcr.io/kalehdoo/warehouse-mcp:latest
# DuckDB (file or in-memory)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=duckdb -e DUCKDB_PATH=:memory: \  ghcr.io/kalehdoo/warehouse-mcp:latest
# MotherDuck (hosted DuckDB)docker run -d -p 3001:3001 \  -e WAREHOUSE_TYPE=duckdb -e DUCKDB_PATH=md:my_database \  -e MOTHERDUCK_TOKEN=... \  ghcr.io/kalehdoo/warehouse-mcp:latest

Option C — npx (no container)

bash
npx warehouse-mcp@latest init     # interactive setup; writes .env, prints Claude Desktop snippetnpx warehouse-mcp doctor          # verify the connection without booting the servernpx warehouse-mcp start           # bind the MCP server to MCP_SERVER_PORT (default 3001)

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

bash
nvm use            # Node 20npm installnpm test           # unit tests, sub-secondnpm run lintcp .env.example .env

For testcontainers integration tests against real Postgres: npm run test:integration (Docker required).

env setup

  1. MCP_API_KEYS
  2. WAREHOUSE_TYPE
  3. 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-memory Map.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:

  1. Per-JWT claim — include_semantic: true|false (OIDC).
  2. Per-API-key option — semantic=on|off in MCP_API_KEYS.
  3. Server default — SEMANTIC_DEFAULT=on|off (default on).

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
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.4.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分