# dbt MCP server

> Give assistants dbt project context: models, lineage, Semantic Layer metrics, Discovery API data and dbt CLI commands.

- Listing: https://mcp.tc/i/dbt
- Connect: this is a local (stdio) server; install it on your machine (see Install). The listing link is a page, not an MCP endpoint.
- Type: local (stdio)
- Auth: optional (works without sign-in)
- Category: [Databases & Backend](https://mcp.tc/c/databases)
- Vendor: dbt Labs
- Homepage: <https://docs.getdbt.com/docs/dbt-ai/about-mcp>
- Docs: <https://docs.getdbt.com/docs/dbt-ai/about-mcp>
- Repository: <https://github.com/dbt-labs/dbt-mcp>
- Package: pypi `dbt-mcp`

## About

Connects an AI assistant to dbt Core, dbt Fusion and the dbt platform. It can list models, sources and exposures, trace lineage, query Semantic Layer metrics, run dbt CLI commands, generate YAML and staging models, manage platform jobs and runs, and fetch pages from the dbt docs.

It runs locally over stdio with uvx dbt-mcp. The CLI tools need DBT\_PROJECT\_DIR and DBT\_PATH. Semantic Layer, Discovery, Admin API and SQL tools need a dbt platform host (DBT\_HOST) and a token (DBT\_TOKEN). CLI commands such as run and build can modify warehouse objects, so use them only with a client you trust.

## What it can do

- Query Semantic Layer metrics, dimensions and entities
- Browse models, sources, macros and exposures via the Discovery API
- Trace model and column-level lineage
- Run dbt build, run, test, compile and show from the CLI
- Generate source YAML, model YAML and staging models
- List, trigger, retry and cancel dbt platform jobs and runs
- Search and fetch official dbt documentation pages

## Example prompts

- "List all metrics defined in our dbt Semantic Layer"
- "Show the upstream and downstream lineage of the orders model"
- "Run dbt test for the staging models and summarize failures"
- "Generate staging model SQL for the raw customers source table"

## Install

### Claude Code

1. Run this in a terminal, in your project folder:

```bash
claude mcp add --transport stdio dbt --env "DBT_PROJECT_DIR=<YOUR_DBT_PROJECT_DIR>" --env "DBT_PATH=<YOUR_DBT_PATH>" -- uvx dbt-mcp
```

2. Start Claude Code and type `/mcp`. **dbt** should show as connected.

Add `--scope user` to make it available in every project. Replace the placeholders with your own values.

### Claude Desktop

1. Open **Settings → Developer → Edit Config**. It opens `claude_desktop_config.json`. Add:

`claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "dbt": {
      "command": "uvx",
      "args": [
        "dbt-mcp"
      ],
      "env": {
        "DBT_PROJECT_DIR": "<YOUR_DBT_PROJECT_DIR>",
        "DBT_PATH": "<YOUR_DBT_PATH>"
      }
    }
  }
}
```

2. Save the file and restart Claude Desktop. Replace the placeholders with your own values.

Needs uv (Python) on your computer. The file lives in `~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows.

### Cursor

[Add to Cursor](<https://cursor.com/install-mcp?name=dbt&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJkYnQtbWNwIl0sImVudiI6eyJEQlRfUFJPSkVDVF9ESVIiOiI8WU9VUl9EQlRfUFJPSkVDVF9ESVI%2BIiwiREJUX1BBVEgiOiI8WU9VUl9EQlRfUEFUSD4ifX0%3D>) (opens Cursor)

Or add it by hand to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (this project):

`mcp.json`:

```json
{
  "mcpServers": {
    "dbt": {
      "command": "uvx",
      "args": [
        "dbt-mcp"
      ],
      "env": {
        "DBT_PROJECT_DIR": "<YOUR_DBT_PROJECT_DIR>",
        "DBT_PATH": "<YOUR_DBT_PATH>"
      }
    }
  }
}
```

Needs uv (Python) on your computer. Replace the placeholders with your own values.

### VS Code

[Install in VS Code](<https://vscode.dev/redirect/mcp/install?name=dbt&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22dbt-mcp%22%5D%2C%22env%22%3A%7B%22DBT_PROJECT_DIR%22%3A%22%3CYOUR_DBT_PROJECT_DIR%3E%22%2C%22DBT_PATH%22%3A%22%3CYOUR_DBT_PATH%3E%22%7D%7D>) (opens VS Code)

Or from a terminal:

```bash
code --add-mcp '{"name":"dbt","type":"stdio","command":"uvx","args":["dbt-mcp"],"env":{"DBT_PROJECT_DIR":"<YOUR_DBT_PROJECT_DIR>","DBT_PATH":"<YOUR_DBT_PATH>"}}'
```

Or commit it to the repo in `.vscode/mcp.json`:

`.vscode/mcp.json`:

```json
{
  "servers": {
    "dbt": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "dbt-mcp"
      ],
      "env": {
        "DBT_PROJECT_DIR": "<YOUR_DBT_PROJECT_DIR>",
        "DBT_PATH": "<YOUR_DBT_PATH>"
      }
    }
  }
}
```

Needs uv (Python) on your computer.

### Devin Desktop

1. Add it to `~/.config/devin/mcp_config.json` (macOS and Linux) or `%APPDATA%\devin\mcp_config.json` (Windows):

`mcp_config.json`:

```json
{
  "mcpServers": {
    "dbt": {
      "command": "uvx",
      "args": [
        "dbt-mcp"
      ],
      "env": {
        "DBT_PROJECT_DIR": "<YOUR_DBT_PROJECT_DIR>",
        "DBT_PATH": "<YOUR_DBT_PATH>"
      }
    }
  }
}
```

2. Refresh the MCP server list in Cascade. Replace the placeholders with your own values.

Devin Desktop is the new name for Windsurf.

### Codex

```bash
codex mcp add dbt --env "DBT_PROJECT_DIR=<YOUR_DBT_PROJECT_DIR>" --env "DBT_PATH=<YOUR_DBT_PATH>" -- uvx dbt-mcp
```

Or edit `~/.codex/config.toml` directly:

`config.toml`:

```toml
[mcp_servers.dbt]
command = "uvx"
args = ["dbt-mcp"]
env = { DBT_PROJECT_DIR = "<YOUR_DBT_PROJECT_DIR>", DBT_PATH = "<YOUR_DBT_PATH>" }
```

Needs uv (Python) on your computer. Replace the placeholders with your own values.

### Gemini CLI

```bash
gemini mcp add -e "DBT_PROJECT_DIR=<YOUR_DBT_PROJECT_DIR>" -e "DBT_PATH=<YOUR_DBT_PATH>" dbt uvx dbt-mcp
```

This adds it to the current project. Add `-s user` to use it everywhere.

### Any client

Most clients that start local servers accept this shape:

```json
{
  "mcpServers": {
    "dbt": {
      "command": "uvx",
      "args": [
        "dbt-mcp"
      ],
      "env": {
        "DBT_PROJECT_DIR": "<YOUR_DBT_PROJECT_DIR>",
        "DBT_PATH": "<YOUR_DBT_PATH>"
      }
    }
  }
}
```

Zed puts servers under `context_servers` in its settings, with the same `command`, `args` and `env` fields.

Needs uv (Python) on your computer. Replace the placeholders with your own values.

## Details

- Server version: 2.5.0
- Last checked: 2026-10-03
- Listed: 2026-10-03
- Updated: 2026-10-03

---
Source: https://mcp.tc/i/dbt (mcp.tc is an independent directory, not affiliated with this server's publisher). Corrections: https://mcp.tc/report
