/databricks-skills:cookbook-aimlfrom databricks-skills
Invokes ML models on Databricks Model Serving, queries Vector Search indexes, and connects to MCP servers from Databricks Apps (Dash, Streamlit, Reflex, FastAPI).
Ships in databricks-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Invoke models on Model Serving, query Vector Search indexes, and connect to MCP servers from your Databricks App.
The SDK call is framework-agnostic. Wrap it in your framework's UI pattern.
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="custom-regression-model",
dataframe_split={
"columns": ["feature1", "feature2"],
"data": [[1.5, 2.5]]
}
)
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ChatMessage, ChatMessageRole
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="chat-assistant-model",
messages=[
ChatMessage(role=ChatMessageRole.SYSTEM, content="You are a helpful assistant."),
ChatMessage(role=ChatMessageRole.USER, content="Provide tips for Databricks Apps."),
],
)
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="llm-completions-model",
prompt="Generate a recipe for scalable Databricks Apps.",
temperature=0.5,
)
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
response = w.serving_endpoints.query(
name="embedding-model",
input="Databricks provides a unified analytics platform.",
)
Generate embeddings and query a vector search index:
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
openai_client = w.serving_endpoints.get_open_ai_client()
def get_embeddings(text):
response = openai_client.embeddings.create(
model="databricks-gte-large-en", input=text
)
return response.data[0].embedding
def run_vector_search(prompt: str, index_name: str, columns: list[str]):
vector = get_embeddings(prompt)
result = w.vector_search_indexes.query_index(
index_name=index_name,
columns=columns,
query_vector=vector,
num_results=3,
)
return result.result.data_array
Use Unity Catalog HTTP connections to connect to MCP servers.
Streamlit:
import streamlit as st
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ExternalFunctionRequestHttpMethod
token = st.context.headers.get("X-Forwarded-Access-Token")
w = WorkspaceClient(token=token, auth_type="pat")
def init_mcp_session(connection_name):
response = w.serving_endpoints.http_request(
conn=connection_name,
method=ExternalFunctionRequestHttpMethod.POST,
path="/",
json={"jsonrpc": "2.0", "id": "init-1", "method": "initialize", "params": {}},
)
return response.headers.get("mcp-session-id")
session_id = init_mcp_session("github_mcp_connection")
response = w.serving_endpoints.http_request(
conn="github_mcp_connection",
method=ExternalFunctionRequestHttpMethod.POST,
path="/",
headers={"Mcp-Session-Id": session_id},
json={"jsonrpc": "2.0", "id": "list-1", "method": "tools/list"},
)
st.json(response.json())
Reflex:
import reflex as rx
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ExternalFunctionRequestHttpMethod
class McpState(rx.State):
response_data: str = ""
@rx.event(background=True)
async def send_request(self):
headers = self.router.headers
token = getattr(headers, "x_forwarded_access_token", "")
w = WorkspaceClient(token=token, auth_type="pat")
init_resp = w.serving_endpoints.http_request(
conn="github_mcp_connection",
method=ExternalFunctionRequestHttpMethod.POST,
path="/",
json={"jsonrpc": "2.0", "id": "init-1", "method": "initialize", "params": {}},
)
session_id = init_resp.headers.get("mcp-session-id")
response = w.serving_endpoints.http_request(
conn="github_mcp_connection",
method=ExternalFunctionRequestHttpMethod.POST,
path="/",
headers={"Mcp-Session-Id": session_id},
json={"jsonrpc": "2.0", "id": "list-1", "method": "tools/list"},
)
async with self:
self.response_data = str(response.json())
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.serving import ExternalFunctionRequestHttpMethod
w = WorkspaceClient()
response = w.serving_endpoints.http_request(
conn="github_connection",
method=ExternalFunctionRequestHttpMethod.GET,
path="/",
headers={"Accept": "application/vnd.github+json"},
json={"jsonrpc": "2.0", "id": "init-1", "method": "initialize", "params": {}},
)
| Recipe | Resources |
|---|---|
| Model serving | Model Serving endpoint |
| Vector search | Vector Search endpoint + index |
| MCP | Unity Catalog HTTP Connection with MCP base path |
| Recipe | Permissions |
|---|---|
| Model serving | CAN QUERY on the serving endpoint |
| Vector search | USE CATALOG, USE SCHEMA, SELECT on the VS index |
| MCP connections | USE CONNECTION on the HTTP Connection |
| MCP (OBO) | Additionally configure User authorization scopes |
databricks-sdk
For MCP, also add mcp[cli]. Plus your framework package.
READY state before queryingget_open_ai_client())mcp-session-id for subsequent requestsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
databricks-apps, model-serving, vector-search, mcp-integration
npx claudepluginhub databricks-solutions/databricks-apps-cookbook --plugin databricks-skills12 skills in this plugin
/cookbook-authenticationImplement authentication in Databricks Apps: get current user info, on-behalf-of-user (OBO) auth, service principal auth, and OAuth patterns. Use when the user asks about auth, user tokens, service principals, OAuth, or OBO in Dash, Streamlit, Reflex, or FastAPI./cookbook-biEmbed AI/BI dashboards and integrate Genie Spaces into Databricks Apps. Use when the user wants to embed a Databricks dashboard or build a chat interface with the Genie Conversations API in Dash, Streamlit, or Reflex./build-appBuild Databricks Apps from this cookbook: minimum folder layout and app.yaml per framework (Dash, Streamlit, Reflex, FastAPI), multi-page wiring, docs category-first workflow then README recipes, runtime rules, combining recipes. Feature code only from repo samples and docs/docs/*.mdx. After the app runs, follow [`productionize-app-dab`](../productionize-app-dab/SKILL.md) for Databricks Asset Bundles (DABs). Do not use for AppKit, Genie App Builder, AI/BI dashboards, or coding-agent MCP config — see When not to use this skill.Other plugins' skills for the same job