Sponsored by Deepsite.site

dbt MCP Server

Created By
dbt-labs10 months ago
A MCP (Model Context Protocol) server for interacting with dbt.
Content

dbt MCP Server

This MCP (Model Context Protocol) server provides tools to interact with dbt. Read this blog to learn more.

Architecture

architecture diagram of the dbt MCP server

Setup

  1. Install uv
  2. Copy the .env.example file locally under a file called .env and set it with your specific environment variables (see the Configuration section of the README.md)

Configuration

The MCP server takes the following environment variable configuration:

Tool Groups

NameDefaultDescription
DISABLE_DBT_CLIfalseSet this to true to disable dbt Core and dbt Cloud CLI MCP tools
DISABLE_SEMANTIC_LAYERfalseSet this to true to disable dbt Semantic Layer MCP objects
DISABLE_DISCOVERYfalseSet this to true to disable dbt Discovery API MCP objects
DISABLE_REMOTEtrueSet this to false to enable remote MCP objects

Configuration for Discovery, Semantic Layer, and Remote Tools

NameDefaultDescription
DBT_HOSTcloud.getdbt.comYour dbt Cloud instance hostname. This will look like an Access URL found here. If you are using Multi-cell, do not include the ACCOUNT_PREFIX here
MULTICELL_ACCOUNT_PREFIX-If you are using Multi-cell, set this to your ACCOUNT_PREFIX. If you are not using Multi-cell, do not set this environment variable. You can learn more here
DBT_TOKEN-Your personal access token or service token. Note: a service token is required when using the Semantic Layer and this service token should have at least Semantic Layer Only, Metadata Only, and Developer permissions.
DBT_PROD_ENV_ID-Your dbt Cloud production environment ID

Configuration for Remote Tools

NameDescription
DBT_DEV_ENV_IDYour dbt Cloud development environment ID
DBT_USER_IDYour dbt Cloud user ID

Configuration for dbt CLI

NameDescription
DBT_PROJECT_DIRThe path to where the repository of your dbt Project is hosted locally. This should look something like /Users/firstnamelastname/reponame
DBT_PATHThe path to your dbt Core or dbt Cloud CLI executable. You can find your dbt executable by running which dbt

Using with MCP Clients

After going through Installation, you can use your server with an MCP client.

This configuration will be added to the respective client's config file. Be sure to replace the sections within <>:

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

<path-to-.env-file> is where you saved the .env file from the Setup step

Claude Desktop

Follow these instructions to create the claude_desktop_config.json file and connect.

You can find the Claude Desktop logs at ~/Library/Logs/Claude for Mac or %APPDATA%\Claude\logs for Windows.

Cursor

  1. Open the Cursor menu and select Settings → Cursor Settings → MCP
  2. Click "Add new global MCP server"
  3. Add the config from above to the provided mcp.json file
  4. Verify your connection is active within the MCP tab

Cursor MCP docs here for reference

VS Code

  1. Open the Settings menu (Command + Comma) and select the correct tab atop the page for your use case

    • Workspace - configures the server in the context of your workspace
    • User - configures the server in the context of your user
    • Note for WSL users: If you're using VS Code with WSL, you'll need to configure WSL-specific settings. Run the Preferences: Open Remote Settings command from the Command Palette (F1) or select the Remote tab in the Settings editor. Local User settings are reused in WSL but can be overridden with WSL-specific settings. Configuring MCP servers in the local User settings will not work properly in a WSL environment.
  2. Select Features → Chat

  3. Ensure that "Mcp" is Enabled

mcp-vscode-settings

  1. Click "Edit in settings.json" under "Mcp > Discovery"

  2. Add your server configuration (dbt) to the provided settings.json file as one of the servers:

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

<path-to-.env-file> is where you saved the .env file from the Setup step

  1. You can start, stop, and configure your MCP servers by:
  • Running the MCP: List Servers command from the Command Palette (Control + Command + P) and selecting the server
  • Utlizing the keywords inline within the settings.json file

inline-management

VS Code MCP docs here for reference

Tools

dbt CLI

  • build - Executes models, tests, snapshots, and seeds in dependency order
  • compile - Generates executable SQL from models, tests, and analyses without running them
  • docs - Generates documentation for the dbt project
  • ls (list) - Lists resources in the dbt project, such as models and tests
  • parse - Parses and validates the project’s files for syntax correctness
  • run - Executes models to materialize them in the database
  • test - Runs tests to validate data and model integrity
  • show - Runs a query against the data warehouse

Allowing your client to utilize dbt commands through this MCP tooling could modify your data models, sources, and warehouse objects. Proceed only if you trust the client and understand the potential impact.

Semantic Layer

  • list_metrics - Retrieves all defined metrics
  • get_dimensions - Gets dimensions associated with specified metrics
  • get_entities - Gets entities associated with specified metrics
  • query_metrics - Queries metrics with optional grouping, ordering, filtering, and limiting

Discovery

  • get_mart_models - Gets all mart models
  • get_all_models - Gets all models
  • get_model_details - Gets details for a specific model
  • get_model_parents - Gets parent nodes of a specific model
  • get_model_children - Gets children modes of a specific model

Remote

  • text_to_sql - Generate SQL from natural language requests
  • execute_sql - Execute SQL on dbt Cloud's backend infrastructure with support for Semantic Layer SQL syntax.

Contributing

Read CONTRIBUTING.md for instructions on how to get involved!

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
ChatWiseThe second fastest AI chatbot™
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server