The dbt MCP server provides a Model Context Protocol implementation for interacting with dbt projects, allowing integration with various AI clients through a standardized interface. It enables AI tools to access dbt functionality, query the Semantic Layer, and interact with dbt Cloud services.
Install uv, a Python packaging tool:
# Follow installation instructions at:
# https://docs.astral.sh/uv/getting-started/installation/
Set up configuration:
# Download the example configuration file
curl -O https://raw.githubusercontent.com/dbt-labs/dbt-mcp/main/.env.example
# Rename it to .env
mv .env.example .env
# Edit with your specific settings
nano .env
Name | Default | Description |
---|---|---|
DISABLE_DBT_CLI |
false |
Set to true to disable dbt Core/Cloud CLI/Fusion tools |
DISABLE_SEMANTIC_LAYER |
false |
Set to true to disable Semantic Layer tools |
DISABLE_DISCOVERY |
false |
Set to true to disable Discovery API tools |
DISABLE_REMOTE |
true |
Set to false to enable remote tools |
Name | Default | Description |
---|---|---|
DBT_HOST |
cloud.getdbt.com |
Your dbt Cloud instance hostname |
MULTICELL_ACCOUNT_PREFIX |
- | Your account prefix if using Multi-cell |
DBT_TOKEN |
- | Personal access token or service token |
DBT_PROD_ENV_ID |
- | Production environment ID |
Name | Description |
---|---|
DBT_DEV_ENV_ID |
Development environment ID |
DBT_USER_ID |
Your dbt Cloud user ID |
Name | Description |
---|---|
DBT_PROJECT_DIR |
Path to your local dbt project repository |
DBT_PATH |
Path to your dbt executable |
Add this to your MCP client's configuration file:
{
"mcpServers": {
"dbt-mcp": {
"command": "uvx",
"args": [
"--env-file",
"/path/to/your/.env",
"dbt-mcp"
]
}
}
}
claude_desktop_config.json
file following the instructions at https://modelcontextprotocol.io/quickstart/user~/Library/Logs/Claude
%APPDATA%\Claude\logs
{
"mcp": {
"inputs": [],
"servers": {
"dbt": {
"command": "uvx",
"args": [
"--env-file",
"/path/to/your/.env",
"dbt-mcp"
]
}
}
}
}
build
- Executes models, tests, snapshots, and seedscompile
- Generates SQL without executingdocs
- Generates project documentationls
- Lists project resourcesparse
- Validates project filesrun
- Executes modelstest
- Runs testsshow
- Runs queries against the warehouselist_metrics
- Retrieves all metricsget_dimensions
- Gets dimensions for metricsget_entities
- Gets entities for metricsquery_metrics
- Queries metrics with filters/groupingget_mart_models
- Gets all mart modelsget_all_models
- Gets all modelsget_model_details
- Gets details for a specific modelget_model_parents
- Gets parent nodesget_model_children
- Gets child nodestext_to_sql
- Generates SQL from natural languageexecute_sql
- Executes SQL on dbt Cloud's backendIf your MCP client can't find uvx
, use the full path:
"command": "/full/path/to/uvx"
Find this path with which uvx
on Unix systems.
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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