
MCP(模型上下文协议)服务器,用于与DBT文档交互
概览
模型上下文协议(MCP)服务器,用于与DBT项目元数据交互,包括dbt Dotrifacts(manifest.json、catalog.json)。该服务器暴露dbt图信息,并允许查询节点详情、模型/列谱系及相关元数据。 * * 按名称(search_dbt_node_names)查找节点(模型、源代码、测试等)。* 根据列名(search_dbt_column_names)定位节点。* 在已编译的节点SQL代码中搜索(search_dbt_sql_code)。* * 检索任意给定节点唯一ID(get_dbt_node_attributes)的详细属性。* * 查找节点(get_dbt_predecessors)的直接上游依赖关系(前身)。* 查找节点(get_dbt_successors)的直接下游依赖关系(继任)。* * 追踪模型中特定列(get_column_ancestors)的所有上游源。* 追踪模型中特定列(get_column_descendants)的所有下游依赖项。* * 允许执行SQL查询的工具。
概述(AI 翻译)
模型上下文协议(MCP)服务器,用于与dbt项目元数据交互,包括dbt Docs的文物(manifest.json、catalog.json)。该服务器暴露dbt图信息,允许查询节点详情、模型/列谱系及相关元数据。
关键功能
该服务器提供以下工具:
- 搜索DBT节点:
- 按名称(
search_dbt_node_names)查找节点(模型、源、测试等)。 - 根据列名(
search_dbt_column_names)定位节点。 - 在节点(
search_dbt_sql_code)编译后的SQL代码中搜索。 - 检查节点:
- 获取任意给定节点唯一 ID 的详细属性(
get_dbt_node_attributes)。 - 探索血脉:
- 查找节点(
get_dbt_predecessors)的直接上游依赖关系(前身)。 - 寻找节点(
get_dbt_successors)的直接下游依赖项(继承节点)。 - 列级谱系:
- 追踪模型中特定列的所有上游源(
get_column_ancestors)。 - 追踪模型中特定列的所有下游依赖项(
get_column_descendants)。 - 建议扩展:
- 允许执行SQL查询的工具。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
dbt-docs-mcp
Model Context Protocol (MCP) server for interacting with dbt project metadata, including dbt Docs artifacts (manifest.json, catalog.json). This server exposes dbt graph information and allows querying node details, model/column lineage, and related metadata.
Key Functionality
This server provides tools to:
- Search dbt Nodes:
- Find nodes (models, sources, tests, etc.) by name (
search_dbt_node_names). - Locate nodes based on column names (
search_dbt_column_names). - Search within the compiled SQL code of nodes (
search_dbt_sql_code).
- Find nodes (models, sources, tests, etc.) by name (
- Inspect Nodes:
- Retrieve detailed attributes for any given node unique ID (
get_dbt_node_attributes).
- Retrieve detailed attributes for any given node unique ID (
- Explore Lineage:
- Find direct upstream dependencies (predecessors) of a node (
get_dbt_predecessors). - Find direct downstream dependents (successors) of a node (
get_dbt_successors).
- Find direct upstream dependencies (predecessors) of a node (
- Column-Level Lineage:
- Trace all upstream sources for a specific column in a model (
get_column_ancestors). - Trace all downstream dependents of a specific column in a model (
get_column_descendants).
- Trace all upstream sources for a specific column in a model (
- Suggested extensions:
- Tool that allows executing SQL queries.
- Tool that retrieves table/view/column metadata directly from the database.
- Tool to search knowledge-base.
Getting Started
- Prerequisites: Ensure you have Python installed and uv
- Clone the repo:
git clone cd dbt-docs-mcp - Optional: parse dbt manifest for column-level lineage:
- Setup the required Python environment, e.g.:
uv sync- Use the provided script
scripts/create_manifest_cl.pyand simply provide the path to your dbt manifest, dbt catalog and the desired output paths for your schema and column lineage file:
python scripts/create_manifest_cl.py --manifest-path PATH_TO_YOUR_MANIFEST_FILE --catalog-path PATH_TO_YOUR_CATALOG_FILE --schema-mapping-path DESIRED_OUTPUT_PATH_FOR_SCHEMA_MAPPING --manifest-cl-path DESIRED_OUTPUT_PATH_FOR_MANIFEST_CL- Depending on your dbt project size, creating column-lineage can take a while (hours)
- Run the Server:
- If your desired MCP client (Claude desktop, Cursor, etc.) supports mcp.json it would look as below:
{ "mcpServers": { "DBT Docs MCP": { "command": "uv", "args": [ "run", "--with", "networkx,mcp[cli],rapidfuzz,dbt-core,python-decouple,sqlglot,tqdm", "mcp", "run",
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"DBT Docs MCP": {
"command": "uv",
"args": [
"run",
"--with",
"networkx,mcp[cli],rapidfuzz,dbt-core,python-decouple,sqlglot,tqdm",
"mcp",
"run",
"/Users/mattijs/repos/dbt-docs-mcp/src/mcp_server.py"
],
"env": {
"MANIFEST_PATH": "/Users/mattijs/repos/dbt-docs-mcp/inputs/manifest.json",
"SCHEMA_MAPPING_PATH": "/Users/mattijs/repos/dbt-docs-mcp/outputs/schema_mapping.json",
"MANIFEST_CL_PATH": "/Users/mattijs/repos/dbt-docs-mcp/outputs/manifest_column_lineage.json"
}
}
}
}