The dbt MCP Server provides a seamless integration between dbt and AI assistants through Model Context Protocol (MCP), allowing you to interact with your dbt projects directly from supported MCP clients like Claude Desktop, Cursor, and VS Code.
# Follow the installation instructions at
# https://docs.astral.sh/uv/getting-started/installation/
# Copy the example .env file to your local environment
# and customize it with your specific settings
.env
file according to the tools you'll be using:Variable | Description |
---|---|
DISABLE_DBT_CLI |
Set to true to disable dbt Core, Cloud CLI, and Fusion tools |
DISABLE_SEMANTIC_LAYER |
Set to true to disable Semantic Layer MCP objects |
DISABLE_DISCOVERY |
Set to true to disable Discovery API MCP objects |
DISABLE_REMOTE |
Set to false to enable remote MCP objects (disabled by default) |
Variable | Description |
---|---|
DBT_HOST |
Your dbt Cloud instance hostname (default: cloud.getdbt.com ) |
MULTICELL_ACCOUNT_PREFIX |
Required only for Multi-cell setups |
DBT_TOKEN |
Your personal or service token (service token recommended) |
DBT_PROD_ENV_ID |
Your dbt Cloud production environment ID |
Variable | Description |
---|---|
DBT_DEV_ENV_ID |
Your dbt Cloud development environment ID |
DBT_USER_ID |
Your dbt Cloud user ID |
Variable | Description |
---|---|
DBT_PROJECT_DIR |
Path to your local dbt project repository |
DBT_PATH |
Path to your dbt executable (find with which dbt ) |
DBT_CLI_TIMEOUT |
Timeout in seconds for dbt CLI commands (default: 10) |
Add this to your MCP client configuration file (replace the path accordingly):
{
"mcpServers": {
"dbt-mcp": {
"command": "uvx",
"args": [
"--env-file",
"/path/to/your/.env/file",
"dbt-mcp"
]
}
}
}
Logs can be found at:
~/Library/Logs/Claude
%APPDATA%\Claude\logs
Configure your environment variables and use the provided installation link on the Cursor website.
{
"servers": {
"dbt": {
"command": "uvx",
"args": [
"--env-file",
"/path/to/your/.env/file",
"dbt-mcp"
]
}
}
}
If your MCP client can't find uvx
, use the full path:
# Find the full path
which uvx
# Then use in config
"command": "/the/full/path/to/uvx"
build
- Execute models, tests, snapshots, and seedscompile
- Generate SQL without running itdocs
- Generate project documentationls
- List project resourcesparse
- Validate project filesrun
- Execute and materialize modelstest
- Run data testsshow
- Run warehouse querieslist_metrics
- Get all metricsget_dimensions
- Get dimensions for metricsget_entities
- Get entities for metricsquery_metrics
- Query metrics with filters and groupingget_mart_models
- Get all mart modelsget_all_models
- Get all modelsget_model_details
- Get details for a specific modelget_model_parents
- Get parent nodesget_model_children
- Get child nodestext_to_sql
- Generate SQL from natural languageexecute_sql
- Execute SQL with Semantic Layer syntax supportTo 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