Skip to main content

Integrate Cursor with dbt MCP

Cursor is an AI-powered code editor, powered by Microsoft Visual Studio Code (VS Code).

After setting up your MCP server, you connect it to Cursor. Log in to Cursor and follow the steps that align with your use case.

Set up with local dbt MCP server

Choose your setup based on your workflow:

  • OAuth for dbt platform connections
  • CLI only if using dbt Core or the dbt Fusion engine locally.
  • Configure environment variables if you're using them in your dbt platform account.

OAuth or CLI

Click one of the following application links with Cursor open to automatically configure your MCP server:

Local configuration for users who only want to use dbt CLI commands with dbt Core or dbt Fusion engine (no dbt platform features).

Add dbt Core or Fusion to Cursor

After clicking:

  1. Update with the full path to your dbt project (the folder containing dbt_project.yml).
  2. Update DBT_PATH with the full path to your dbt executable:
    • macOS/Linux: Run which dbt in Terminal.
    • Windows: Run where dbt in Command Prompt or PowerShell.
  3. Save the configuration.

Custom environment variables

Use this method if you need custom environment variables or prefer to use service tokens. Refer to the Environment variables reference for the complete list of available environment variables for the local MCP server.

  1. Click the following link with Cursor open:

    Add to Cursor

  2. In the template, add your environment variables to the env section based on your needs.

  3. Save the configuration.

Using an .env file

If you prefer to manage environment variables in a separate file, put the .env file in your dbt project root (same folder as dbt_project.yml). Click this link:

Add to Cursor (with .env file)

Then update env-file-path with the absolute path to your .env file (for example, /absolute/path/to/your-dbt-project/.env).

Set up with remote dbt MCP server

  1. Click the following application link with Cursor open:

    Add to Cursor

  2. Provide your URL/headers by updating the host, production environment ID, and service token in the template.

    IDs are integers, not URLs

    DBT_PROD_ENV_ID, DBT_USER_ID, and DBT_DEV_ENV_ID must be numeric IDs (for example, 54321), not full URLs.

    DBT_HOST field accepts the https:// prefix and without the https:// prefix. The following are valid examples:

    DBT_HOST=https://ab123.us1.dbt.com
    DBT_HOST=ab123.us1.dbt.com
  3. Save, and now you have access to the dbt MCP server!

Was this page helpful?

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

0
Loading