dbt MCP server

Provides a bridge between dbt (data build tool) resources and natural language interfaces, enabling execution of CLI commands, discovery of model metadata, and querying of the Semantic Layer for data transformation management.
Back to servers
Setup instructions
Provider
dbt Labs
Release date
Apr 28, 2025
Language
Python
Package
Stats
20.1K downloads
313 stars

The dbt MCP Server provides a seamless integration between dbt and AI assistants through Model Context Protocol (MCP), allowing you to interact with your dbt projects directly from supported MCP clients like Claude Desktop, Cursor, and VS Code.

Installation

Prerequisites

  1. Install uv (the Python package manager):
# Follow the installation instructions at
# https://docs.astral.sh/uv/getting-started/installation/

Setup Process

  1. Create your configuration file:
# Copy the example .env file to your local environment
# and customize it with your specific settings
  1. Configure your environment variables in the .env file according to the tools you'll be using:

Configuration Options

Tool Groups

Variable Description
DISABLE_DBT_CLI Set to true to disable dbt Core, Cloud CLI, and Fusion tools
DISABLE_SEMANTIC_LAYER Set to true to disable Semantic Layer MCP objects
DISABLE_DISCOVERY Set to true to disable Discovery API MCP objects
DISABLE_REMOTE Set to false to enable remote MCP objects (disabled by default)

Discovery, Semantic Layer, and Remote Configuration

Variable Description
DBT_HOST Your dbt Cloud instance hostname (default: cloud.getdbt.com)
MULTICELL_ACCOUNT_PREFIX Required only for Multi-cell setups
DBT_TOKEN Your personal or service token (service token recommended)
DBT_PROD_ENV_ID Your dbt Cloud production environment ID

Remote Tools Configuration

Variable Description
DBT_DEV_ENV_ID Your dbt Cloud development environment ID
DBT_USER_ID Your dbt Cloud user ID

dbt CLI Configuration

Variable Description
DBT_PROJECT_DIR Path to your local dbt project repository
DBT_PATH Path to your dbt executable (find with which dbt)
DBT_CLI_TIMEOUT Timeout in seconds for dbt CLI commands (default: 10)

Client Configuration

General Configuration

Add this to your MCP client configuration file (replace the path accordingly):

{
  "mcpServers": {
    "dbt-mcp": {
      "command": "uvx",
      "args": [
        "--env-file",
        "/path/to/your/.env/file",
        "dbt-mcp"
      ]
    }
  }
}

Client-Specific Setup

Claude Desktop

  1. Follow the quickstart instructions at modelcontextprotocol.io to create the configuration file.
  2. Add the dbt-mcp server configuration.

Logs can be found at:

  • Mac: ~/Library/Logs/Claude
  • Windows: %APPDATA%\Claude\logs

Cursor

Configure your environment variables and use the provided installation link on the Cursor website.

VS Code

  1. Open Settings (Command + Comma)
  2. Choose Workspace or User tab
  3. Go to Features → Chat and enable "Mcp"
  4. Open the command palette (Ctrl/Cmd + Shift + P)
  5. Select "MCP: Open Workspace Folder MCP Configuration" or "MCP: Open User Configuration"
  6. Add the server configuration to the mcp.json file:
{
  "servers": {
    "dbt": {
      "command": "uvx",
      "args": [
        "--env-file",
        "/path/to/your/.env/file",
        "dbt-mcp"
      ]
    }
  }
}
  1. Manage servers using the "MCP: List Servers" command or inline keywords in mcp.json

Troubleshooting

If your MCP client can't find uvx, use the full path:

# Find the full path
which uvx

# Then use in config
"command": "/the/full/path/to/uvx"

Available Tools

dbt CLI Tools

  • build - Execute models, tests, snapshots, and seeds
  • compile - Generate SQL without running it
  • docs - Generate project documentation
  • ls - List project resources
  • parse - Validate project files
  • run - Execute and materialize models
  • test - Run data tests
  • show - Run warehouse queries

Semantic Layer Tools

  • list_metrics - Get all metrics
  • get_dimensions - Get dimensions for metrics
  • get_entities - Get entities for metrics
  • query_metrics - Query metrics with filters and grouping

Discovery Tools

  • get_mart_models - Get all mart models
  • get_all_models - Get all models
  • get_model_details - Get details for a specific model
  • get_model_parents - Get parent nodes
  • get_model_children - Get child nodes

Remote Tools

  • text_to_sql - Generate SQL from natural language
  • execute_sql - Execute SQL with Semantic Layer syntax support

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "dbt-mcp" '{"command":"uvx","args":["--env-file","<path-to-.env-file>","dbt-mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "dbt-mcp": {
            "command": "uvx",
            "args": [
                "--env-file",
                "<path-to-.env-file>",
                "dbt-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "dbt-mcp": {
            "command": "uvx",
            "args": [
                "--env-file",
                "<path-to-.env-file>",
                "dbt-mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later