Supercharge Your Data Workflow: A Deep Dive into the dbt MCP Server
Unlock the full potential of dbt with the dbt MCP (Model Context Protocol) Server. This powerful tool acts as a central hub, enabling seamless interaction with your dbt projects from various MCP clients. In this guide, we'll explore how to install, configure, and leverage the dbt MCP Server to streamline your data workflows and boost productivity.
What is the dbt MCP Server and Why Should You Care?
The dbt MCP Server acts as a bridge, allowing tools like Claude Desktop, Cursor, and VS Code to interact directly with your dbt Core or dbt Cloud projects. This integration unlocks powerful features like:
- Enhanced Data Discovery: Easily find and understand your data models.
- Simplified dbt Command Execution: Run dbt commands directly from your preferred IDE.
- Streamlined Semantic Layer Interaction: Query metrics and dimensions with ease.
Essentially, the dbt MCP Server centralizes your dbt interactions, saving you time and effort.
Quick Start: Installation in a Flash
Ready to get started? Installation is a breeze with this one-line command:
This script handles everything for you. Running it again will also update your existing dbt MCP installation, keeping you up-to-date with the latest features.
Configuration: Tailoring the Server to Your Needs
The real power of the dbt MCP server lies in its configurability. Environment variables allow you to customize its behavior to match your specific dbt setup. Here's a breakdown:
DISABLE_DBT_CLI
: Set totrue
to disable dbt Core and dbt Cloud CLI objects.DISABLE_SEMANTIC_LAYER
: Set totrue
to disable dbt Semantic Layer MCP objects.DISABLE_DISCOVERY
: Set totrue
to disable dbt Discovery API MCP objects.DISABLE_REMOTE
: Set tofalse
to enable remote MCP objects. (Disabled by default).DBT_HOST
: Your dbt Cloud instance hostname (Access URL).MULTICELL_ACCOUNT_PREFIX
: Your Multi-cell account prefix (if applicable).DBT_PROD_ENV_ID
: Your dbt Cloud production environment ID.DBT_DEV_ENV_ID
: Your dbt Cloud development environment ID.DBT_USER_ID
: Your dbt Cloud user ID.DBT_TOKEN
: Your personal access token or service token (required for the Semantic Layer).DBT_PROJECT_DIR
: The path to your dbt project directory.DBT_PATH
: The path to your dbt Core or dbt Cloud CLI executable (find it usingwhich dbt
).DBT_EXECUTABLE_TYPE
: Set tocore
ifDBT_PATH
points to dbt Core. Otherwise, dbt Cloud CLI is assumed.
Proper configuration is key to unlocking the full potential of the MCP Server.
Unleash the Power: Integrating with MCP Clients
Once set up, integrating with your favorite MCP clients is straightforward. Here’s how to connect with some popular options:
Claude Desktop
Follow the instructions to create the claude_desktop_config.json
file and connect. You can find Claude Desktop logs on Mac at ~/Library/Logs/Claude
.
Cursor
- Open the Cursor menu and select Settings → Cursor Settings → MCP.
- Click "Add new global MCP server".
- Add the configuration below to the
mcp.json
file. - Verify that your connection is active in the MCP tab.
Cursor Configuration
- Linux & Mac:
<path-to-this-directory>/.venv/bin/mcp
- PC:
<path-to-this-directory>/.venv/Scripts/mcp
See the Cursor MCP docs for more information, replace with the actual URL.
VS Code
- Open the Settings menu (Command + Comma) and choose the appropriate tab: Workspace or User.
- Navigate to Features → Chat.
- Ensure that "Mcp" is enabled.
- Click "Edit in settings.json" under "Mcp > Discovery".
- Add your server configuration to the
settings.json
file:
VS Code Configuration
- Linux & Mac:
<path-to-this-directory>/.venv/bin/mcp
- PC:
<path-to-this-directory>/.venv/Scripts/mcp
You can manage your MCP servers by using the MCP: List Servers command from the Command Palette (Control + Command + P) or by utilizing keywords within the settings.json
file. Consult the VS Code MCP docs for details, replace with the actual URL.
Available Tools: dbt CLI, Semantic Layer, and Discovery
The dbt MCP Server provides access to a range of powerful tools:
-
dbt CLI: Execute core dbt commands such as
build
,compile
,docs
,ls
(list),parse
,run
,test
, andshow
directly from integrated clients.- Important Note: Be cautious when allowing clients to execute dbt commands, as they can modify your data models and warehouse objects. Only proceed with trusted clients.
-
Semantic Layer: Interact with your dbt Semantic Layer, enabling you to
list_metrics
,get_dimensions
,get_entities
, andquery_metrics
. -
Discovery: Explore your dbt project with commands like
get_mart_models
,get_all_models
,get_model_details
, andget_model_parents
.
Get Involved: Contributing to the Project
The dbt MCP Server is an open-source project actively seeking contributions. Check out the [CONTRIBUTING.md](link to contributing.md) file for instructions on how to contribute and help improve the tool.
By following these steps, you can leverage the dbt MCP Server to revolutionize your data workflows, enhance your productivity, and gain deeper insights into your dbt projects.