Databricks MCP Helpers

0.9.0 · active · verified Sun Apr 12

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

Install

Imports

Quickstart

Initialize the `DatabricksMcpClient` by providing configuration, typically sourced from environment variables. This example demonstrates basic client instantiation, which validates your host and token against expected formats but doesn't make an external API call by default unless you interact with `client.account_client` or similar.

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.")

view raw JSON →