Connect dbt MCP to dbt platform
This quickstart uses the local MCP server: it runs on your machine using uvx dbt-mcp, connects to your dbt platform for Semantic Layer, Discovery, and SQL, and optionally runs local dbt CLI. For local CLI only (with or without a dbt platform account), see Run dbt locally. To configure or disable specific tools, see the Environment variables reference. Choose OAuth (available for Enterprise and Enterprise+ accounts) or Tokens (more control, better for shared setups).
Prerequisites
Step 1: Choose your auth method and configure
- OAuth
- Tokens
OAuth is the fastest setup for dbt platform Enterprise and Enterprise+ accounts — no tokens to copy or manage. A browser window opens to authenticate the first time you connect.
OAuth is currently available with the local MCP server only. For remote MCP server setups, use token-based authentication.
Only accounts with static subdomains (for example, abc123 in abc123.us1.dbt.com) can use OAuth with MCP servers. Follow these instructions to find your account subdomain. If your account does not have a subdomain, contact support for more information.
Find your Access URL
- Log in to your dbt platform account.
- Go to Account settings and copy your Access URL (for example,
abc123.us1.dbt.com).
-
The
DBT_HOSTfield accepts bothabc123.us1.dbt.comandhttps://abc123.us1.dbt.com. -
If your Access URL is
abc123.us1.dbt.com, split it into two variables:DBT_HOST=us1.dbt.comMULTICELL_ACCOUNT_PREFIX=abc123Don't include the account prefix inDBT_HOST. For more details, see multi-cell configuration examples.
Add the config to your MCP client
- Claude Desktop
- Claude Code
- Cursor
- VS Code
Option A: Quick install (recommended)
- Go to the latest dbt MCP release and download
dbt-mcp.mcpb. - Double-click the file to open it in Claude Desktop.
- Enter your Access URL as the dbt platform Host.
- Enable the server.
Option B: Manual config
- In Claude Desktop, go to Settings → Developer tab → Edit Config.
- Paste the following configuration, replacing
YOUR-ACCESS-URLwith your Access URL:
{
"mcpServers": {
"dbt": {
"command": "uvx",
"args": ["dbt-mcp"],
"env": {
"DBT_HOST": "YOUR-ACCESS-URL"
}
}
}
}
- Save and restart Claude Desktop.
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Run this command, replacing YOUR-ACCESS-URL with your Access URL:
claude mcp add dbt \
-e DBT_HOST=YOUR-ACCESS-URL \
-- uvx dbt-mcp
For example, if your Access URL is abc123.us1.dbt.com:
claude mcp add dbt \
-e DBT_HOST=abc123.us1.dbt.com \
-- uvx dbt-mcp
Click a link below with Cursor open to auto-configure, then replace the placeholder with your Access URL:
- dbt platform only (OAuth) — platform features only, no CLI
- dbt platform + CLI (OAuth) — platform features + local CLI commands
After clicking, replace YOUR-ACCESS-URL with your actual Access URL (for example, abc123.us1.dbt.com) and save.
- Open Settings → Features → Chat and ensure MCP is enabled.
- Open the Command Palette (
Ctrl/Cmd + Shift + P) and select MCP: Open User Configuration. - Add the following configuration to
mcp.json:
"servers", not "mcpServers"{
"servers": {
"dbt": {
"command": "uvx",
"args": ["dbt-mcp"],
"env": {
"DBT_HOST": "YOUR-ACCESS-URL"
}
}
}
}
Replace YOUR-ACCESS-URL with your Access URL (for example, abc123.us1.dbt.com) and save.
Optional: Add local CLI commands
To also run dbt CLI commands (dbt run, dbt build, dbt test, and more), add these two variables to your env block:
"DBT_PROJECT_DIR": "/path/to/your/dbt/project",
"DBT_PATH": "/path/to/your/dbt/executable"
Find DBT_PATH by running which dbt (macOS/Linux) or where dbt (Windows). DBT_PROJECT_DIR is the folder containing your dbt_project.yml.
Token-based auth gives you more control and is better for shared or team setups. You'll need a service token or Personal Access Token (PAT).
- PAT (Personal Access Token): Required if you want to use
execute_sql. Tied to your user account. - Service token: Works for all other platform toolsets. Better for shared or team setups.
See Choosing an auth method for full guidance.
Find your paths and IDs
You need the following values. See Finding your IDs for step-by-step instructions.
| Loading table... |
These variables expect hostnames or numeric IDs — not full URLs:
# ✅ Correct
DBT_HOST=cloud.getdbt.com # https://cloud.getdbt.com also works
DBT_PROD_ENV_ID=54321
DBT_USER_ID=123
# ❌ Wrong — IDs must be numeric, not full URLs
DBT_PROD_ENV_ID=https://cloud.getdbt.com/deploy/12345/projects/67890/environments/54321
DBT_USER_ID=https://cloud.getdbt.com/settings/profile
If your Access URL is abc123.us1.dbt.com, split it into two variables:
DBT_HOST=us1.dbt.comMULTICELL_ACCOUNT_PREFIX=abc123
Don't include the account prefix in DBT_HOST. For more details, see multi-cell configuration examples.
Add the config to your MCP client
Use the configuration below, replacing the placeholder values with your IDs from above. Include only the variables you need:
- Claude Desktop
- Claude Code
- Cursor
- VS Code
- In Claude Desktop, go to Settings → Developer tab → Edit Config.
- Paste the following configuration, replacing the placeholder values:
{
"mcpServers": {
"dbt": {
"command": "uvx",
"args": ["dbt-mcp"],
"env": {
"DBT_HOST": "cloud.getdbt.com",
"DBT_TOKEN": "your-token-here",
"DBT_PROD_ENV_ID": "12345",
"DBT_DEV_ENV_ID": "67890",
"DBT_USER_ID": "123",
"DBT_ACCOUNT_ID": "99999"
}
}
}
}
- Save and restart Claude Desktop.
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Run this command, replacing the placeholders with your actual values:
claude mcp add dbt \
-e DBT_HOST=cloud.getdbt.com \
-e DBT_TOKEN=your-token-here \
-e DBT_PROD_ENV_ID=12345 \
-- uvx dbt-mcp
Add -e DBT_DEV_ENV_ID=... and -e DBT_USER_ID=... if you use execute_sql; add -e DBT_ACCOUNT_ID=... for Admin API.
- In Cursor, open Settings → MCP → Edit config (or your config file).
- Paste the following configuration, replacing the placeholder values:
{
"mcpServers": {
"dbt": {
"command": "uvx",
"args": ["dbt-mcp"],
"env": {
"DBT_HOST": "cloud.getdbt.com",
"DBT_TOKEN": "your-token-here",
"DBT_PROD_ENV_ID": "12345",
"DBT_DEV_ENV_ID": "67890",
"DBT_USER_ID": "123",
"DBT_ACCOUNT_ID": "99999"
}
}
}
}
- Save the configuration.
- Open Settings → Features → Chat and ensure MCP is enabled.
- Open the Command Palette (
Ctrl/Cmd + Shift + P) and select MCP: Open User Configuration. - Add the following configuration to
mcp.json:
"servers", not "mcpServers"{
"servers": {
"dbt": {
"command": "uvx",
"args": ["dbt-mcp"],
"env": {
"DBT_HOST": "cloud.getdbt.com",
"DBT_TOKEN": "your-token-here",
"DBT_PROD_ENV_ID": "12345",
"DBT_DEV_ENV_ID": "67890",
"DBT_USER_ID": "123",
"DBT_ACCOUNT_ID": "99999"
}
}
}
}
- Save
mcp.jsonand restart VS Code.
Step 2: Authenticate
- OAuth
- Tokens
The first time you connect, dbt MCP opens a browser window to complete OAuth. After signing in, your session is saved and future connections are automatic.
If authentication doesn't start, close your client and run:
- macOS/Linux:
rm -f ~/.dbt/mcp.yml ~/.dbt/mcp.lock - Windows:
Remove-Item -Force $env:USERPROFILE\.dbt\mcp.yml, $env:USERPROFILE\.dbt\mcp.lock
Then restart your client.
No additional authentication step is needed — your token is already in the configuration. The server connects automatically when your MCP client starts.
Step 3: Test your setup
Ask your AI assistant a data-related question (for example, "What models are in my dbt project?" or "What metrics are defined in my Semantic Layer?"). If dbt MCP is working, the response will use your dbt metadata.
What's available
With the platform setup, your AI assistant can use:
- Semantic Layer queries
- Metadata Discovery (model lineage, test results, source freshness)
- Admin API (trigger jobs, list runs, get artifacts)
- SQL execution and text-to-SQL (requires a PAT)
- All dbt CLI commands if you added
DBT_PROJECT_DIRandDBT_PATH
For the complete tool list, see Available tools.
If you only need to run dbt commands locally (with or without a dbt platform account), see Run dbt locally.
Troubleshooting
For all troubleshooting topics, see MCP troubleshooting.
Next steps
- Run dbt commands locally: see Run dbt locally
- Configure specific toolsets: see the Environment variables reference
- Understand toolset requirements: see Set up local MCP
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.