Databricks MCP Helpers
The `databricks-mcp` library provides helper utilities specifically designed for developers interacting with Databricks Workflows and the Databricks Control Plane (MCP). It wraps and extends the `databricks-sdk` to offer higher-level abstractions for common MCP operations, such as deployment stack management. Currently at version `0.9.0`, it is actively developed by DatabricksLabs, with releases tied to internal needs and `databricks-sdk` updates, typically on an infrequent basis.
Warnings
- breaking The library is currently at version `0.x.x` (pre-1.0), meaning API stability is not guaranteed. Breaking changes may be introduced in minor or patch releases without strict semantic versioning.
- gotcha Authentication requires specific environment variables (`DATABRICKS_HOST`, `DATABRICKS_TOKEN`, `DATABRICKS_ACCOUNT_ID`). A common mistake is using a Databricks Workspace token instead of an Account-level token, which is necessary for Control Plane operations.
- gotcha `databricks-mcp` is a wrapper around `databricks-sdk`. If `databricks-sdk` introduces breaking changes or significant behavioral shifts that `databricks-mcp` does not immediately accommodate, it can lead to unexpected errors.
- gotcha This library is primarily for Databricks Control Plane (MCP) interactions and complex workflows. For simpler workspace-level operations (e.g., managing notebooks, jobs, clusters within a single workspace), directly using the `databricks-sdk` might be more appropriate and less complex.
Install
-
pip install databricks-mcp
Imports
- DatabricksMcpClient
from databricks_mcp.databricks_mcp_client import DatabricksMcpClient
- DatabricksMcpConfig
from databricks_mcp.databricks_config import DatabricksMcpConfig
Quickstart
import os
from databricks_mcp.databricks_config import DatabricksMcpConfig
from databricks_mcp.databricks_mcp_client import DatabricksMcpClient
# Ensure DATABRICKS_HOST, DATABRICKS_TOKEN, and DATABRICKS_ACCOUNT_ID
# are set as environment variables for a real connection.
# Token should be a Databricks Account-level token.
try:
config = DatabricksMcpConfig(
host=os.environ.get("DATABRICKS_HOST", "https://accounts.cloud.databricks.com"),
token=os.environ.get("DATABRICKS_TOKEN", "dapi-example-token"),
account_id=os.environ.get("DATABRICKS_ACCOUNT_ID", "00000000-0000-0000-0000-000000000000"),
)
client = DatabricksMcpClient(config)
print(f"Databricks MCP Client initialized successfully for host: {client.config.host}")
# The client object contains underlying databricks_sdk clients (e.g., client.account_client)
# which can be used to perform actual operations. This quickstart only demonstrates initialization.
except Exception as e:
print(f"Failed to initialize Databricks MCP Client: {e}")
print("Please ensure DATABRICKS_HOST, DATABRICKS_TOKEN, and DATABRICKS_ACCOUNT_ID")
print("environment variables are correctly configured and point to your Databricks Account.")