A Model Context Protocol server that connects to Databricks API
Project description
Databricks MCP Server
A Model Context Protocol (MCP) server that connects to Databricks API, allowing LLMs to run SQL queries, list jobs, and get job status.
Features
- Run SQL queries on Databricks SQL warehouses
- List all Databricks jobs
- Get status of specific Databricks jobs
- Get detailed information about Databricks jobs
Prerequisites
- Python 3.7+
- Databricks workspace with:
- Personal access token
- SQL warehouse endpoint
- Permissions to run queries and access jobs
Setup
- Clone this repository
- Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt - Create a
.envfile in the root directory with the following variables:DATABRICKS_HOST=your-databricks-instance.cloud.databricks.com DATABRICKS_TOKEN=your-personal-access-token DATABRICKS_HTTP_PATH=/sql/1.0/warehouses/your-warehouse-id - Test your connection (optional but recommended):
python test_connection.py
Obtaining Databricks Credentials
- Host: Your Databricks instance URL (e.g.,
your-instance.cloud.databricks.com) - Token: Create a personal access token in Databricks:
- Go to User Settings (click your username in the top right)
- Select "Developer" tab
- Click "Manage" under "Access tokens"
- Generate a new token, and save it immediately
- HTTP Path: For your SQL warehouse:
- Go to SQL Warehouses in Databricks
- Select your warehouse
- Find the connection details and copy the HTTP Path
Running the Server
Start the MCP server:
python main.py
You can test the MCP server using the inspector by running
npx @modelcontextprotocol/inspector python3 main.py
Available MCP Tools
The following MCP tools are available:
- run_sql_query(sql: str) - Execute SQL queries on your Databricks SQL warehouse
- list_jobs() - List all Databricks jobs in your workspace
- get_job_status(job_id: int) - Get the status of a specific Databricks job by ID
- get_job_details(job_id: int) - Get detailed information about a specific Databricks job
Example Usage with LLMs
When used with LLMs that support the MCP protocol, this server enables natural language interaction with your Databricks environment:
- "Show me all tables in the database"
- "Run a query to count records in the customer table"
- "List all my Databricks jobs"
- "Check the status of job #123"
- "Show me details about job #456"
Troubleshooting
Connection Issues
- Ensure your Databricks host is correct and doesn't include
https://prefix - Check that your SQL warehouse is running and accessible
- Verify your personal access token has the necessary permissions
- Run the included test script:
python test_connection.py
Security Considerations
- Your Databricks personal access token provides direct access to your workspace
- Secure your
.envfile and never commit it to version control - Consider using Databricks token with appropriate permission scopes only
- Run this server in a secure environment
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 iflow_mcp_mcp_databricks_server-0.1.0.tar.gz.
File metadata
- Download URL: iflow_mcp_mcp_databricks_server-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0537887f741463a6cbccd055f6ead94d8028c076c3cb78e84bc1081824c32ca
|
|
| MD5 |
343c733809e291d6a6f22f7030ad30c7
|
|
| BLAKE2b-256 |
12c946eb564f2069ea501e532e7a05a5ebec0c4ac83398dbc08021052a220797
|
File details
Details for the file iflow_mcp_mcp_databricks_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_mcp_databricks_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8721550a35ec28730640a17345e72480af80b9354f9494b8b6da6b3ebe13a95e
|
|
| MD5 |
d078ed822182cba5e07f7e2718b70ff2
|
|
| BLAKE2b-256 |
b20159834135dd425a89088fe7437c20377fc30b21d53e3867f361054a2ecfe2
|