Deploy your MCP server as a Databricks App.
Databricks builds a container from your synced source and app.yaml, runs it,
and exposes it behind your workspace's authentication.
- Transport: MCP over streamable-HTTP at
/mcp(stateless); health at/health - Port: Databricks injects
DATABRICKS_APP_PORT(defaults to8000); this template'sapp.pydetects it and serves HTTP automatically — no code changes.
How the template already supports this:
src/example_server/app.pychecks forDATABRICKS_APP_PORT(and genericPORT) and switches to streamable-HTTP on that port. That's the only wiring Databricks Apps needs.
| Variable | Purpose |
|---|---|
DATABRICKS_APP_PORT |
Port your server must listen on (default 8000) |
DATABRICKS_HOST |
Workspace URL |
DATABRICKS_CLIENT_ID |
Service principal client ID |
DATABRICKS_CLIENT_SECRET |
OAuth secret |
The last three are available if your tools need to call back into Databricks (e.g. query a table). The example tool doesn't use them.
# macOS
brew tap databricks/tap && brew install databricks
# or see: https://docs.databricks.com/dev-tools/cli/install.html
databricks --versiondatabricks auth login --host https://<your-workspace>.cloud.databricks.com
databricks current-user me # confirm you're logged inProfile name gotcha:
databricks auth loginprompts for a profile name and defaults it to your workspace host (e.g.dbc-xxxx) — notDEFAULT. Note the name you choose; you must setDATABRICKS_CONFIG_PROFILEin.env(below) to that exact name, or the deploy script's auth check will fail with "not authenticated". List your profiles withdatabricks auth profiles.
Databricks Apps must be enabled on your workspace. If
appscommands fail with a feature error, ask your workspace admin to enable Databricks Apps.
cp deploy/databricks/.env.example deploy/databricks/.env
# edit:
# - APP_NAME: your server's name (lowercase, hyphens)
# - SOURCE_CODE_PATH: absolute /Workspace path (replace <you> with your user)
# - DATABRICKS_HOST / DATABRICKS_CONFIG_PROFILE: optional, if not using DEFAULT
set -a; source deploy/databricks/.env; set +a.env holds no secrets — auth lives in your CLI login. It is git-ignored.
set -a; source deploy/databricks/.env; set +a
bash deploy/databricks/deploy-databricks-app.shThe script is idempotent and:
- Confirms the CLI is installed and authenticated.
- Stages
app.yamlat the repo root (where Databricks expects it) for the sync. - Ensures the App exists (create-or-reuse).
- Syncs the repo to
SOURCE_CODE_PATHin your workspace. - Runs
databricks apps deployfrom that path. - Prints the app URL (
/mcp+/health).
The first deploy builds the container and can take a few minutes.
# Private apps are auth-gated — an unauthenticated curl returns 302/401 (expected).
bash deploy/databricks/smoke-test.sh https://<app-url>
# Authenticated check:
DATABRICKS_TOKEN="$(databricks auth token --output json | jq -r .access_token)" \
bash deploy/databricks/smoke-test.sh https://<app-url>
# If you saved a named profile (not DEFAULT), pass it and the host explicitly:
# DATABRICKS_TOKEN="$(databricks --profile <your-profile> auth token \
# --host https://<your-workspace>.cloud.databricks.com --output json | jq -r .access_token)" \
# bash deploy/databricks/smoke-test.sh https://<app-url>Databricks Apps are gated by workspace auth, so an MCP client must present a
bearer token. For watsonx Orchestrate or Claude (remote HTTP), register
the endpoint and supply the token as an Authorization: Bearer <token> header
via the client's connection/credential mechanism.
For a quick local test with an MCP client that supports HTTP + headers:
{
"mcpServers": {
"example-mcp": {
"type": "http",
"url": "https://<app-url>/mcp",
"headers": { "Authorization": "Bearer <DATABRICKS_TOKEN>" }
}
}
}Token from
databricks auth token. Tokens are short-lived; for a durable integration use a service principal with access to the app.
set -a; source deploy/databricks/.env; set +a
databricks apps delete "${APP_NAME}"
# Optionally remove the synced source:
# databricks workspace delete "${SOURCE_CODE_PATH}" --recursive| File | Purpose |
|---|---|
app.yaml |
Databricks Apps runtime config (the command that starts the server) |
.env.example |
Deploy coordinates template (copy to .env, no secrets) |
deploy-databricks-app.sh |
Idempotent create → sync → deploy |
smoke-test.sh |
Live /health + /mcp reachability check (auth-aware) |
README.md |
This runbook |
- Auth-gated by default: Databricks Apps sit behind workspace SSO/OAuth, so unauthenticated probes return 302/401 — that's expected, not a failure. Use a bearer token to reach the app programmatically.
- Renamed package: if you renamed
example_server, update the module path inapp.yaml(python -m <your_pkg>.app). app.yamllocation: Databricks readsapp.yamlfrom the deployed source root. The deploy script stages this kit's copy at the repo root for the sync and removes it afterward; if you prefer, commit a copy at the repo root instead.- Stateless HTTP: the server runs stateless streamable-HTTP, which scales cleanly on Apps (no sticky sessions required).