Databricks MCP server

Bridges Claude with Databricks environments, enabling natural language interaction with SQL warehouses and job management systems through FastAPI-based tools for running queries, listing jobs, and retrieving detailed information.
Back to servers
Setup instructions
Provider
Jordi Neil
Release date
Mar 21, 2025
Language
Python
Stats
38 stars

This MCP server connects to the Databricks API, enabling Large Language Models (LLMs) to interact with your Databricks environment through natural language commands. With this integration, you can run SQL queries, list jobs, check job status, and retrieve detailed job information directly through conversational interfaces.

Prerequisites

  • Python 3.7+
  • Databricks workspace with:
    • Personal access token
    • SQL warehouse endpoint
    • Permissions to run queries and access jobs

Installation

Setting Up the Environment

  1. Clone the repository and create a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Create a .env file in the root directory with your Databricks credentials:
DATABRICKS_HOST=your-databricks-instance.cloud.databricks.com
DATABRICKS_TOKEN=your-personal-access-token
DATABRICKS_HTTP_PATH=/sql/1.0/warehouses/your-warehouse-id
  1. Test your connection (recommended):
python test_connection.py

Obtaining Databricks Credentials

To configure the MCP server, you'll need to gather the following credentials:

  1. Host: Your Databricks instance URL without the https:// prefix
  2. Token: Generate a personal access token:
    • Navigate to User Settings (username in top right)
    • Go to the "Developer" tab
    • Click "Manage" under "Access tokens"
    • Generate and save your new token
  3. HTTP Path: For your SQL warehouse:
    • Go to SQL Warehouses in Databricks
    • Select your warehouse
    • Copy the HTTP Path from the connection details

Running the Server

Start the MCP server with this simple command:

python main.py

To verify that the server is working correctly, you can use the MCP inspector:

npx @modelcontextprotocol/inspector python3 main.py

Available Tools

The server provides the following MCP tools for interacting with Databricks:

SQL Operations

  • run_sql_query(sql: str) - Execute SQL queries on your Databricks SQL warehouse

Job Management

  • list_jobs() - List all Databricks jobs in your workspace
  • get_job_status(job_id: int) - Get the status of a specific Databricks job
  • get_job_details(job_id: int) - Get detailed information about a specific job

Example Usage

When connected to an LLM that supports the MCP protocol, you can interact with your Databricks environment using natural language:

  • "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

Common Connection Issues

  • Verify your Databricks host doesn't include the https:// prefix
  • Ensure your SQL warehouse is running and accessible
  • Check that your personal access token has the necessary permissions
  • Run the test script to diagnose connection problems:
python test_connection.py

Security Best Practices

  • Keep your personal access token secure and never commit it to version control
  • Use tokens with minimal required permissions
  • Run the server in a secure, controlled environment

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "databricks" '{"command":"python","args":["main.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "databricks": {
            "command": "python",
            "args": [
                "main.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "databricks": {
            "command": "python",
            "args": [
                "main.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later