dbt-mcp
CLAUDE.md607 starsChanged 9 months agoApache-2.0View on GitHub
dbt-mcp is an MCP (Model Context Protocol) server that exposes dbt functionality as tools to AI assistants. Built on FastMCP from the mcp SDK. Tools follow a consistent pattern: 1. @dbt_mcp_tool decorator defines the tool with metadata 2. ToolName enum in tools/tool_names.py — every tool needs an entry 3. Toolset mapping in tools/toolsets.py — maps tools to categories 4. Context injection via adapt_context() — tools receive typed context objects, but MCP only sees user-facing params 5. register_tools() in tools/register.py —…
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- release-dbt-mcpSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 49
This is an open-source repo: Do not include internal links (Notion, Slack, Jira) or internal details in PR descriptions, commit messages, …
- Very specific: line 50
Run task check before every PR push
- Very specific: line 51
Run task test:unit before every commit to catch failures early
- Distinctive: line 56
Import at top of file, type annotations on all functions
- Distinctive: line 57
Prefer Pydantic models or dataclasses over dicts
- Very specific: line 58
Use * in param lists when adjacent params share a type
- Very specific: line 59
Avoid code in __init__.py
- Very specific: line 63
Every PR requires a changelog entry.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Project Overview
dbt-mcp is an MCP (Model Context Protocol) server that exposes dbt functionality as tools to AI assistants. Built on FastMCP from the mcp SDK.
Key Paths
- Entry point:
src/dbt_mcp/main.py - Server:
src/dbt_mcp/mcp/server.py(DbtMCPclass,create_dbt_mcp()) - Tool infra:
src/dbt_mcp/tools/(definitions, registration, injection, toolsets, tool_names) - Tool categories:
discovery/,semantic_layer/,dbt_cli/,dbt_codegen/,dbt_admin/,lsp/,mcp_server_metadata/ - Prompts (tool descriptions):
src/dbt_mcp/prompts/ - Config:
src/dbt_mcp/config/ - Tests:
tests/unit/,tests/integration/
Tool Architecture
Tools follow a consistent pattern:
@dbt_mcp_tooldecorator defines the tool with metadataToolNameenum intools/tool_names.py— every tool needs an entry- Toolset mapping in
tools/toolsets.py— maps tools to categories - Context injection via
adapt_context()— tools receive typed context objects, but MCP only sees user-facing params register_tools()intools/register.py— precedence-based enablement (individual > toolset > default)
MCP Apps (tools with interactive UI)
Tools can have associated UIs via the meta field:
meta={"ui": {"resourceUri": "ui://dbt-mcp/app-name"}}on@dbt_mcp_toolstructured_output=Truerequired so the host can pass structured JSON to the UI- Return type should be a Pydantic model
- Register matching resource with
@dbt_mcp.resource(uri=..., mime_type="text/html;profile=mcp-app") - Frontend uses
@modelcontextprotocol/ext-appsSDK
Commands
task test:unit— run unit teststask test:integration— run integration tests (requires dbt Platform credentials)task install— install dependenciestask check— run linting and type checking. Run before every PR push.task fmt— format codetask docs:generate— regenerate README tool list and d2 diagram from tool definitions (run after adding/removing tools)task dev— run server with streamable-http transporttask inspector— run with MCP Inspectoruv run pytest tests/ --ignore=tests/integration -x -q— quick unit test run
PRs
- This is an open-source repo. Do not include internal links (Notion, Slack, Jira) or internal details in PR descriptions, commit messages, or code comments. Keep PR descriptions focused on the public-facing what and why.
- Run
task checkbefore every PR push - Run
task test:unitbefore every commit to catch failures early
Style
- See
CONTRIBUTING.mdfor Python conventions - Import at top of file, type annotations on all functions
- Prefer Pydantic models or dataclasses over dicts
- Use
*in param lists when adjacent params share a type - Avoid code in
__init__.py
Changelog
Every PR requires a changelog entry. Run changie new --kind "<kind>" --body "<description>" to create one.
Valid kinds: Breaking Change (major), Enhancement or New Feature (minor), Under the Hood (patch), Bug Fix (patch), Security (patch). See CONTRIBUTING.md for full contributing guidelines.
Testing
MockFastMCPintests/conftest.pycaptures registered tools and their kwargs (includingmeta)- Tool definition tests:
tests/unit/tools/test_definitions.py - Precedence logic tests:
tests/unit/tools/test_precedence.py
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

