### Deploy and Start App with Databricks Apps CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Sequence of commands to build the wheel, sync the project to a Databricks workspace path, deploy the application by name, and finally start it using the `databricks apps` CLI. Replace placeholders like `` and paths. ```bash uv build --wheel databricks sync ./build -p /Workspace/Users/my-email@org.com/my-app databricks apps deploy my-app-name -p --source-code-path /Workspace/Users/my-email@org.com/my-app databricks apps start my-app-name -p ``` -------------------------------- ### Python Example: Connect and Call Tool Source: https://github.com/databrickslabs/mcp/blob/master/src/databricks/labs/mcp/static/index.html An example demonstrating how to connect to a streamable HTTP server using the Databricks SDK and MCP client, initialize a session, and call a tool. ```python from databricks.sdk import WorkspaceClient from mcp.client.streamable_http import streamablehttp_client as connect from mcp import ClientSession client = WorkspaceClient() async def main(): # Connect to a streamable HTTP server headers = client.config.authenticate() app_url = "https://your.app.url.databricksapps.com/api/mcp/" async with connect(app_url, headers=headers) as ( read_stream, write_stream, _, ): # Create a session using the client streams async with ClientSession(read_stream, write_stream) as session: # Initialize the connection await session.initialize() # Call a tool tool_result = await session.call_tool("echo", {"message": "hello"}) ``` -------------------------------- ### Start Local Server with Uvicorn Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Starts the Uvicorn server locally for development, enabling automatic reloads when code changes are detected. This is crucial for rapid iteration during local testing. ```bash uvicorn custom_server.app:app --reload ``` -------------------------------- ### Configure Databricks Bundle App Command Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Specifies the command to run for the Databricks application within the `app.yaml` configuration file. This tells Databricks how to start the custom server. ```yaml command: ["uvicorn", "custom_server.app:app"] ``` -------------------------------- ### Run Tests Source: https://github.com/databrickslabs/mcp/blob/master/CONTRIBUTING.md Installs requirements using `uv sync` and then runs tests using `uv run pytest tests`. ```bash uv sync uv run pytest tests ``` -------------------------------- ### Build, Deploy, and Run with Databricks Bundle Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Builds a wheel package for the application, deploys it to Databricks Apps, and then runs the deployed custom-mcp-server. This sequence is used with the `databricks bundle` CLI. ```bash uv build --wheel databricks bundle deploy databricks bundle run custom-mcp-server ``` -------------------------------- ### Create Databricks App Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Creates a new Databricks App instance named 'mcp-custom-server'. This command provisions the necessary infrastructure on Databricks Apps to host the custom server. ```bash databricks apps create mcp-custom-server ``` -------------------------------- ### Sync Dependencies with uv Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Synchronizes project dependencies using the `uv` package manager. This is a common step for setting up the local development environment. ```bash uv sync ``` -------------------------------- ### MCP Server Streamable HTTP URL Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Provides the example URL for connecting to the deployed MCP server using the Streamable HTTP transport. It emphasizes the requirement for the URL to end with `/mcp/`. ```Plaintext https://your-app-url.usually.ends.with.databricksapps.com/mcp/ ``` -------------------------------- ### Configure Databricks Authentication Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Sets the Databricks configuration profile and logs in to authenticate with Databricks. This is a prerequisite for deploying or managing resources via the Databricks CLI. ```bash export DATABRICKS_CONFIG_PROFILE= # e.g. custom-mcp-server databricks auth login --profile "$DATABRICKS_CONFIG_PROFILE" ``` -------------------------------- ### Configure app.yml for Databricks Apps CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Example `app.yml` configuration file for deploying the UC MCP server using the `databricks apps` CLI. Specifies the Uvicorn command and environment variables. ```yaml command: ["uvicorn", "databricks.labs.mcp.servers.unity_catalog.app:app"] env: - name: SCHEMA_FULL_NAME value: catalog.schema - name: GENIE_SPACE_IDS value: '["space1","space2"]' ``` -------------------------------- ### Configure app.yml for Databricks Apps Deployment Source: https://github.com/databrickslabs/mcp/blob/master/README.md Example `app.yml` configuration for deploying an MCP server using `databricks apps` CLI. It specifies the Uvicorn command to run the application and sets required environment variables like `SCHEMA_FULL_NAME` and `GENIE_SPACE_IDS`. ```yaml command: ["uvicorn", "databricks.labs.mcp.servers.unity_catalog.app:app"] env: - name: SCHEMA_FULL_NAME value: catalog.schema - name: GENIE_SPACE_IDS value: '["space1","space2"]' ``` -------------------------------- ### Sync Source Code and Deploy Databricks App Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Uploads local source code to a specified path in the Databricks workspace and then deploys the Databricks App using the synced code. This command is part of the `databricks apps` CLI deployment workflow. ```bash DATABRICKS_USERNAME=$(databricks current-user me | jq -r .userName) databricks sync . "/Users/$DATABRICKS_USERNAME/my-mcp-server" databricks apps deploy mcp-custom-server --source-code-path "/Workspace/Users/$DATABRICKS_USERNAME/my-mcp-server" ``` -------------------------------- ### Configure MCP Server for Databricks Tools Source: https://github.com/databrickslabs/mcp/blob/master/src/databricks/labs/mcp/servers/developer_tools/README.md Example JSON configuration to add the Databricks developer tools MCP server to a client's configuration. This specifies the command and arguments needed to run the server, typically using a package manager like 'uv'. ```json { "mcpServers": { "databricks_developer_tools": { "command": "/path/to/uv/executable/uv", "args": [ "--directory", "/path/to/this/repo/servers/developer_tools", "run", "databricks-developer-tools" ] } } } ``` -------------------------------- ### Get Databricks Authentication Token Source: https://github.com/databrickslabs/mcp/blob/master/src/databricks/labs/mcp/static/index.html Command to retrieve an authentication token using the Databricks CLI, required for connecting to services. ```bash databricks auth token -p ``` -------------------------------- ### Get Databricks Auth Token Source: https://github.com/databrickslabs/mcp/blob/master/README.md Retrieves an authentication token for the Databricks CLI profile, which is required for connecting to deployed Databricks Apps. ```bash databricks auth token -p your-profile-name ``` -------------------------------- ### Retrieve Databricks Auth Token Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/README.md Retrieves the authentication token for a specified Databricks profile. This token is used for authenticating API requests, such as connecting to the MCP server. ```bash databricks auth token -p ``` -------------------------------- ### Claude Desktop Config for Databricks Unity Catalog MCP Server Source: https://github.com/databrickslabs/mcp/blob/master/README.md Example JSON configuration for Claude Desktop to connect to a Databricks Unity Catalog MCP server. It specifies the command to run the server and arguments like catalog, schema, and Genie space IDs. ```json { "mcpServers": { "databricks_unity_catalog": { "command": "/path/to/uv/executable/uv", "args": [ "--directory", "/path/to/this/repo", "run", "unitycatalog-mcp", "-s", "your_catalog.your_schema", "-g", "genie_space_id_1,genie_space_id_2" ] } } } ``` -------------------------------- ### Deploy UC MCP Server using Databricks Apps CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Deploys the UC MCP server on Databricks Apps using the `databricks apps` CLI. This involves building, syncing, deploying, and starting the application. ```bash uv build --wheel databricks sync ./build -p /Workspace/Users/my-email@org.com/my-app databricks apps deploy my-app-name -p --source-code-path /Workspace/Users/my-email@org.com/my-app databricks apps start my-app-name -p ``` -------------------------------- ### Format and Lint Code Source: https://github.com/databrickslabs/mcp/blob/master/CONTRIBUTING.md Formats code using `make fmt` and runs linters using `make lint` from the repository root. ```bash make fmt make lint ``` -------------------------------- ### Connect to Unity Catalog MCP Server Source: https://github.com/databrickslabs/mcp/blob/master/src/databricks/labs/mcp/static/index.html Details on how to connect to the Unity Catalog MCP server, including transport, URL, and authentication methods. ```APIDOC Connection Details: Transport: Streamable HTTP Server URL: https://your.app.url.databricksapps.com/api/mcp/ Authentication Token: Obtain using the Databricks CLI: `databricks auth token -p ` Client Connection: Use tools like Cloude, MCP Inspector, or other compatible clients. Ensure the server URL is set to `https://your.app.url.databricksapps.com/api/mcp/`. Use the `Streamable HTTP` Transport with the Authentication header. ``` -------------------------------- ### Build Python Wheel for Databricks Apps Deployment Source: https://github.com/databrickslabs/mcp/blob/master/README.md Navigates to the project directory and builds the Python wheel package required for deployment with `databricks apps` CLI. This step is crucial before syncing or deploying the application. ```bash cd /path/to/this/repo uv build --wheel ``` -------------------------------- ### Build Wheel with uv CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Builds the Python wheel package for the MCP server using the `uv` command-line tool. This is a prerequisite for deploying the server. ```bash cd /path/to/this/repo uv build --wheel ``` -------------------------------- ### Connect to MCP Server using Python Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/src/custom_server/static/index.html Demonstrates how to connect to a streamable HTTP MCP server on Databricks Apps using the Databricks SDK and MCP client libraries. It shows establishing a connection, creating a session, initializing it, and calling a tool. ```python from databricks.sdk import WorkspaceClient from databricks_mcp import DatabricksOAuthClientProvider from mcp.client.streamable_http import streamablehttp_client as connect from mcp import ClientSession client = WorkspaceClient() async def main(): # Connect to a streamable HTTP server app_url = "https://your.app.url.databricksapps.com/mcp/" async with connect(app_url, auth=DatabricksOAuthClientProvider(client)) as ( read_stream, write_stream, _, ): # Create a session using the client streams async with ClientSession(read_stream, write_stream) as session: # Initialize the connection await session.initialize() # Call a tool tool_result = await session.call_tool("echo", {"message": "hello"}) ``` -------------------------------- ### Deploy UC MCP Server using Databricks Bundle CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Deploys the UC MCP server on Databricks Apps using the `databricks bundle` CLI. Requires setting environment variables for schema and Genie space IDs. ```bash BUNDLE_VAR_schema_full_name=catalog.schema BUNDLE_VAR_genie_space_ids=["space1","space2"] \ databricks bundle deploy -p your-profile-name ``` -------------------------------- ### Format and Lint Python Code Source: https://github.com/databrickslabs/mcp/blob/master/CONTRIBUTING.md Runs code formatting and linting tools from the repository root directory to ensure code style consistency and identify potential issues. ```bash make fmt make lint ``` -------------------------------- ### Run UC MCP Server App using Databricks Bundle CLI Source: https://github.com/databrickslabs/mcp/blob/master/README.md Runs the UC MCP server application on Databricks Apps after deployment using the `databricks bundle` CLI. Ensure environment variables are correctly set. ```bash BUNDLE_VAR_schema_full_name=catalog.schema BUNDLE_VAR_genie_space_ids=["space1","space2"] \ databricks bundle run mcp-on-apps -p your-profile-name ``` -------------------------------- ### UV Dependency for Apps CLI Deployment Source: https://github.com/databrickslabs/mcp/blob/master/examples/custom-server/requirements.txt This snippet highlights the 'uv' tool as a conditional dependency. It is required specifically when deploying the project using the applications CLI. ```text uv ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.