dbt 数据项目 MCP配置与使用教程
io.github.us-all/dbt · v1.0.7
dbt MCP——解析 manifest、run_results、sources 与 catalog,并生成数据质量结果表(BigQuery/Postgres)。
原文名称:dbt
原文描述:dbt MCP — manifest/run_results/sources/catalog parsing + DQ result tables (BigQuery/Postgres)
建议先在本页复制安装配置,再到上游核对文档与权限。
产品介绍
dbt MCP——解析 manifest、run_results、sources 与 catalog,并生成数据质量结果表(BigQuery/Postgres)。 dbt 数据项目 是一个MCP Server,收录自 官方 MCP Registry。支持 stdio 传输。本页提供产品介绍、配置教程、安装命令与适用场景,支持 Trae、通义灵码、Cursor、Claude Code、VS Code 等。
适用场景
AgentHub Verified 可用性验证技术测试通过
自动化测试流水线已校验安装命令、传输协议与客户端兼容性
按平台快速复制
选择你的平台查看安装方式
- 打开项目根目录下的 .cursor/mcp.json(没有就新建)
- 点击「复制配置」粘贴进去;若已有其他 MCP,只合并 mcpServers 里的本条目
- 将 env 中的 <占位符> 替换为真实密钥(见下方「环境变量」)
- 保存后按 Cmd+Shift+P(Windows:Ctrl+Shift+P)→ 输入 Reload Window 并执行
预填环境变量与密钥(可选)
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}配置教程
- 打开 dbt 数据项目 详情页,确认这是你需要的 MCP Server(来源 官方 MCP Registry)。
- 按客户端选择 Trae、通义灵码、Cursor、Claude Code 或 VS Code,复制 JSON 配置或 CLI 命令。
- 将配置合并进 mcpServers,并把环境变量占位符替换为真实密钥。
- 重载窗口后,在 Agent 对话中调用该 MCP 提供的工具。
安装命令
以下安装命令与配置步骤已写入页面 HTML,搜索引擎与未启用 JavaScript 的浏览器均可直接读取。
Claude Code(本地)
- 确保已安装 Claude Code CLI
- 复制下方命令,将 <占位符> 替换为真实环境变量值后,在终端执行
- 若下方列出了环境变量,请对照填写
claude mcp add dbt --env DBT_PROJECT_DIR=<DBT_PROJECT_DIR> -- npx -y @us-all/dbt-mcpCursor — .cursor/mcp.json(本地)
- 打开项目根目录下的 .cursor/mcp.json(没有就新建)
- 点击「复制配置」粘贴进去;若已有其他 MCP,只合并 mcpServers 里的本条目
- 将 env 中的 <占位符> 替换为真实密钥(见下方「环境变量」)
- 保存后按 Cmd+Shift+P(Windows:Ctrl+Shift+P)→ 输入 Reload Window 并执行
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}VS Code — .vscode/mcp.json(本地)
- 确保 VS Code 已安装 GitHub Copilot 扩展并支持 MCP
- 打开项目根目录下的 .vscode/mcp.json(没有就新建)
- 点击「复制配置」粘贴;若已有其他 MCP,只合并 mcpServers 里的本条目
- 将 env 中的 <占位符> 替换为真实密钥(见下方「环境变量」)
- 保存后重新加载 VS Code 窗口
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}Claude Desktop — claude_desktop_config.json(本地)
- 打开 Claude Desktop 的 claude_desktop_config.json(路径见远程指引)
- 点击「复制配置」合并到 mcpServers
- 将 env 中的 <占位符> 替换为真实密钥
- 完全退出并重启 Claude Desktop
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}Trae — .trae/mcp.json(本地)
- 打开 Trae → 设置 → MCP,或编辑 .trae/mcp.json / 全局 mcp.json
- 点击「复制配置」粘贴并合并 mcpServers
- 将 env 中的 <占位符> 替换为真实密钥
- 保存后重载 Trae 窗口
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}Cherry Studio — MCP 设置(本地)
- 打开 Cherry Studio → 设置 → MCP 服务器 → 添加(STDIO)
- 也可直接导入下方 JSON:点击「复制配置」合并到 mcpServers
- 将 env 中的 <占位符> 替换为真实密钥,并确保本机已安装 Node.js / uv(npx、uvx)
- 启用服务并查看工具列表是否加载成功
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}通义灵码 — MCP 配置(本地)
- 通义灵码:个人设置 → MCP 服务 → 「+」→ 手工添加(STDIO)或配置文件添加
- 点击「复制配置」合并 mcpServers;命令/参数/环境变量与 JSON 一致
- 将 env 中的 <占位符> 替换为真实密钥;本机需 Node.js 18+(npx)或已安装 uv(uvx)
- 确认服务状态为已连接后再在智能体对话中调用
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}Windsurf — mcp_config.json(本地)
- 编辑 ~/.codeium/windsurf/mcp_config.json
- 点击「复制配置」合并 mcpServers(本地 stdio 与 Cursor 格式相同)
- 将 env 中的 <占位符> 替换为真实密钥后保存并刷新 Cascade
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}Cline — MCP Servers(本地)
- Cline 面板 → 设置 → MCP Servers
- 点击「复制配置」粘贴并合并
- 将 env 中的 <占位符> 替换为真实密钥后保存
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}WorkBuddy — .workbuddy/mcp.json(本地)
- 编辑 ~/.workbuddy/mcp.json(用户级)或项目目录 .workbuddy/mcp.json
- 也可在界面:插件 → MCP 服务器 → 配置 MCP,粘贴下方 JSON
- 将 env 中的 <占位符> 替换为真实密钥;Windows 下 command/脚本路径建议用绝对路径
- 保存并重启 WorkBuddy,确认连接器状态为绿色
{
"mcpServers": {
"dbt": {
"command": "npx",
"args": [
"-y",
"@us-all/dbt-mcp"
],
"env": {
"DBT_PROJECT_DIR": "<DBT_PROJECT_DIR>"
}
}
}
}常见报错排查与运行避坑 (Troubleshooting)FAQ
针对 dbt 数据项目 在 Cursor、Claude Code 中的常见连接错误与解决办法
在 Cursor / Claude Code 中配置 dbt 提示 connection closed 或 exit code 1?
通常由本地运行时环境缺失或命令路径未被 IDE 继承引起。排查步骤: 1. 确认已安装 Node.js 18+(支持 npx)或 Python 3.10+(支持 uvx); 2. 尝试在终端运行 which npx 或 which uvx,把配置文件中的 "command" 字段改为完整绝对路径; 3. 修改 mcp.json 后,必须完全重载或重启客户端窗口。
# 终端测试命令是否存在: which npx node -v
提示 spawn npx ENOENT 或 command not found?
这是因为编辑器后台进程未加载完整的终端环境变量(PATH)。解决方案:在全局安装该包(如 npm install -g 包名),或在配置文件中将 command 设置为系统的实际路径(如 Windows 下的 C:\Program Files\nodejs\npx.cmd,Mac 下的 /usr/local/bin/npx)。
提示 Missing required environment variable 或 API 认证失败?
dbt 依赖环境变量(如 DBT_PROJECT_DIR)。请在客户端配置文件的 "env" 对象中填入有效密钥,注意不要包含多余空格或未闭合的双引号。
// .cursor/mcp.json 或 claude_desktop_config.json
{
"env": {
"DBT_PROJECT_DIR": "your_actual_key_here"
}
}免安装模拟调用 (Playground)
仿真环境dbt 核心接口调用仿真 · 无需配置本地环境,直接预览调用参数与返回格式
{
"target": "dbt",
"action": "execute",
"options": {
"mode": "standard",
"timeoutMs": 5000
}
}点击上方「模拟运行」按钮
查看该工具在 Agent 内部的返回数据格式
选型与决策建议(为什么选它?)
帮助你快速判断该资源是否契合当前项目,避免盲目折腾
- PR 自动审查
- 生成 changelog
- 跨仓库 Issue 检索
- 替代人工安全审计
- 在无授权仓库上操作
dbt + 对应场景 Prompt → 组成标准 Agent 自动化任务
MCP 实战教程:从安装到看见效果
按完整实例走一遍(含期望效果与对比验收)。装完本页资源后,用教程里的提示词核对是否真正生效。
相关资源
顺序思考
io.mcp-cn.modelcontextprotocol/server-sequential-thinking
帮助AI进行结构化思考和推理的MCP工具
n8n
io.mcp-cn.drballs/n8n-mcp-server
n8n工作流自动化平台的MCP服务器,提供完整的工作流管理、执行控制、凭证管理等功能
Playwright
io.mcp-cn.playwright/mcp
基于Playwright的自动化测试和网页操作MCP工具
GitHub
io.mcp-cn.modelcontextprotocol/server-github
连接GitHub的MCP服务器,支持仓库管理、问题跟踪、代码搜索等功能
高德地图
io.mcp-cn.amap/amap-maps-mcp-server
高德地图的MCP服务器
Figma
io.mcp-cn.figma-developer-mcp
连接Figma的MCP服务器,支持设计文件管理和操作
常搭配使用
基于文件的规划
v3.23.0
io.clawhub.othmanadi/planning-with-files
面向多步 AI Agent 工作的持久化文件规划。将 task_plan.md、findings.md 与 progress.md 保存在磁盘上,生命周期钩子注入所选的项目规划上下文;自动恢复仅读取项目规划文件,显式运行 session-catchup.py --input-file 时读取同项目的本地 Agent……(原文截断)
OpenClaw 指挥中心
v1.5.0
io.clawhub.jontsai/command-center
OpenClaw 任务控制台仪表盘——实时会话监控、LLM 用量跟踪、成本情报与系统生命体征。在一处查看你所有的 AI Age……(原文截断)
ClawCall 语音电话
v2.0.1
io.clawhub.clawcall-dev/clawcall-dev
当用户需要 AI Agent 拨打美国电话、呼叫商家、处理通话等待或语音菜单、完成确认/改期/取消/预订/跟进/查询……时使用本技能(原文截断)。
self-improving agent
v4.0.3
io.clawhub.pskoett/self-improving-agent
捕获经验、错误与纠正,实现持续改进。
继续逛 AgentHub
大多数人安装前还会对比同类工具或看场景方案——下面这些能帮你少走弯路。
收录徽章:把 AgentHub 挂到你的官网
复制下面任意一段代码到项目主页、官网或 GitHub README。徽章是 SVG 热链,无需上传文件,链接指向本页,访客可由此直接找到安装方式。
<a href="https://myagenthub.cn/p/io.github.us-all/dbt" title="AgentHub 已收录:dbt 数据项目" target="_blank" rel="noopener">
<img src="https://myagenthub.cn/badge/io.github.us-all/dbt" alt="AgentHub 已收录:dbt 数据项目" height="20" style="border:0"/>
</a>[](https://myagenthub.cn/p/io.github.us-all/dbt)徽章由 /badge/<资源ID> 动态生成,名称与收录状态变化后自动更新;请保留链接指向,它是收录来源的判定依据。
统一 Manifest
{
"id": "io.github.us-all/dbt",
"type": "mcp-server",
"version": "1.0.7",
"displayName": "dbt",
"description": "dbt MCP — manifest/run_results/sources/catalog parsing + DQ result tables (BigQuery/Postgres)",
"repository": {
"url": "https://github.com/us-all/dbt-mcp-server",
"source": "github"
},
"distribution": {
"packages": [
{
"registryType": "npm",
"identifier": "@us-all/dbt-mcp",
"version": "1.0.7",
"transport": "stdio",
"environmentVariables": [
{
"name": "DBT_PROJECT_DIR",
"description": "Path to dbt project root (where dbt_project.yml lives).",
"isRequired": true
},
{
"name": "DBT_TARGET_DIR",
"description": "dbt target dir for manifest.json/run_results.json (default: $DBT_PROJECT_DIR/target)."
},
{
"name": "DBT_RUN_HISTORY_DIR",
"description": "Optional dir for archived run_results.json history (glob-scanned)."
},
{
"name": "DQ_BACKEND",
"description": "DQ result table backend: 'bigquery' (default) or 'postgres'."
},
{
"name": "DQ_RESULTS_TABLE",
"description": "Fully qualified DQ checks table, e.g. 'project.data_ops.quality_checks'."
},
{
"name": "DQ_SCORE_TABLE",
"description": "Fully qualified DQ score-daily table, e.g. 'project.data_ops.quality_score_daily'."
},
{
"name": "GOOGLE_APPLICATION_CREDENTIALS",
"description": "Service account key path for BigQuery (ADC fallback supported)."
},
{
"name": "BQ_PROJECT_ID",
"description": "Explicit BigQuery project ID for DQ queries."
},
{
"name": "PG_CONNECTION_STRING",
"description": "Postgres connection string when DQ_BACKEND=postgres.",
"isSecret": true
},
{
"name": "DBT_ALLOW_WRITE",
"description": "Reserved for future write tools. Default read-only."
},
{
"name": "DQ_SCHEMA",
"description": "DQ result-table schema preset: 'generic' (default) or 'us-all'. Use DQ_COL_* env vars to override individual columns on top of the preset."
},
{
"name": "DQ_COL_RUN_AT",
"description": "Override for the timestamp/date column on the DQ checks table. Default depends on DQ_SCHEMA preset."
},
{
"name": "DQ_COL_CHECK_TYPE",
"description": "Override for the check-type column on the DQ checks table. Default 'check_type'."
},
{
"name": "DQ_COL_STATUS",
"description": "Override for the status column on the DQ checks table. Default 'status'."
},
{
"name": "DQ_COL_DATASET",
"description": "Override for the dataset/source column on the DQ checks table. Default depends on preset."
},
{
"name": "DQ_COL_TABLE_NAME",
"description": "Override for the table/target-name column on the DQ checks table. Default depends on preset."
},
{
"name": "DQ_COL_SEVERITY",
"description": "Override for the severity/dimension column on the DQ checks table. Default depends on preset."
},
{
"name": "DQ_COL_FAILURE_COUNT",
"description": "Override for the numeric failure-count column on the DQ checks table. Default depends on preset."
},
{
"name": "DQ_COL_MESSAGE",
"description": "Override for the message column on the DQ checks table. Default depends on preset."
},
{
"name": "DQ_COL_CHECK_NAME",
"description": "Override for the check_name column on the DQ checks table. Set to 'none'/'null'/'-' to synthesize check_name from check_type and table_name."
},
{
"name": "DQ_COL_SCORE_DATE",
"description": "Override for the date column on the DQ score-daily table. Default depends on preset."
},
{
"name": "DQ_COL_SCOPE",
"description": "Override for the scope column on the DQ score-daily table. Set to 'none'/'null'/'-' if the table has no per-scope rollup."
},
{
"name": "DQ_COL_TIER",
"description": "Override for the tier column on the DQ score-daily table. Set to 'none'/'null'/'-' if the table has no tier dimension."
},
{
"name": "DQ_TIER1_TARGET_PCT",
"description": "When no tier column is configured (us-all preset or DQ_COL_TIER=none), the overall_score threshold dq-tier-status compares against (default 99.5). Superseded by DBT_SLA_CONFIG_PATH tier_sla.1 if both are set."
},
{
"name": "DBT_SLA_CONFIG_PATH",
"description": "Optional path to a YAML file that defines tier_sla (per-tier overall_score targets) and dbt_sla (test/freshness pass rates). When set, dq-tier-status and dq-tier-by-source read tier targets from this file, and dbt-sla-status compares run_results / sources pass rates against dbt_sla.test_pass_pct / freshness_pass_pct. Mtime cached."
},
{
"name": "DBT_TOOLS",
"description": "Comma-separated category allowlist (dbt,quality,meta)."
},
{
"name": "DBT_DISABLE",
"description": "Comma-separated category disablelist."
}
]
}
],
"remotes": []
},
"dependencies": [],
"installTargets": [
"claude-code",
"claude-desktop",
"cursor",
"vscode",
"trae",
"cherry-studio",
"lingma",
"windsurf",
"cline",
"workbuddy"
],
"keywords": [],
"provenance": {
"origin": "official-mcp-registry",
"originalId": "io.github.us-all/dbt",
"originalUrl": "https://registry.modelcontextprotocol.io/v0.1/servers/io.github.us-all%2Fdbt/versions/latest",
"isOfficial": true,
"status": "active"
}
}