A MCP (Model Context Protocol) server for interacting with dbt.
This MCP (Model Context Protocol) server provides tools to interact with dbt. Read this blog to learn more.
Want to get going quickly?
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/dbt-labs/dbt-mcp/refs/heads/main/install.sh)"
The installer also serves as an updater, simply run it again and it will detect your exisiting dbt-mcp installation and offers to update it.
The MCP server takes the following configuration:
Name | Default | Description |
---|---|---|
DISABLE_DBT_CLI | false | Set this to true to disable dbt Core and dbt Cloud CLI MCP tools |
DISABLE_SEMANTIC_LAYER | false | Set this to true to disable dbt Semantic Layer MCP objects |
DISABLE_DISCOVERY | false | Set this to true to disable dbt Discovery API MCP objects |
DISABLE_REMOTE | true | Set this to false to enable remote MCP objects |
Name | Default | Description |
---|---|---|
DBT_HOST | cloud.getdbt.com | Your 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 Service token is required when using the Semantic Layer |
DBT_PROD_ENV_ID | - | Your dbt Cloud production environment ID |
Name | Description |
---|---|
DBT_DEV_ENV_ID | Your dbt Cloud development environment ID |
DBT_USER_ID | Your dbt Cloud user ID |
Name | Description |
---|---|
DBT_PROJECT_DIR | The path to your dbt Project |
DBT_PATH | The path to your dbt Core or dbt Cloud CLI executable. You can find your dbt executable by running which dbt |
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 <>
:
If you used the installation script, the mcp server has been installed in your user directory at ~/.dbt-mcp/
.
{
"mcpServers": {
"dbt-mcp": {
"command": "/Users/<YOUR USERNAME>/.dbt-mcp/.venv/bin/mcp",
"args": [
"run",
"/Users/<YOUR USERNAME>/.dbt-mcp/.venv/lib/python3.12/site-packages/dbt_mcp/main.py"
],
"env": {
// see config above
// "DBT_HOST": "cloud.getdbt.com"
// "DBT_TOKEN": "dbtu_...."
}
}
}
}
<path-to-mcp-executable>
depends on your OS:
<path-to-this-directory>/.venv/bin/mcp
<path-to-this-directory>/.venv/Scripts/mcp
Follow these instructions to create the claude_desktop_config.json
file and connect.
On Mac, you can find the Claude Desktop logs at ~/Library/Logs/Claude
.
mcp.json
fileCursor MCP docs here for reference
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 workspaceUser
- configures the server in the context of your userSelect Features → Chat
Ensure that "Mcp" is Enabled
Click "Edit in settings.json" under "Mcp > Discovery"
Add your server configuration (dbt
) to the provided settings.json
file as one of the servers:
{
"mcp": {
"inputs": [],
"servers": {
"dbt": {
"command": "<path-to-mcp-executable>",
"args": ["run", "<path-to-this-directory>/src/dbt_mcp/main.py"]
}
}
}
}
<path-to-mcp-executable>
depends on your OS:
<path-to-this-directory>/.venv/bin/mcp
<path-to-this-directory>/.venv/Scripts/mcp
MCP: List Servers
command from the Command Palette (Control + Command + P) and selecting the serversettings.json
fileVS Code MCP docs here for reference
build
- Executes models, tests, snapshots, and seeds in dependency ordercompile
- Generates executable SQL from models, tests, and analyses without running themdocs
- Generates documentation for the dbt projectls
(list) - Lists resources in the dbt project, such as models and testsparse
- Parses and validates the project’s files for syntax correctnessrun
- Executes models to materialize them in the databasetest
- Runs tests to validate data and model integrityshow
- Runs a query against the data warehouseAllowing 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.
list_metrics
- Retrieves all defined metricsget_dimensions
- Gets dimensions associated with specified metricsget_entities
- Gets entities associated with specified metricsquery_metrics
- Queries metrics with optional grouping, ordering, filtering, and limitingget_mart_models
- Gets all mart modelsget_all_models
- Gets all modelsget_model_details
- Gets details for a specific modelget_model_parents
- Gets parent models of a specific modelRead CONTRIBUTING.md
for instructions on how to get involved!