Databricks Code Execution MCP
Enables AI-assisted development by running and testing code directly on Databricks clusters via natural language, then deploying Databricks Asset Bundles.
README
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.
š Quick Start (Recommended Workflow)
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-mcpwith the actual path from Step 1.
Step 5: Start Prompting!
š” Smart Cluster Selection: If no
cluster_idis 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
| Feature | Description |
|---|---|
| Direct Cluster Execution | Test code on Databricks clusters via Databricks Execution API |
| DABs Packaging | Production-ready bundle deployment |
| Multi-Environment | Support for dev/staging/prod targets |
| Unity Catalog | Models and data registered to UC for governance |
| MLflow Tracking | Experiment 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
| Package | License | Copyright |
|---|---|---|
| mcp | MIT License | Copyright (c) 2024 Anthropic |
| requests | Apache License 2.0 | Copyright 2019 Kenneth Reitz |
| python-dotenv | BSD 3-Clause License | Copyright (c) 2014, Saurabh Kumar |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.