Allows AI agents to execute dbt CLI commands and interact with dbt projects. Supports operations like run, test, compile, list resources, debug, install dependencies, and load seed data.
Supports working with DuckDB as a database backend for dbt projects, as shown in the profiles.yml example.
Supports environment variable management for dbt projects through .env files, allowing configuration of variables needed for dbt operations.
DBT CLI MCP Server
A Model Context Protocol (MCP) server that wraps the dbt CLI tool, enabling AI coding agents to interact with dbt projects through standardized MCP tools.
Features
Execute dbt commands through MCP tools
Support for all major dbt operations (run, test, compile, etc.)
Command-line interface for direct interaction
Environment variable management for dbt projects
Configurable dbt executable path
Flexible profiles.yml location configuration
Related MCP server: PAELLADOC
Installation
Prerequisites
Python 3.10 or higher
uvtool for Python environment managementdbt CLI installed
Setup
Usage
Command Line Interface
The package provides a command-line interface for direct interaction with dbt:
You can also use the module directly:
Command Line Options
--dbt-path: Path to dbt executable (default: "dbt")--env-file: Path to environment file (default: ".env")--log-level: Logging level (default: "INFO")--profiles-dir: Path to directory containing profiles.yml file (defaults to project-dir if not specified)
Environment Variables
The server can also be configured using environment variables:
DBT_PATH: Path to dbt executableENV_FILE: Path to environment fileLOG_LEVEL: Logging levelDBT_PROFILES_DIR: Path to directory containing profiles.yml file
Using with MCP Clients
To use the server with an MCP client like Claude for Desktop, add it to the client's configuration:
⚠️ IMPORTANT: Absolute Project Path Required ⚠️
When using any tool from this MCP server, you MUST specify the FULL ABSOLUTE PATH to your dbt project directory with the project_dir parameter. Relative paths will not work correctly.
See the complete dbt MCP usage guide for more detailed instructions and examples.
Available Tools
The server provides the following MCP tools:
dbt_run: Run dbt models (requires absoluteproject_dir)dbt_test: Run dbt tests (requires absoluteproject_dir)dbt_ls: List dbt resources (requires absoluteproject_dir)dbt_compile: Compile dbt models (requires absoluteproject_dir)dbt_debug: Debug dbt project setup (requires absoluteproject_dir)dbt_deps: Install dbt package dependencies (requires absoluteproject_dir)dbt_seed: Load CSV files as seed data (requires absoluteproject_dir)dbt_show: Preview model results (requires absoluteproject_dir)
{ "models": "customers", "project_dir": "/path/to/dbt/project", "limit": 10 } </use_mcp_tool>
When running commands through the MCP server, ensure your project directory is structured correctly with both configuration files present.
Development
Integration Tests
The project includes integration tests that verify functionality against a real dbt project:
Test Project Setup
The integration tests use the jaffle_shop_duckdb project which is included as a Git submodule in the dbt_integration_tests directory. When you clone the repository with --recurse-submodules as mentioned in the Setup section, this will automatically be initialized.
If you need to update the test project to the latest version from the original repository:
If you're seeing errors about missing files in the jaffle_shop_duckdb directory, you may need to initialize the submodule:
License
MIT