
Databricks
STDIODatabricks集成MCP服务器
Databricks集成MCP服务器
When AI changes everything, you start from scratch.
Markov specializes in cutting-edge AI solutions and automation. From neural ledgers to MCP servers,
we're building the tools that power the next generation of AI-driven applications.
💼 We're always hiring exceptional engineers! Join us in shaping the future of AI.
A Model Completion Protocol (MCP) server for Databricks that provides access to Databricks functionality via the MCP protocol. This allows LLM-powered tools to interact with Databricks clusters, jobs, notebooks, and more.
Version 0.3.1 - Latest release with issue #9 fix and enhanced MCP client compatibility.
Click this link to install instantly:
cursor://anysphere.cursor-deeplink/mcp/install?name=databricks-mcp&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJkYXRhYnJpY2tzLW1jcC1zZXJ2ZXIiXSwiZW52Ijp7IkRBVEFCUklDS1NfSE9TVCI6IiR7REFUQUJSSUNLU19IT1NUfSIsIkRBVEFCUklDS1NfVE9LRU4iOiIke0RBVEFCUklDS1NfVE9LRU59IiwiREFUQUJSSUNLU19XQVJFSE9VU0VfSUQiOiIke0RBVEFCUklDS1NfV0FSRUhPVVNFX0lEfSJ9fQ==
Or copy and paste this deeplink:
cursor://anysphere.cursor-deeplink/mcp/install?name=databricks-mcp&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJkYXRhYnJpY2tzLW1jcC1zZXJ2ZXIiXSwiZW52Ijp7IkRBVEFCUklDS1NfSE9TVCI6IiR7REFUQUJSSUNLU19IT1NUfSIsIkRBVEFCUklDS1NfVE9LRU4iOiIke0RBVEFCUklDS1NfVE9LRU59IiwiREFUQUJSSUNLU19XQVJFSE9VU0VfSUQiOiIke0RBVEFCUklDS1NfV0FSRUhPVVNFX0lEfSJ9fQ==
→ Install Databricks MCP in Cursor ←
This project is maintained by Olivier Debeuf De Rijcker [email protected].
Credit for the initial version goes to @JustTryAI.
The Databricks MCP Server exposes the following tools:
New Features - Repo Sync & Notebook Execution:
pull_repo
toolrun_notebook
toolsync_repo_and_run_notebook
toolBug Fixes:
Previous Updates:
src/
to databricks_mcp/
structureBackwards Compatibility: All existing MCP tools continue to work unchanged. New features extend functionality without breaking changes.
Use the link above to install with one click:
→ Install Databricks MCP in Cursor ←
This will automatically install the MCP server using uvx
and configure it in Cursor. You'll need to set these environment variables:
DATABRICKS_HOST
- Your Databricks workspace URLDATABRICKS_TOKEN
- Your Databricks personal access tokenDATABRICKS_WAREHOUSE_ID
- (Optional) Your default SQL warehouse IDuv
package manager (recommended for MCP servers)Install uv
if you don't have it already:
# MacOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows (in PowerShell) irm https://astral.sh/uv/install.ps1 | iex
Restart your terminal after installation.
Clone the repository:
git clone https://github.com/markov-kernel/databricks-mcp.git cd databricks-mcp
Run the setup script:
# Linux/Mac ./scripts/setup.sh # Windows (PowerShell) .\scripts\setup.ps1
The setup script will:
uv
if not already installedAlternative manual setup:
# Create and activate virtual environment uv venv # On Windows .\.venv\Scripts\activate # On Linux/Mac source .venv/bin/activate # Install dependencies in development mode uv pip install -e . # Install development dependencies uv pip install -e ".[dev]"
Set up environment variables:
# Required variables # Windows set DATABRICKS_HOST=https://your-databricks-instance.azuredatabricks.net set DATABRICKS_TOKEN=your-personal-access-token # Linux/Mac export DATABRICKS_HOST=https://your-databricks-instance.azuredatabricks.net export DATABRICKS_TOKEN=your-personal-access-token # Optional: Set default SQL warehouse (makes warehouse_id optional in execute_sql) export DATABRICKS_WAREHOUSE_ID=sql_warehouse_12345
You can also create an .env
file based on the .env.example
template.
To start the MCP server directly for testing or development, run:
# Activate your virtual environment if not already active source .venv/bin/activate # Run the start script (handles finding env vars from .env if needed) ./scripts/start_mcp_server.sh
This is useful for seeing direct output and logs.
To use this server with AI clients like Cursor or Claude CLI, you need to register it.
Open your global MCP configuration file located at ~/.cursor/mcp.json
(create it if it doesn't exist).
Add the following entry within the mcpServers
object, replacing placeholders with your actual values and ensuring the path to start_mcp_server.sh
is correct:
{ "mcpServers": { // ... other servers ... "databricks-mcp-local": { "command": "/absolute/path/to/your/project/databricks-mcp-server/start_mcp_server.sh", "args": [], "env": { "DATABRICKS_HOST": "https://your-databricks-instance.azuredatabricks.net", "DATABRICKS_TOKEN": "dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DATABRICKS_WAREHOUSE_ID": "sql_warehouse_12345", "RUNNING_VIA_CURSOR_MCP": "true" } } // ... other servers ... } }
Important: Replace /absolute/path/to/your/project/databricks-mcp-server/
with the actual absolute path to this project directory on your machine.
Replace the DATABRICKS_HOST
and DATABRICKS_TOKEN
values with your credentials.
Save the file and restart Cursor.
You can now invoke tools using databricks-mcp-local:<tool_name>
(e.g., databricks-mcp-local:list_jobs
).
Use the claude mcp add
command to register the server. Provide your credentials using the -e
flag for environment variables and point the command to the start_mcp_server.sh
script using --
followed by the absolute path:
claude mcp add databricks-mcp-local \ -s user \ -e DATABRICKS_HOST="https://your-databricks-instance.azuredatabricks.net" \ -e DATABRICKS_TOKEN="dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -e DATABRICKS_WAREHOUSE_ID="sql_warehouse_12345" \ -- /absolute/path/to/your/project/databricks-mcp-server/start_mcp_server.sh
Important: Replace /absolute/path/to/your/project/databricks-mcp-server/
with the actual absolute path to this project directory on your machine.
Replace the DATABRICKS_HOST
and DATABRICKS_TOKEN
values with your credentials.
You can now invoke tools using databricks-mcp-local:<tool_name>
in your Claude interactions.
The repository includes utility scripts to quickly view Databricks resources:
# View all clusters uv run scripts/show_clusters.py # View all notebooks uv run scripts/show_notebooks.py
# With DATABRICKS_WAREHOUSE_ID set, warehouse_id is optional await session.call_tool("execute_sql", { "statement": "SELECT * FROM my_table LIMIT 10" }) # You can still override the default warehouse await session.call_tool("execute_sql", { "statement": "SELECT * FROM my_table LIMIT 10", "warehouse_id": "sql_warehouse_specific" })
# Get JSON file content from workspace await session.call_tool("get_workspace_file_content", { "workspace_path": "/Users/[email protected]/config/settings.json" }) # Get notebook content in Jupyter format await session.call_tool("get_workspace_file_content", { "workspace_path": "/Users/[email protected]/my_notebook", "format": "JUPYTER" }) # Get file metadata without downloading content await session.call_tool("get_workspace_file_info", { "workspace_path": "/Users/[email protected]/large_file.py" })
await session.call_tool("sync_repo_and_run_notebook", { "repo_id": 123, "notebook_path": "/Repos/user/project/run_me" })
job_conf = { "name": "Nightly ETL", "tasks": [ { "task_key": "etl", "notebook_task": {"notebook_path": "/Repos/me/etl.py"}, "existing_cluster_id": "abc-123" } ] } await session.call_tool("create_job", job_conf)
databricks-mcp/
├── databricks_mcp/ # Main package (renamed from src/)
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Main entry point for the package
│ ├── main.py # Entry point for the MCP server
│ ├── api/ # Databricks API clients
│ │ ├── clusters.py # Cluster management
│ │ ├── jobs.py # Job management
│ │ ├── notebooks.py # Notebook operations
│ │ ├── sql.py # SQL execution
│ │ └── dbfs.py # DBFS operations
│ ├── core/ # Core functionality
│ │ ├── config.py # Configuration management
│ │ ├── auth.py # Authentication
│ │ └── utils.py # Utilities
│ ├── server/ # Server implementation
│ │ ├── __main__.py # Server entry point
│ │ ├── databricks_mcp_server.py # Main MCP server
│ │ └── app.py # FastAPI app for tests
│ └── cli/ # Command-line interface
│ └── commands.py # CLI commands
├── tests/ # Test directory
│ ├── test_clusters.py # Cluster tests
│ ├── test_mcp_server.py # Server tests
│ └── test_*.py # Other test files
├── scripts/ # Helper scripts (organized)
│ ├── start_mcp_server.ps1 # Server startup script (Windows)
│ ├── start_mcp_server.sh # Server startup script (Unix)
│ ├── run_tests.ps1 # Test runner script (Windows)
│ ├── run_tests.sh # Test runner script (Unix)
│ ├── setup.ps1 # Setup script (Windows)
│ ├── setup.sh # Setup script (Unix)
│ ├── show_clusters.py # Script to show clusters
│ ├── show_notebooks.py # Script to show notebooks
│ ├── setup_codespaces.sh # Codespaces setup
│ └── test_setup_local.sh # Local test setup
├── examples/ # Example usage
│ ├── direct_usage.py # Direct usage examples
│ └── mcp_client_usage.py # MCP client examples
├── docs/ # Documentation (organized)
│ ├── AGENTS.md # Agent documentation
│ ├── project_structure.md # Detailed structure docs
│ ├── new_features.md # Feature documentation
│ └── phase1.md # Development phases
├── .gitignore # Git ignore rules
├── .cursor.json # Cursor configuration
├── pyproject.toml # Package configuration
├── uv.lock # Dependency lock file
└── README.md # This file
See docs/project_structure.md
for a more detailed view of the project structure.
The project uses the following linting tools:
# Run all linters uv run pylint databricks_mcp/ tests/ uv run flake8 databricks_mcp/ tests/ uv run mypy databricks_mcp/
The project uses pytest for testing. To run the tests:
# Run all tests with our convenient script .\scripts\run_tests.ps1 # Run with coverage report .\scripts\run_tests.ps1 -Coverage # Run specific tests with verbose output .\scripts\run_tests.ps1 -Verbose -Coverage tests/test_clusters.py
You can also run the tests directly with pytest:
# Run all tests uv run pytest tests/ # Run with coverage report uv run pytest --cov=databricks_mcp tests/ --cov-report=term-missing
A minimum code coverage of 80% is the goal for the project.
docs/api
directoryexamples/
directory for usage examplesCheck the examples/
directory for usage examples. To run examples:
# Run example scripts with uv uv run examples/direct_usage.py uv run examples/mcp_client_usage.py
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
A Model Completion Protocol (MCP) server for interacting with Databricks services. Maintained by markov.bot.