# dbt (MCP Server)

> Give agents dbt project context, lineage, Semantic Layer metrics and CLI

- Type: MCP server
- Publisher: dbt Labs (official)
- Categories: Data & Analytics, Development
- Website: https://docs.getdbt.com/docs/dbt-ai/about-mcp
- Source: https://github.com/dbt-labs/dbt-mcp
- Transport: stdio
- Launch command: uvx dbt-mcp
- Sign-in: api-key
- GitHub stars: 608
- Listed: 2025-03-12

## About

dbt Labs' official MCP server exposes dbt project metadata, lineage and model details, Semantic Layer metric queries, SQL generation and execution, and dbt CLI commands such as run, build and test. The self-hosted server runs locally with uvx dbt-mcp and works with dbt Core, Fusion and the dbt platform; a remote server hosted by dbt is also available for dbt platform accounts.

## Install

1. **Add the server to Codex**

   Codex CLI:

   ```bash
   codex mcp add dbt -- uvx dbt-mcp
   ```

   config.toml:

   ```toml
   [mcp_servers.dbt]
   command = "uvx"
   args = ["dbt-mcp"]
   ```

   Agents SDK:

   ```python
   from agents import Agent, Runner
   from agents.mcp import MCPServerStdio
   
   async with MCPServerStdio(
       name="dbt",
       params={"command": "uvx", "args": ["dbt-mcp"]},
   ) as server:
       agent = Agent(name="Assistant", mcp_servers=[server])
       result = await Runner.run(agent, "Which models depend on stg_orders?")
       print(result.final_output)
   ```

## Tools

- `execute_sql`
- `text_to_sql`
- `list_metrics`
- `query_metrics`
- `get_dimensions`
- `get_all_models`
- `get_model_details`
- `get_model_parents`
- `get_model_children`
- `get_lineage`
- `get_model_health`

## Example prompts

- "Which models depend on stg_orders?"
- "Query the revenue metric by month for the last year"
- "Run dbt build for the marketing models and summarize failures"
- "Which models have failing tests or stale sources?"

## Related

- [Chrome DevTools MCP](https://chatgptplugins.directory/mcp/chrome-devtools.md): Let coding agents control and debug a live Chrome browser
- [Playwright MCP](https://chatgptplugins.directory/mcp/playwright.md): Browser automation for agents via Playwright accessibility snapshots
- [GitHub](https://chatgptplugins.directory/mcp/github.md): Manage repos, issues, pull requests and Actions from your AI agent
- [Context7](https://chatgptplugins.directory/mcp/context7.md): Pull up-to-date, version-specific library docs into your coding agent
- [Supabase](https://chatgptplugins.directory/mcp/supabase.md): Manage Supabase databases, migrations, edge functions and logs
- [Stripe](https://chatgptplugins.directory/mcp/stripe.md): Query and act on your Stripe account and search Stripe docs from any agent

---
Source: https://chatgptplugins.directory/mcp/dbt · Index: https://chatgptplugins.directory/llms.txt · Independent and community-run. Not affiliated with or endorsed by OpenAI. ChatGPT is a trademark of OpenAI.
