
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)
概览
一个只读的 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 目标。
安装
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"
extractFieldsresponse projection on high-volume reads- Read-only by default
- Hybrid backend: BigQuery (default) or Postgres for DQ result tables — both peer-imported lazily
Install
Run
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
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
Environment variables
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.
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 fromcheck_type || ':' || table_name.dq-get-check-historythen expectscheckNameformatted as'<check_type>:<table_name>'. - Without
scope→dq-score-trend'sscopefilter is ignored (with a caveat) anddq-tier-statusswitches to the single-overall_scorepath that compares againstDQ_TIER1_TARGET_PCT. - Without
tier→ same single-overall_scorefallback.
Example — generic preset against a Postgres schema where columns happen to be named differently:
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):
When set, the tier_sla map drives:
dq-tier-status— per-tier rollup compares each row'soverall_scoreagainst 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.ymlmeta.tier).dq-tier-statusno-tier-column path (us-all preset /DQ_COL_TIER=none) — usestier_sla.1as the single target.DQ_TIER1_TARGET_PCTenv still works as a fallback when no SLA file is set.
The dbt_sla block drives:
dbt-sla-status— computes test pass rate from latestrun_results.jsonand freshness pass rate fromsources.json, then compares each axis againstdbt_sla.test_pass_pct/dbt_sla.freshness_pass_pct. ReturnspassPct,target,meetingper 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.
- Builds a
source_name -> tiermap from the dbt manifest'ssources.<source>.<table>.meta.tier(first table's tier per source group). - Groups
quality_checksrows by the dataset/source column and computes pass rate per source over a date orsinceHourswindow. - 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.
- Builds a
<source_group>.<table> -> tiermap from the manifest using each source entry'ssource_name + name + meta.tier— picks up table-level tier overrides naturally. - Groups
quality_checksrows by thetable_namecolumn. Pre-filter viasourceFilter(e.g.sourceFilter: "bq") when only some categories produce parseable target names. - Each rollup key is parsed as
<source_group>.<table>; rows without a.or whose key is not in the manifest land incaveats[].
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
caveatsline 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
License
MIT — see LICENSE.
来源:README.md,提交 3af1107
工具
0版本历史
1- v1.0.7最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分