Skip to main content
Glama
Niraj-Hitpump

Databricks MCP Server

README.md
# Databricks MCP Server

A Python MCP server to interact with Databricks — run SQL queries, manage clusters, trigger jobs, run notebooks, explore Unity Catalog metadata, manage secrets, and interact with DBFS.

## Setup

### 1. Install dependencies
```bash
pip install -r requirements.txt
```

### 2. Configure credentials
Edit the `.env` file:
```
DATABRICKS_HOST=https://<your-workspace>.azuredatabricks.net
DATABRICKS_TOKEN=<your-access-token>
DATABRICKS_SQL_HTTP_PATH=/sql/1.0/warehouses/<your-warehouse-id>
DATABRICKS_WAREHOUSE_ID=<your-warehouse-id>
```

### 3. Run the server
```bash
python -m databricks_mcp.server
```

---

## Available Tools (40+)

### SQL
| Tool | Description |
|---|---|
| `sql_query` | Run a SQL query (auto-wakes warehouse) |
| `sql_explain` | Show execution plan of a SQL query |

### Clusters
| Tool | Description |
|---|---|
| `clusters_list` | List all clusters and their states |
| `cluster_status` | Get current state of a specific cluster |
| `cluster_start` | Start a cluster |
| `cluster_stop` | Stop a cluster |
| `cluster_restart` | Restart a running cluster |
| `cluster_resize` | Scale cluster workers up/down |
| `cluster_wait_until_ready` | Poll until cluster is RUNNING |
| `cluster_events` | Get recent events/errors for a cluster |

### Warehouses
| Tool | Description |
|---|---|
| `warehouses_list` | List all SQL Warehouses |
| `warehouse_status` | Get detailed status of a warehouse |
| `warehouse_start` | Start a SQL Warehouse |
| `warehouse_stop` | Stop a SQL Warehouse |
| `warehouse_resize` | Change warehouse size |

### Jobs
| Tool | Description |
|---|---|
| `jobs_list` | List all Databricks jobs |
| `job_create` | Create a new job with a notebook task |
| `job_update` | Update a job's name, notebook, or cluster |
| `job_delete` | Delete a job |
| `job_trigger` | Trigger a job run |
| `job_run_status` | Get status of a job run |
| `job_cancel` | Cancel a running job run |
| `job_run_history` | List recent runs of a job |

### Notebooks
| Tool | Description |
|---|---|
| `notebooks_list` | List notebooks in a workspace path |
| `workspace_list` | List all objects in a workspace path |
| `workspace_mkdir` | Create a folder in workspace |
| `notebook_run` | Run a notebook (fire and forget) |
| `notebook_run_and_wait` | Run a notebook and wait for output |
| `notebook_export` | Export a notebook (HTML/SOURCE/JUPYTER/DBC) |
| `notebook_import` | Import/upload a notebook to workspace |
| `notebook_delete` | Delete a notebook or folder |

### Metadata (Unity Catalog)
| Tool | Description |
|---|---|
| `catalogs_list` | List all catalogs |
| `schemas_list` | List schemas in a catalog |
| `tables_list` | List tables in a catalog.schema |
| `table_schema` | Get column schema of a table |
| `table_preview` | Preview top N rows of a table |
| `table_create` | Create a Delta table from DDL |
| `table_drop` | Drop a table |
| `table_optimize` | Run OPTIMIZE (+ optional ZORDER) |
| `table_vacuum` | Run VACUUM to clean up old files |

### Secrets
| Tool | Description |
|---|---|
| `secrets_list_scopes` | List all secret scopes |
| `secrets_list` | List secret keys in a scope (no values) |

### DBFS
| Tool | Description |
|---|---|
| `dbfs_list` | List files in a DBFS path |
| `dbfs_delete` | Delete a file or folder from DBFS |
| `dbfs_upload` | Upload a file to DBFS (base64 content) |
| `dbfs_mkdir` | Create a directory in DBFS |

---

## Integrate with Claude Desktop

Add this to your `claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "databricks": {
      "command": "python",
      "args": ["-m", "databricks_mcp.server"],
      "cwd": "/path/to/MCP"
    }
  }
}
```