Install skills for your AI client (downloads from remote)

February 3, 2026 ยท View on GitHub

Databricks MCP Code Execution Template

This template enables AI-assisted development in Databricks by leveraging the Databricks Command Execution API through an MCP server. Test code directly on clusters, then deploy with Databricks Asset Bundles (DABs).

๐ŸŽฏ What This Does

  • โœ… Run and test code directly on Databricks clusters
  • โœ… Auto-select clusters - no need to specify a cluster ID
  • โœ… Create and deploy Databricks Asset Bundles (DABs)
  • โœ… All from natural language prompts!

Just describe what you want โ†’ AI builds, tests the code on Databricks, and deploys the complete pipeline.


Step 1: Set Up the MCP Server (One Time)

Clone and set up the MCP server somewhere on your machine:

git clone https://github.com/databricks-solutions/databricks-exec-code-mcp.git
cd databricks-exec-code-mcp
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Step 2: Configure Databricks Credentials

Add to your ~/.zshrc or ~/.bashrc:

export DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
export DATABRICKS_TOKEN=dapi_your_token_here

Make sure the variables are loaded:

source ~/.zshrc

To get your Personal Access Token (PAT): Databricks workspace โ†’ Profile โ†’ Settings โ†’ Developer โ†’ Access Tokens โ†’ Generate new token

Step 3: Start a New Project

Create your project directory and install the Databricks skills:

# Create and enter your project
mkdir my-databricks-project && cd my-databricks-project

# Initialize git in your my-databricks-project project
git init .

# Install skills for your AI client (downloads from remote)
curl -sSL https://raw.githubusercontent.com/databricks-solutions/databricks-exec-code-mcp/main/install_skills.sh | bash -s -- --cursor
# Or for Claude Code:
curl -sSL https://raw.githubusercontent.com/databricks-solutions/databricks-exec-code-mcp/main/install_skills.sh | bash -s -- --claude
# Or for both:
curl -sSL https://raw.githubusercontent.com/databricks-solutions/databricks-exec-code-mcp/main/install_skills.sh | bash -s -- --all

This creates:

  • Cursor: .cursor/rules/ with Databricks rules
  • Claude Code: .claude/skills/ with Databricks skills

Step 4: Configure Your AI Client

Point your AI client to the MCP server you set up in Step 1.

For Cursor โ€” create .cursor/mcp.json in your project:

{
  "mcpServers": {
    "databricks": {
      "command": "/path/to/databricks-exec-code-mcp/.venv/bin/python",
      "args": ["/path/to/databricks-exec-code-mcp/mcp_tools/tools.py"]
    }
  }
}

For Claude Code โ€” run in your project:

claude mcp add-json databricks '{"command":"/path/to/databricks-exec-code-mcp/.venv/bin/python","args":["/path/to/databricks-exec-code-mcp/mcp_tools/tools.py"]}'

Replace /path/to/databricks-exec-code-mcp with the actual path from Step 1.

Step 5: Start Prompting!

๐Ÿ’ก Smart Cluster Selection: If no cluster_id is provided, the MCP server automatically finds a running cluster in your workspace.

Just describe what you want in natural language:

Data Engineering:

"Build a Data Engineering pipeline using Medallion Architecture on the NYC Taxi dataset and deploy it with DABs"

Machine Learning:

"Train a classification model on the Titanic dataset, register it to Unity Catalog, and deploy as a DAB job"

Quick Test:

"Run a SQL query to show the top 10 tables in my catalog"


๐Ÿ“ What Gets Generated

The AI will create a complete DABs project:

your-project/
โ”œโ”€โ”€ databricks.yml              # DABs configuration
โ”œโ”€โ”€ resources/
โ”‚   โ””โ”€โ”€ training_job.yml        # Databricks job definition
โ”œโ”€โ”€ src/<project>/
โ”‚   โ””โ”€โ”€ notebooks/
โ”‚       โ”œโ”€โ”€ 01_data_prep.py
โ”‚       โ”œโ”€โ”€ 02_training.py
โ”‚       โ””โ”€โ”€ 03_validation.py
โ””โ”€โ”€ tests/                      # Unit tests (optional)

๐ŸŒŸ Features

FeatureDescription
Direct Cluster ExecutionTest code on Databricks clusters via Databricks Execution API
DABs PackagingProduction-ready bundle deployment
Multi-EnvironmentSupport for dev/staging/prod targets
Unity CatalogModels and data registered to UC for governance
MLflow TrackingExperiment tracking and model versioning

๐Ÿ“š Resources


๐Ÿ“œ License

ยฉ 2025 Databricks, Inc. All rights reserved. The source in this project is provided subject to the Databricks License.

Third-Party Licenses

PackageLicenseCopyright
mcpMIT LicenseCopyright (c) 2024 Anthropic
requestsApache License 2.0Copyright 2019 Kenneth Reitz
python-dotenvBSD 3-Clause LicenseCopyright (c) 2014, Saurabh Kumar