Skip to main content
Glama

dbt-mcp

Official
by dbt-labs

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DBT_HOSTNoYour dbt Cloud instance hostname. This will look like an 'Access URL'. If you are using Multi-cell, do not include the 'ACCOUNT_PREFIX' herecloud.getdbt.com
DBT_PATHNoThe path to your dbt Core or dbt Cloud CLI executable. You can find your dbt executable by running 'which dbt'
DBT_TOKENNoYour personal access token or service token. Service token is required when using the Semantic Layer
DBT_USER_IDNoYour dbt Cloud user ID
DBT_DEV_ENV_IDNoYour dbt Cloud development environment ID
DISABLE_REMOTENoSet this to 'false' to enable remote MCP objectstrue
DBT_PROD_ENV_IDNoYour dbt Cloud production environment ID
DBT_PROJECT_DIRNoThe path to your dbt Project
DISABLE_DBT_CLINoSet this to 'true' to disable dbt Core and dbt Cloud CLI MCP toolsfalse
DISABLE_DISCOVERYNoSet this to 'true' to disable dbt Discovery API MCP objectsfalse
DISABLE_SEMANTIC_LAYERNoSet this to 'true' to disable dbt Semantic Layer MCP objectsfalse
MULTICELL_ACCOUNT_PREFIXNoIf you are using Multi-cell, set this to your 'ACCOUNT_PREFIX'. If you are not using Multi-cell, do not set this environment variable.

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
list_metrics

List all metrics from the dbt Semantic Layer.

If the user is asking a data-related or business-related question, this tool should be used as a first step to get a list of metrics that can be used with other tools to answer the question.

Examples:

  • "What are the top 5 products by revenue?"

  • "How many users did we have last month?"

get_dimensions

Dimensions are the attributes, features, or characteristics that describe or categorize data.

get_entities

Entities are real-world concepts in a business such as customers, transactions, and ad campaigns. Analysis is often focused around specific entities, such as customer churn or annual recurring revenue modeling.

query_metrics

This tool allows ordering and grouping by dimensions and entities. To use this tool, you must first know about specific metrics, dimensions and entities to provide. You can call the list_metrics, get_dimensions, and get_entities tools to get information about which metrics, dimensions, and entities to use.

When using the order_by parameter, you must ensure that the dimension or entity also appears in the group_by parameter. When fulfilling a lookback query, prefer using order_by and limit instead of using the where parameter. A lookback query requires that the order_by parameter includes a descending order for a time dimension.

The where parameter should be database agnostic SQL syntax, however dimensions and entity are referenced differently. For categorical dimensions, use {{ Dimension('<name>') }} and for time dimensions add the grain like {{ TimeDimension('<name>', '<grain>') }}. For entities, use {{ Entity('<name>') }}. When referencing dates in the where parameter, only use the format yyyy-mm-dd.

Don't call this tool if the user's question cannot be answered with the provided metrics, dimensions, and entities. Instead, clarify what metrics, dimensions, and entities are available and suggest a new question that can be answered and is approximately the same as the user's question.

For queries that may return large amounts of data, it's recommended to use a two-step approach:

  1. First make a query with a small limit to verify the results are what you expect

  2. Then make a follow-up query without a limit (or with a larger limit) to get the full dataset

get_mart_models

Get the name and description of all mart models in the environment. A mart model is part of the presentation layer of the dbt project. It's where cleaned, transformed data is organized for consumption by end-users, like analysts, dashboards, or business tools.

get_all_models

Get the name and description of all dbt models in the environment.

get_model_details
get_model_parents

Get the parents of a specific dbt model.

build

The dbt build command will:

  • run models

  • test tests

  • snapshot snapshots

  • seed seeds

In DAG order.

compile

dbt compile generates executable SQL from source model, test, and analysis files.

The compile command is useful for visually inspecting the compiled output of model files. This is useful for validating complex jinja logic or macro usage.

docs

The docs command is responsible for generating your project's documentation website.

list

List the resources in the your dbt project.

parse

The dbt parse command parses and validates the contents of your dbt project. If your project contains Jinja or YAML syntax errors, the command will fail.

It will also produce an artifact with detailed timing information, which is useful to understand parsing times for large projects.

run

dbt run executes compiled sql model files against the current target database. dbt connects to the target database and runs the relevant SQL required to materialize all data models using the specified materialization strategies. Models are run in the order defined by the dependency graph generated during compilation.

test

dbt test runs data tests defined on models, sources, snapshots, and seeds and unit tests defined on SQL models.

show

dbt show executes an arbitrary SQL statement against the database and returns the results. It is useful for debugging and inspecting data in your dbt project. Use the limit argument in place of a SQL LIMIT clause

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dbt-labs/dbt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server