
mammothgrowth/dbt-cli-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
DBT CLI MCP サーバー
概要
Dbt CLI ツールをラップするモデルコンテキストプロトコル(MCP)サーバーで、AI コーディングエージェントが標準化された MCP ツールを使用して dbt プロジェクトとやり取りできるようにします。 - MCP ツールを介して dbt コマンドを実行 - すべての主要な dbt 操作のサポート (実行、テスト、コンパイルなど) - 直接インタラクションのためのコマンドラインインターフェイス - dbt プロジェクトのための環境変数管理 - 設定可能な dbt 実行可能パス - 柔軟な Profiles.yml 位置設定 - Python 3.10以上 - Python環境管理のためのuvツール - dbt CLIインストール パッケージは dbt との直接やり取りのためのコマンドラインインターフェイスを提供します: - --dbt-path: dbt 実行可能パス (デフォルト: "dbt") - --env-file: 環境ファイルへのパス (デフォルト: ".env") - --log-level: ログレベル (デフォルト: "INFO") - --profiles-dir: プロファイルを含むディレクトリへのパス.
概要(AI 翻訳)
Dbt CLI ツールをラップするモデルコンテキストプロトコル(MCP)サーバーで、AI コーディングエージェントが標準化された MCP ツールを使用して dbt プロジェクトとやり取りできるようにします。
##特徴
- MCP ツールで dbt コマンドを実行
- すべての主要なdbt操作のサポート(実行、テスト、コンパイルなど)
- 直接インタラクションのためのコマンドラインインターフェイス
- dbt プロジェクトのための環境変数管理
- 設定可能なdbt実行可能なパス
- 柔軟なプロファイル.yml位置設定
インストール
前提条件
- Python 3.10以上
- [
uvPython環境管理ツール - dbt CLI インストール
セットアップ
使用法
コマンドラインインターフェイス
パッケージは dbt との直接やり取りのためのコマンドラインインターフェイスを提供します:
モジュールを直接使用することもできます。
コマンドラインオプション
- [
--dbt-path]: dbt 実行可能パス (デフォルト: “dbt”) - [
--env-file: 環境ファイルへのパス(デフォルト: “.env”) - [
--profiles-dir]: Profiles.yml ファイルを含むディレクトリへのパス (デフォルトは指定されていない場合は project-dir )
環境変数
サーバは環境変数を使用して設定することもできます。
- [
DBT_PATH]: dbt 実行可能なパス
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
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
Installation
Prerequisites
- Python 3.10 or higher
uvtool for Python environment management- dbt CLI installed
Setup
# Clone the repository with submodules
git clone --recurse-submodules https://github.com/yourusername/dbt-cli-mcp.git
cd dbt-cli-mcp
# If you already cloned without --recurse-submodules, initialize the submodule
# git submodule update --init
# Create and activate a virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
uv pip install -e .
# For development, install development dependencies
uv pip install -e ".[dev]"
Usage
Command Line Interface
The package provides a command-line interface for direct interaction with dbt:
# Run dbt models
dbt-mcp run --models customers --project-dir /path/to/project
# Run dbt models with a custom profiles directory
dbt-mcp run --models customers --project-dir /path/to/project --profiles-dir /path/to/profiles
# List dbt resources
dbt-mcp ls --resource-type model --output-format json
# Run dbt tests
dbt-mcp test --project-dir /path/to/project
# Get help
dbt-mcp --help
dbt-mcp run --help
You can also use the module directly:
python -m src.cli run --models customers --project-dir /path/to/project
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:
{
"mcpServers": {
"dbt": {
"command": "uv",
"args": ["--directory", "/path/to/dbt-cli-mcp", "run", "src/server.py"],
"env": {
"DBT_PATH": "/absolute/path/to/dbt",
"ENV_FILE": ".env"
// You can also set DBT_PROFILES_DIR here for a server-wide default
}
}
}
}
⚠️ IMPORTANT: Absolute Project Path Required ⚠️
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"dbt": {
"command": "uv",
"args": ["--directory", "/path/to/dbt-cli-mcp", "run", "src/server.py"],
"env": {
"DBT_PATH": "/absolute/path/to/dbt",
"ENV_FILE": ".env"
// You can also set DBT_PROFILES_DIR here for a server-wide default
}
}
}
}