Skip to main content

Set up local MCP beta

The local dbt MCP server runs locally on your machine. Set up the local dbt MCP server with the following directions:

  1. Install uv to be able to run dbt-mcp and related dependencies into an isolated virtual environment.

  2. Create an .env file to set your environment variables. You will need to configure environment variables to access the tools. If you are only using the dbt CLI commands, you do not need to supply the dbt platform-specific environment variables, and vice versa.

    Here is an example of the file:

    DBT_HOST=cloud.getdbt.com
    DBT_PROD_ENV_ID=your-production-environment-id
    DBT_DEV_ENV_ID=your-development-environment-id
    DBT_USER_ID=your-user-id
    DBT_ACCOUNT_ID=your-account-id
    DBT_TOKEN=your-service-token
    DBT_PROJECT_DIR=/path/to/your/dbt/project
    DBT_PATH=/path/to/your/dbt/executable
    MULTICELL_ACCOUNT_PREFIX=your-account-prefix

    You will need this file for integrating with MCP-compatible tools.

  3. (Optional) Test your configuration:

    In a terminal, run the following command to test your setup:

    uvx --env-file <path-to-.env-file> dbt-mcp

    If there are no errors, uv and the .env file are set up correctly and you can move on to the next step.

  4. Set up your MCP client:

    After creating your .env file, you can move on to our guides on connecting dbt-mcp to tools like Claude Desktop or Cursor or to creating aconfiguration file. This is dependent on what tools you want to integrate with.

    Example configuration

    For some tools, you may need an additional configuration file to upload to connect to dbt-mcp. Here is a sample configuration JSON file that you can use to connect to the MCP tools. Be sure to replace the sections within <>:

    {
    "mcpServers": {
    "dbt-mcp": {
    "command": "uvx",
    "args": [
    "--env-file",
    "<path-to-.env-file>",
    "dbt-mcp"
    ]
    }
    }
    }

    <path-to-.env-file> is where you saved the .env file from the Setup step.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0