The Databricks MCP Server provides a powerful interface for Large Language Models (LLMs) to interact with Databricks Unity Catalog metadata and execute SQL queries. This server helps AI agents autonomously explore data assets, understand data structures, analyze lineage, and run queries without human intervention at each step.
pip install -r requirements.txt
Or with uv
:
uv pip install -r requirements.txt
Option 1: Using a .env file (recommended)
Create a .env
file in the project root:
DATABRICKS_HOST="your-databricks-instance.cloud.databricks.com"
DATABRICKS_TOKEN="your-databricks-personal-access-token"
DATABRICKS_SQL_WAREHOUSE_ID="your-sql-warehouse-id"
Option 2: Setting environment variables directly
export DATABRICKS_HOST="your-databricks-instance.cloud.databricks.com"
export DATABRICKS_TOKEN="your-databricks-personal-access-token"
export DATABRICKS_SQL_WAREHOUSE_ID="your-sql-warehouse-id"
Note: You can find your SQL Warehouse ID in the Databricks UI under "SQL Warehouses". The warehouse ID is primarily needed for lineage fetching and SQL query execution.
Ensure the identity associated with your DATABRICKS_TOKEN
has:
Unity Catalog Permissions:
USE CATALOG
on catalogs to be accessedUSE SCHEMA
on schemas to be accessedSELECT
on tables to be queried or describedSQL Warehouse Permissions:
CAN_USE
permission on the SQL WarehouseToken Permissions:
Run the server for testing or with Agent Composer:
python main.py
To use with Cursor:
.cursor
directory and mcp.json
file:mkdir -p ~/.cursor
touch ~/.cursor/mcp.json
mcp.json
:{
"mcpServers": {
"databricks": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/mcp-databricks-server",
"run",
"main.py"
]
}
}
}
Alternative configuration using python
:
{
"mcpServers": {
"databricks": {
"command": "python",
"args": [
"/path/to/your/mcp-databricks-server/main.py"
]
}
}
}
List Catalogs:
list_uc_catalogs() -> str
Lists all available Unity Catalogs with names, descriptions, and types.
Describe Catalog:
describe_uc_catalog(catalog_name: str) -> str
Provides a summary of a specific catalog, listing all its schemas.
Describe Schema:
describe_uc_schema(catalog_name: str, schema_name: str, include_columns: Optional[bool] = False) -> str
Returns detailed information about a schema, optionally including column details.
Describe Table:
describe_uc_table(full_table_name: str, include_lineage: Optional[bool] = False) -> str
Provides detailed information about a table, including structure and optionally comprehensive lineage information.
execute_sql_query(sql: str) -> str
Executes SQL queries using the Databricks SDK and returns formatted results.
A typical LLM agent workflow might follow this pattern:
list_uc_catalogs()
describe_uc_catalog(catalog_name="prod_catalog")
describe_uc_schema(catalog_name="prod_catalog", schema_name="sales_schema")
describe_uc_table(full_table_name="prod_catalog.sales_schema.orders")
describe_uc_table(full_table_name="prod_catalog.sales_schema.orders", include_lineage=True)
execute_sql_query(sql="SELECT * FROM prod_catalog.sales_schema.orders LIMIT 10")
The execute_sql_query
tool has a wait_timeout
parameter set to '50s'. For very long-running queries, this timeout might be reached, potentially resulting in incomplete results.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "databricks" '{"command":"python","args":["/path/to/your/mcp-databricks-server/main.py"]}'
See the official Claude Code MCP documentation for more details.
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.
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": [
"/path/to/your/mcp-databricks-server/main.py"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"databricks": {
"command": "python",
"args": [
"/path/to/your/mcp-databricks-server/main.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect