MCP Connector

Query Databricks SQL Warehouses and Jobs

An MCP server connecting an LLM to Databricks - run SQL queries and list, check, or inspect job status conversationally.

Works with databricks

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated Apr 2025
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Empower LLMs to interact with your Databricks environment. Execute SQL queries against warehouses and manage job statuses directly from your AI applications.

Outcomes

What it gets done

01

Execute SQL queries against Databricks SQL warehouses

02

Retrieve and display lists of Databricks jobs

03

Check the status and details of specific Databricks jobs

04

Connect to Databricks using host, token, and HTTP path

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-databricks | bash

Capabilities

Tools your agent gets

run_sql_query

Executes SQL queries against your Databricks SQL warehouse

list_jobs

Displays all Databricks jobs in your workspace

get_job_status

Gets the status of a specific Databricks job by ID

get_job_details

Gets detailed information about a specific Databricks job

Overview

Databricks MCP Server

This MCP server connects an LLM to Databricks with four tools: running SQL queries on a SQL warehouse, listing jobs, and checking job status or details. It requires a personal access token, host, and SQL warehouse HTTP path configured via a .env file. Use it when an LLM needs to query Databricks SQL warehouses or monitor jobs conversationally. It is scoped to SQL execution and job listing/status - not general workspace administration.

What it does

An MCP server that connects to the Databricks API, giving an LLM four tools: run_sql_query(sql) to execute SQL against a Databricks SQL warehouse, list_jobs() to list all jobs in the workspace, get_job_status(job_id) to check a specific job's status, and get_job_details(job_id) for detailed information about a job. It turns natural-language requests - "run a query to count records in the customer table," "list all my Databricks jobs," "check the status of job #123" - into direct Databricks API calls.

When to use - and when NOT to

Use it when an LLM needs to query Databricks SQL warehouses or monitor and inspect Databricks jobs conversationally. It requires a Databricks workspace with a personal access token, an SQL warehouse endpoint, and permission to run queries and access jobs. Because that access token grants direct workspace access, treat it like any other credential: keep the .env file secure and out of version control, scope the token's permissions no wider than needed, and run the server in a secure environment. It is not a general Databricks admin tool - it's scoped to SQL execution and job listing, status, and details, not cluster management, notebook editing, or other workspace operations.

Capabilities

run_sql_query, list_jobs, get_job_status, and get_job_details cover the full tool surface. A bundled test_connection.py script lets you verify Databricks connectivity before relying on the server, and it's compatible with the MCP Inspector for interactive testing via npx @modelcontextprotocol/inspector python3 main.py.

How to install

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Create a .env file with DATABRICKS_HOST, DATABRICKS_TOKEN, and DATABRICKS_HTTP_PATH. Get the host from the workspace URL, generate the token under User Settings > Developer > Manage access tokens, and copy the HTTP Path from the target SQL warehouse's connection details. Test the setup with python test_connection.py, then start the server with python main.py. If the connection fails, confirm the host doesn't include an https:// prefix, that the SQL warehouse is running and accessible, and that the token has the necessary permissions.

Who it's for

Data engineers and analysts who want to run Databricks SQL queries and check job status conversationally through an LLM, instead of switching to the Databricks UI for routine query and job-monitoring tasks. Requires Python 3.7+. Typical example prompts the server is designed to handle include "show me all tables in the database" and "show me details about job #456," turning routine warehouse and job-monitoring checks into a single conversational request instead of a UI round trip.

Source README

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

  1. Clone this repository
  2. Create and activate a virtual environment (recommended):
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install dependencies:
    pip install -r requirements.txt
    
  4. Create a .env file 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
    
  5. Test your connection (optional but recommended):
    python test_connection.py
    

Obtaining Databricks Credentials

  1. Host: Your Databricks instance URL (e.g., your-instance.cloud.databricks.com)
  2. 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
  3. 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:

  1. run_sql_query(sql: str) - Execute SQL queries on your Databricks SQL warehouse
  2. list_jobs() - List all Databricks jobs in your workspace
  3. get_job_status(job_id: int) - Get the status of a specific Databricks job by ID
  4. 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 .env file and never commit it to version control
  • Consider using Databricks token with appropriate permission scopes only
  • Run this server in a secure environment

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.