Model Context Protocol server for Databricks (local development)
Project description
Databricks MCP Server (Local)
Complete setup and configuration for the Databricks MCP (Model Context Protocol) server integration with Cursor IDE. This repository provides a full MCP server implementation with setup scripts, configuration templates, and comprehensive documentation.
Overview
The Databricks MCP server enables AI assistants in Cursor IDE to interact with your Databricks workspace using natural language. You can manage notebooks, clusters, jobs, SQL warehouses, and workspace files—all through conversational queries.
Features
- Notebook Management: Run, list, get, create, and delete notebooks
- Cluster Management: List, create, start, stop, and restart clusters
- Job Management: Create, run, monitor, and manage Databricks jobs
- SQL Warehouses: Execute SQL queries and manage SQL warehouses
- Workspace Operations: List, read, create, and delete workspace files
- Git Repositories: List and manage Git repositories in workspace
Quick Start
Prerequisites
- Python 3.9 or higher
- Cursor IDE
- A Databricks workspace account
- Basic familiarity with command-line operations
Installation Steps
-
Install Dependencies
./scripts/install-dependencies.sh
This will check for Python and install
uv(the recommended package manager) if needed. -
Run Setup Script
./scripts/setup.sh
This interactive script will:
- Guide you through creating a Databricks Personal Access Token
- Create your
.envfile with credentials - Generate a Cursor MCP configuration file
-
Install the MCP Server
pip install -e .
Or if using
uvx:uvx databricks-mcp-server-local -
Configure Cursor IDE
- Open Cursor Settings
- Navigate to Features > MCP Servers
- Click "+ Add new global MCP server"
- Copy the configuration from
config/cursor-mcp-config.json(created by setup script) - Or manually add the configuration shown in the setup script output
-
Restart Cursor IDE
- Close and reopen Cursor to load the MCP server
-
Verify Connection
./scripts/verify-connection.sh
-
Test It Out In Cursor Composer, try asking:
- "List all clusters in my Databricks workspace"
- "Show me all notebooks in the workspace"
- "Create a new cluster named 'test-cluster'"
- "Execute SQL query 'SELECT * FROM my_table' on warehouse abc123"
What's Included
Configuration Files
.env.example- Template for environment variablesconfig/cursor-mcp-config.json.example- Example Cursor MCP configuration
Helper Scripts
scripts/install-dependencies.sh- Checks Python and installs uvscripts/setup.sh- Interactive setup wizardscripts/verify-connection.sh- Tests your Databricks connection
Documentation
docs/authentication.md- Detailed authentication setup guidedocs/troubleshooting.md- Common issues and solutionsdocs/usage-examples.md- Example queries and use casesdocs/publishing.md- PyPI publishing guide and security checklist
Authentication Setup
Personal Access Token (Recommended)
- Go to your Databricks workspace
- Click your username in the top right
- Select User Settings
- Go to Access Tokens tab
- Click Generate New Token
- Give it a name (e.g., "Databricks MCP Integration")
- Set expiration (or leave blank for no expiration)
- Copy the token immediately (it's only shown once!)
Then add to your .env file:
DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
DATABRICKS_TOKEN=your_personal_access_token_here
OAuth / Unified Authentication
The Databricks SDK will automatically use:
- Databricks CLI authentication (
~/.databrickscfg) - Environment variables
- Notebook-native authentication (if running in Databricks)
See docs/authentication.md for detailed instructions.
Installation Methods
The server supports multiple installation methods:
Option 1: Using uvx (Recommended)
uvx databricks-mcp-server-local
This automatically downloads and runs the package.
Option 2: Using pip
pip install databricks-mcp-server-local
Option 3: Local Development
pip install -e .
Configuration Options
Environment Variables
Required:
DATABRICKS_HOST- Your Databricks workspace URL (e.g.,https://your-workspace.cloud.databricks.com)
Authentication (choose one):
DATABRICKS_TOKEN- Personal Access Token (recommended)- OAuth/unified authentication (automatic via Databricks SDK)
Optional:
DATABRICKS_ACCOUNT_ID- Account ID for account-level operationsDATABRICKS_CLUSTER_ID- Default cluster IDDATABRICKS_WAREHOUSE_ID- Default SQL warehouse ID
Cursor MCP Configuration
The MCP server uses stdio transport by default. Example configuration:
{
"mcpServers": {
"databricks-mcp-server-local": {
"command": "python",
"args": ["-m", "databricks_mcp.server"],
"env": {
"DATABRICKS_HOST": "https://your-workspace.cloud.databricks.com",
"DATABRICKS_TOKEN": "your_personal_access_token_here"
}
}
}
}
Usage Examples
Once configured, you can use natural language to interact with Databricks:
Notebook Management
- "List all notebooks in my workspace"
- "Get the content of notebook /Users/user@example.com/my_notebook"
- "Create a new Python notebook at /Users/user@example.com/test"
- "Run notebook /Users/user@example.com/my_notebook with parameters {'param1': 'value1'}"
Cluster Management
- "List all clusters"
- "Show me details of cluster abc-123-def"
- "Create a new cluster named 'production-cluster' with Spark 13.3.x"
- "Start cluster abc-123-def"
- "Stop cluster abc-123-def"
Job Management
- "List all jobs"
- "Show me details of job 12345"
- "Create a job to run notebook /path/to/notebook"
- "Run job 12345"
- "What's the status of job run 67890?"
SQL Operations
- "List all SQL warehouses"
- "Execute SQL query 'SELECT * FROM my_table LIMIT 10' on warehouse abc123"
- "Show me recent query history"
- "Create a saved query named 'daily_report'"
Workspace Operations
- "List files in /Users/user@example.com"
- "Read the content of /Users/user@example.com/script.py"
- "Create a new file at /Users/user@example.com/test.py"
- "List all Git repositories"
See docs/usage-examples.md for more examples.
Security Best Practices
- Never commit tokens - The
.envfile is gitignored for a reason - Use Personal Access Tokens - More secure than password authentication
- Set token expiration - Rotate tokens regularly according to your security policy
- Use least privilege - Grant only necessary permissions to the token
- Store securely - Use environment variables or secure credential storage
See docs/authentication.md for detailed security guidance.
Troubleshooting
Connection Issues
- Verify your
.envfile exists and has correct values - Run
./scripts/verify-connection.shto test authentication - Check that Cursor IDE has been restarted after configuration changes
- Ensure the MCP server shows as connected (green indicator) in Cursor
Authentication Problems
- Verify your Personal Access Token is correct (no extra spaces)
- Check that the token hasn't expired
- Ensure your workspace URL is correct and accessible
- For OAuth, verify Databricks CLI is configured (
databricks auth login)
MCP Server Not Working
- Check Python version (requires 3.9+)
- Verify the package is installed:
pip list | grep databricks-mcp-server-local - Review Cursor logs for error messages
- Try running the server directly:
python -m databricks_mcp.server
See docs/troubleshooting.md for comprehensive troubleshooting guide.
Project Structure
databricks-mcp-server-local/
├── README.md # This file
├── .env.example # Environment variable template
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
├── pyproject.toml # Python project configuration
├── requirements.txt # Python dependencies
├── src/
│ └── databricks_mcp/
│ ├── __init__.py
│ ├── server.py # Main MCP server implementation
│ ├── databricks_client.py # Databricks SDK wrapper
│ └── tools/
│ ├── __init__.py
│ ├── notebooks.py # Notebook operations
│ ├── clusters.py # Cluster management
│ ├── jobs.py # Job operations
│ ├── sql.py # SQL warehouses & queries
│ └── workspace.py # Workspace operations
├── config/
│ └── cursor-mcp-config.json.example # Cursor MCP config template
├── scripts/
│ ├── install-dependencies.sh # Install Python/uv
│ ├── setup.sh # Interactive setup wizard
│ └── verify-connection.sh # Test Databricks connection
└── docs/
├── authentication.md # Auth setup guide
├── troubleshooting.md # Common issues
└── usage-examples.md # Usage examples
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - See LICENSE file for details.
Additional Resources
- Model Context Protocol Documentation
- Cursor IDE MCP Documentation
- Databricks SDK for Python
- Databricks REST API Reference
Acknowledgments
Built with FastMCP and the Databricks SDK for Python.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file databricks_mcp_server_local-0.1.1.tar.gz.
File metadata
- Download URL: databricks_mcp_server_local-0.1.1.tar.gz
- Upload date:
- Size: 27.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
990fb4cee5f20011930cf40b8aebb7af8fecf52be66696037bddce8734bee17f
|
|
| MD5 |
b416d2a594a442d657d148302850ce17
|
|
| BLAKE2b-256 |
71260cd18a658cc0be6224cbc3fdd64b5462133a455f507a512d67f718aec2d5
|
File details
Details for the file databricks_mcp_server_local-0.1.1-py3-none-any.whl.
File metadata
- Download URL: databricks_mcp_server_local-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
695114823beda35cd5f7d84210ff5f3c8872dcc1dab5a587c5de13d35412ac65
|
|
| MD5 |
23dab22af5d3fc788cd5094f95a794a9
|
|
| BLAKE2b-256 |
eb1d03256ca6a9987477caee57955dbd8ca7759948c5020b8f538744ed8d18ed
|