> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up dbt MCP Server

> Connect dbt Cloud's remote MCP server to TrueFoundry with account, environment, and token headers.

dbt's remote MCP server can query metrics through the Semantic Layer, inspect model metadata, and run SQL for dbt Cloud projects. Register it in TrueFoundry with the required dbt token and environment headers.

## Prerequisites

* A dbt Cloud account on Starter, Team, or Enterprise.
* Account Admin access in dbt Cloud.
* A production environment and, if you need `execute_sql`, a development environment.
* dbt AI features enabled for the account.

## Create a dbt Token

Use a Personal Access Token for individual access or when you need `execute_sql`. Use a service token for shared read access. Copy the token immediately after creation.

## Collect Required IDs

Find the numeric IDs from dbt Cloud URLs:

| Header                      | Value                                               |
| --------------------------- | --------------------------------------------------- |
| `x-dbt-prod-environment-id` | Production environment ID                           |
| `x-dbt-dev-environment-id`  | Development environment ID for SQL and Fusion tools |
| `x-dbt-user-id`             | User ID for SQL and Fusion tools                    |

## Register in TrueFoundry

Use the standard dbt MCP URL:

```txt theme={"dark"}
https://cloud.getdbt.com/api/ai/v1/mcp/
```

For multi-cell accounts, use your cell hostname, for example `https://abc123.us1.dbt.com/api/ai/v1/mcp/`.

Add it as a remote MCP server in TrueFoundry with bearer-token authentication. Configure the dbt token and the required `x-dbt-*` headers. If needed, add optional headers such as `x-dbt-disable-toolsets` or `x-dbt-disable-tools` to hide risky tools.

## Security Notes

PATs inherit the user's permissions, while service tokens use assigned permission sets. Rotate tokens regularly and disable `execute_sql` unless agents need direct SQL execution.
