Dbt

io.github.us-all由 GitHub 帳號 us-all 發布v1.0.7更新於 Oct 24, 2026

dbt MCP — manifest/run_results/sources/catalog parsing + DQ result tables (BigQuery/Postgres)

概覽

AI 產生的概覽

一個唯讀的 MCP 伺服器,讓助理檢視 dbt 專案的建置產物,並查詢 BigQuery 或 Postgres 中的資料品質結果表。

可以做什麼
瀏覽與檢視 dbt 專案 manifest 與 catalog 中的模型、測試、來源、exposure 和巨集,支援血緣圖遍歷與逐欄測試覆蓋檢查。檢視執行歷史與執行結果,列出失敗的測試,找出慢速模型,並檢查來源資料新鮮度。查詢資料品質結果表,取得檢查歷史、依資料集統計的失敗檢查、分數趨勢、分層狀態與依來源的分層彙總。依選用 YAML 設定中的測試與新鮮度通過率目標計算 dbt SLA 狀態。以自然語言探索工具,並使用內建提示完成失敗測試、新鮮度、趨勢與事故排查流程。
適用情境
當助理需要回答關於 dbt 專案結構、測試覆蓋、執行歷史或來源資料新鮮度的問題,或需要從既有品質結果表彙整資料品質趨勢與 SLA 狀態時適用。它是唯讀的,不會觸發 dbt 執行。
執行需求
以 npm 套件形式在本機透過 stdio 執行(npx @us-all/dbt-mcp)。需要將 DBT_PROJECT_DIR 指向 dbt 專案根目錄;DBT_TARGET_DIR 與 DBT_RUN_HISTORY_DIR 為選用。品質工具需要 DQ 後端:BigQuery(預設,使用 GOOGLE_APPLICATION_CREDENTIALS 或 ADC,可選 BQ_PROJECT_ID)或 Postgres(DQ_BACKEND=postgres 加 PG_CONNECTION_STRING),以及 DQ_RESULTS_TABLE / DQ_SCORE_TABLE 表名。選用的 DBT_SLA_CONFIG_PATH YAML 用於 SLA 目標。
安裝前請注意
PG_CONNECTION_STRING 密鑰與 BigQuery 服務帳號憑證會讓伺服器存取你的資料倉儲,建議盡量限定為唯讀權限。品質工具會對設定的表執行 SQL,環境變數中的表名與欄名會經過驗證與引用處理。伺服器預設唯讀,DBT_ALLOW_WRITE 為將來的寫入工具保留。專案產物與查詢結果會傳送給所連線的 LLM 用戶端。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

@us-all/dbt-mcp

dbt MCP server — manifest.json, run_results.json, sources.json, catalog.json, plus DQ result tables (BigQuery / Postgres) behind one stdio MCP. Built on @us-all/mcp-toolkit.

A read-only window into your dbt project for LLM clients. No dbt run triggering — just deep introspection, run-history analysis, source freshness, per-column test coverage, lineage walks, and (if you have a custom DQ result table) historical check trends and Tier SLA status.

For DAG triggering / run history / log tails, install the companion @us-all/airflow-mcp alongside.

  • 27 tools across 3 categories (dbt, quality, meta) — 21 primitive tools + 5 aggregations + 1 meta
  • 4 MCP Prompts for triage workflows
  • 5 aggregation tools that replace 3-5 round-trips of "list / get / list"
  • extractFields response projection on high-volume reads
  • Read-only by default
  • Hybrid backend: BigQuery (default) or Postgres for DQ result tables — both peer-imported lazily

Install

bash
# 1. add the MCP serverpnpm add -D @us-all/dbt-mcp# 2. add the DQ backend you actually use (only if you query custom DQ tables):pnpm add -D @google-cloud/bigquery   # ORpnpm add -D pg

Run

bash
DBT_PROJECT_DIR=/path/to/dbt-project \DQ_RESULTS_TABLE=my-project.data_ops.quality_checks \npx @us-all/dbt-mcp

The server speaks MCP stdio; wire it into Claude Desktop / Cursor / any MCP client. Set MCP_TRANSPORT=http to opt in to Streamable HTTP transport (Bearer auth, /health endpoint).

Categories

CategoryToolsPurpose
dbt15 + 3 aggregationsParse manifest.json / run_results.json / sources.json / catalog.json
quality6 + 2 aggregationsQuery quality_checks and quality_score_daily (BQ or PG); per-tier rollup via dq-tier-by-source
meta1 (always on)search-tools for natural-language tool discovery

Toggle with DBT_TOOLS=dbt (allowlist) or DBT_DISABLE=quality (denylist).

Tools at a glance

dbt (15 + 3)

dbt-list-models, dbt-get-model, dbt-list-tests, dbt-get-test, dbt-list-sources, dbt-get-source, dbt-list-exposures, dbt-list-macros, dbt-get-macro, dbt-list-runs, dbt-get-run-results, dbt-failed-tests, dbt-slow-models, dbt-coverage, dbt-graph, freshness-status, incident-context, dbt-sla-status

quality (6 + 2)

dq-list-checks, dq-get-check-history, dq-failed-checks-by-dataset, dq-score-trend, dq-tier-status, dq-tier-by-source, failed-tests-summary, dq-score-snapshot

Prompts

PromptUse when
investigate-failed-tests"What's broken in the last 24h?"
freshness-degradation-triage"Are any sources stale?" (Tier 1 focus optional)
dq-trend-report"Give me a stakeholder-friendly DQ trend report"
incident-triage"Triage <model | source>" — bundles all signals

Environment variables

EnvRequiredNotes
DBT_PROJECT_DIRyesdbt project root (where dbt_project.yml lives)
DBT_TARGET_DIRnoDefaults to $DBT_PROJECT_DIR/target
DBT_RUN_HISTORY_DIRnoOptional dir for archived run_results.json history
DQ_BACKENDnobigquery (default) or postgres
DQ_RESULTS_TABLEnoFQN of the checks table; required only for checks-based quality tools
DQ_SCORE_TABLEnoFQN of the score-daily table; required for score-only tools
GOOGLE_APPLICATION_CREDENTIALSnoFor BigQuery backend (ADC fallback supported)
BQ_PROJECT_IDnoExplicit BQ project (otherwise inferred from ADC)
PG_CONNECTION_STRINGnoWhen DQ_BACKEND=postgres (secret)
DQ_SCHEMAnogeneric (default) or us-all — base schema preset for the quality category
DQ_COL_*noPer-column overrides on top of DQ_SCHEMA (see below). Overrides must be simple SQL identifiers.
DQ_TIER1_TARGET_PCTnoTier 1 SLA threshold for dq-tier-status when no tier column is configured (default 99.5). Superseded by DBT_SLA_CONFIG_PATH tier_sla.1 if both are set.
DBT_SLA_CONFIG_PATHnoOptional YAML path with tier_sla and dbt_sla blocks. Drives dq-tier-status thresholds and dq-tier-by-source per-tier targets. Mtime cached.
DBT_ALLOW_WRITEnoReserved for future write tools (none currently)
DBT_TOOLS / DBT_DISABLEnoCategory toggles

DQ result-table schema flavors

The quality category supports two schema presets via DQ_SCHEMA:

DQ_SCHEMA=generic (default)

Columns assumed on DQ_RESULTS_TABLE: run_at, check_name, check_type, dataset, table_name, status, severity, failure_count, message.

Columns assumed on DQ_SCORE_TABLE: score_date, scope, tier, completeness_pct, freshness_pct, validity_pct, anomaly_free_pct, overall_score.

dq-tier-status rolls up by Tier 1/2/3 against the per-scope rows.

DQ_SCHEMA=us-all

Real schema used at us-all (Postgres data_ops database):

quality_checks: run_date, check_type, dimension, source, target_name, status, metric_value, threshold, details (JSONB).

quality_score_daily: run_date, completeness_pct, freshness_pct, validity_pct, anomaly_free_pct, overall_score, total_checks, failed_checks.

In this flavor quality_score_daily is one row per day (no per-scope rollup, no tier column). dq-tier-status falls back to comparing the day's overall_score against DQ_TIER1_TARGET_PCT (default 99.5).

dq-get-check-history requires checkName formatted as '<check_type>:<target_name>' since us-all has no native check_name column.

Per-column overrides — DQ_COL_*

If your DQ tables don't match either preset, layer per-column overrides on top of DQ_SCHEMA. Any DQ_COL_* env var, when set, replaces the preset value for that single column. Unset vars keep the preset default.

Overrides are validated as simple SQL identifiers to avoid injecting raw SQL through environment variables. Table names in DQ_RESULTS_TABLE / DQ_SCORE_TABLE are also validated and quoted for the configured backend.

Env varLogical conceptGeneric presetus-all preset
DQ_COL_RUN_ATtimestamp/date on the checks tablerun_atrun_date
DQ_COL_CHECK_TYPEcheck type / dimension familycheck_typecheck_type
DQ_COL_STATUSpass/fail/warn/errorstatusstatus
DQ_COL_DATASETdataset / source / schemadatasetsource
DQ_COL_TABLE_NAMEtable or target nametable_nametarget_name
DQ_COL_SEVERITYseverity / dimensionseveritydimension
DQ_COL_FAILURE_COUNTnumeric failure count / metricfailure_countmetric_value
DQ_COL_MESSAGEfree-text or JSON messagemessagedetails::text
DQ_COL_CHECK_NAMEnatural identifier of the checkcheck_name(none)
DQ_COL_SCORE_DATEdate column on the score tablescore_daterun_date
DQ_COL_SCOPEscope/tenant column on score tablescope(none)
DQ_COL_TIERtier column on score tabletier(none)

For the three nullable columns (DQ_COL_CHECK_NAME, DQ_COL_SCOPE, DQ_COL_TIER), set the value to none / null / - to declare "no native column":

  • Without check_name → the tools synthesize one from check_type || ':' || table_name. dq-get-check-history then expects checkName formatted as '<check_type>:<table_name>'.
  • Without scope → dq-score-trend's scope filter is ignored (with a caveat) and dq-tier-status switches to the single-overall_score path that compares against DQ_TIER1_TARGET_PCT.
  • Without tier → same single-overall_score fallback.

Example — generic preset against a Postgres schema where columns happen to be named differently:

DQ_SCHEMA=genericDQ_COL_RUN_AT=checked_atDQ_COL_DATASET=schema_nameDQ_COL_TABLE_NAME=tblDQ_COL_FAILURE_COUNT=fail_nDQ_COL_CHECK_NAME=none      # synthesize from check_type+tblDQ_COL_SCOPE=none           # no per-team rollupDQ_COL_TIER=none            # use DQ_TIER1_TARGET_PCT instead

SLA config (optional) — DBT_SLA_CONFIG_PATH

Set DBT_SLA_CONFIG_PATH to a YAML file to surface project-defined tier targets and DBT SLAs to the quality tools. Schema (extra keys ignored):

yaml
dbt_sla:  test_pass_pct: 99.0          # consumed by dbt-sla-status (test pass rate threshold)  freshness_pass_pct: 99.5     # consumed by dbt-sla-status (source freshness pass rate threshold)
tier_sla:  1: 99.5                      # tier-1 overall_score / per-source pass-rate target  2: 99.0  3: 95.0

When set, the tier_sla map drives:

  • dq-tier-status — per-tier rollup compares each row's overall_score against the matching target. Without this file, hardcoded {1: 99.5, 2: 99.0, 3: 95.0} is used.
  • dq-tier-by-source — per-source pass-rate is compared to the target for that source's tier (resolved from dbt sources.yml meta.tier).
  • dq-tier-status no-tier-column path (us-all preset / DQ_COL_TIER=none) — uses tier_sla.1 as the single target. DQ_TIER1_TARGET_PCT env still works as a fallback when no SLA file is set.

The dbt_sla block drives:

  • dbt-sla-status — computes test pass rate from latest run_results.json and freshness pass rate from sources.json, then compares each axis against dbt_sla.test_pass_pct / dbt_sla.freshness_pass_pct. Returns passPct, target, meeting per axis plus caveats when fields or artifacts are missing.

The file is mtime-cached; edits between tool calls are picked up automatically.

Per-tier rollup from quality_checks — dq-tier-by-source

For schemas where quality_score_daily has only one row per day (no per-scope/tier breakdown), dq-tier-by-source reconstructs a per-tier picture from the raw quality_checks rows. Two modes:

mode: "source" (default) — group by source/dataset column

Use when each row of quality_checks represents a check on a source group and the dataset/source column carries the dbt source-group name directly.

  1. Builds a source_name -> tier map from the dbt manifest's sources.<source>.<table>.meta.tier (first table's tier per source group).
  2. Groups quality_checks rows by the dataset/source column and computes pass rate per source over a date or sinceHours window.
  3. Looks up each source's tier and target (from SLA config or defaults), reports meeting / missing per tier.

mode: "table" — group by table_name column

Use when the dataset/source column is a category (bq / dbt / airflow) and the actual dbt source-table identifier lives in the table_name / target_name column as <source_group>.<table>. Common in checks tables that consolidate signals from heterogeneous backends.

  1. Builds a <source_group>.<table> -> tier map from the manifest using each source entry's source_name + name + meta.tier — picks up table-level tier overrides naturally.
  2. Groups quality_checks rows by the table_name column. Pre-filter via sourceFilter (e.g. sourceFilter: "bq") when only some categories produce parseable target names.
  3. Each rollup key is parsed as <source_group>.<table>; rows without a . or whose key is not in the manifest land in caveats[].

Untiered rows (no manifest meta.tier) and unparseable rows always appear in caveats[] so you can tier them or accept the gap.

Tested-against schemas

  • dbt manifest schema v11 / v12 — the current top version. dbt 1.7 emits v11; dbt 1.8 through 1.12 all emit v12 (the schema evolves additively in-place). Newer/unknown versions still parse, but a caveats line will flag them.

Companion server

For Airflow DAG operations (list, runs, task instances, log tail, trigger, clear), install @us-all/airflow-mcp alongside this server.

Build

bash
pnpm installpnpm run build      # tsc → dist/pnpm test           # vitestpnpm run smoke      # spawns dist/index.js, calls initialize + tools/list (set env first)

License

MIT — see LICENSE.

來源:README.md,提交 3af1107

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.7最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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