The dbt MCP server enables communication between dbt and MCP-compatible AI tools, providing access to dbt commands, Semantic Layer metrics, and Discovery API functionalities through a standardized protocol.
Install uv, a Python package manager:
# Follow instructions at https://docs.astral.sh/uv/getting-started/installation/
Set up your environment file:
# Create a .env file based on the template
cp .env.example .env
# Edit the .env file with your specific configuration
Name | Default | Description |
---|---|---|
DISABLE_DBT_CLI |
false |
Set to true to disable dbt Core, Cloud CLI, and Fusion MCP tools |
DISABLE_SEMANTIC_LAYER |
false |
Set to true to disable Semantic Layer MCP objects |
DISABLE_DISCOVERY |
false |
Set to true to disable Discovery API MCP objects |
DISABLE_REMOTE |
true |
Set to false to enable remote MCP objects |
Name | Default | Description |
---|---|---|
DBT_HOST |
cloud.getdbt.com |
Your dbt Cloud instance hostname |
MULTICELL_ACCOUNT_PREFIX |
- | For Multi-cell users only, set to your account prefix |
DBT_TOKEN |
- | Personal access token or service token (service token required for 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 |
Path to your local dbt Project repository |
DBT_PATH |
Path to your dbt executable (find with which dbt ) |
After completing the setup, you can connect the server to various MCP clients using the configuration below. Replace <path-to-.env-file>
with the actual path to your .env
file:
{
"mcpServers": {
"dbt-mcp": {
"command": "uvx",
"args": [
"--env-file",
"<path-to-.env-file>",
"dbt-mcp"
]
}
}
}
claude_desktop_config.json
file following the instructions at https://modelcontextprotocol.io/quickstart/userClaude Desktop logs can be found at:
~/Library/Logs/Claude
%APPDATA%\Claude\logs
Use the configuration options detailed above and connect your dbt MCP server through Cursor's interface.
{
"mcp": {
"inputs": [],
"servers": {
"dbt": {
"command": "uvx",
"args": [
"--env-file",
"<path-to-.env-file>",
"dbt-mcp"
]
}
}
}
}
If an MCP client cannot find uvx
, try using the full path:
which uvx # Find the full path
Then use this full path in your configuration:
"command": "/the/full/path/to/uvx"
Note: Using dbt commands can modify your data models and warehouse objects.
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