Register an external MCP server
This feature is in Beta. Account admins can control access to this feature from the account console Previews page. See Manage Databricks previews.
This page describes how to register a self-hosted or third-party MCP server as an MCP Service in Unity Catalog, then invoke it from AI Playground, the command line, or your agent code. Registering the server as a Unity Catalog securable lets Unity AI Gateway proxy every call with managed credentials, so agents never handle the server's tokens. To restrict which tools the service exposes and govern individual calls, see Govern an MCP service.
For a ready-to-use SaaS tool with no server to host, use a Databricks-provided MCP Service instead.
Requirements
- A workspace enabled for Unity Catalog.
- The Unity AI Gateway Beta and the Managed MCP Servers preview enabled for your account. See Manage Databricks previews.
- A workspace in a region where Model Serving is supported. See Model serving features availability.
Register an external MCP server
Register your own external MCP server as an MCP Service in five steps:
- Create a Unity Catalog connection to the MCP server.
- Create the MCP Service from that connection.
- Authenticate, if the connection uses per-user OAuth.
- Grant access to your teammates.
- Invoke the service, then govern it with tool selection and service policies.
The external MCP server must use the Streamable HTTP transport mechanism. You need these permissions:
- To create the connection,
CREATE CONNECTIONon the schema where you create it. - To create an MCP Service,
USE CATALOGandUSE SCHEMAon the parent catalog and schema,CREATE SERVICEon the schema, andUSE CONNECTIONon the connection that the MCP Service references. - To invoke an MCP Service,
EXECUTEon the MCP Service,USE CATALOGandUSE SCHEMAon its parent catalog and schema, and assignment to the workspace where you issue the request.
Invoking an MCP Service requires no privilege on the underlying connection—EXECUTE on the MCP Service is sufficient. Don't grant USE CONNECTION to end users: it lets them call the external server directly through the connection, or register their own MCP Service on it, bypassing the tool selection, service policies, and auditing of your MCP Service. Reserve connection access for service authors and administrators.
Step 1. Create a connection
An MCP Service references a Unity Catalog HTTP connection that securely stores the external server's endpoint and credentials. Databricks runs a managed proxy in front of it to handle authentication and token refresh, so you don't embed credentials in your agent or client code.
Create the connection at the schema level so it's governed alongside the MCP Service. You can set it up ahead of time with the steps below, or create one while you create the MCP Service by clicking Create new connection. Metastore-level connections are supported but not recommended.
Choose one of two ways:
- Create an HTTP connection
- Install from Marketplace
For any MCP server, including self-hosted or third-party servers:
- Go to Catalog > Connections > Create connection.
- Select HTTP as the connection type.
- Enter the MCP server URL.
- Choose an authentication type: bearer token, OAuth M2M, OAuth U2M, or Dynamic Client Registration. For setup details, see Create a connection to the external service.
For managed-OAuth providers—Glean, GitHub, Atlassian, and Slack—Databricks manages the credentials, so you don't register your own OAuth app. See Managed OAuth providers.
Use a curated MCP server from Databricks Marketplace with a pre-configured connection. See Get access to external MCP servers.
Step 2. Create the MCP Service
You can create an MCP Service from the UI or with the REST API. The Beta does not support SQL DDL for MCP Services.
- UI
- REST API
- In your Databricks workspace, go to AI Gateway > MCPs > Register MCP Server, or go to Catalog, select a schema, and click Create > MCP Service.
- Enter the catalog, schema, and a name for the MCP Service. The name can't be changed after creation.
- Select an existing HTTP connection to the MCP server, or click Create new connection to create one. Browse under a schema to select a schema-level connection; to use a metastore-level connection, turn off Browse under a schema.
- Under Tools, select which tools to make available. See Select which tools are exposed.
- Optionally, add a comment that describes the MCP Service.
- Click Create. The MCP Service is published to the catalog and schema you specified.
Create an MCP Service that references an existing Unity Catalog HTTP connection. Set parent to the target schema and mcp_service_id to the service name:
databricks api post \
"/api/2.1/unity-catalog/mcp-services?parent=schemas/main.default&mcp_service_id=my_mcp" \
--json '{
"comment": "External MCP server",
"config": {
"connection": {
"name": "connections/main.default.my_connection"
},
"include_tool_selectors": []
}
}'
include_tool_selectors controls which tools the service exposes. An empty list exposes all tools. See Select which tools are exposed.
Update an existing MCP Service with a PATCH request and an update_mask that names the fields to change:
databricks api patch \
"/api/2.1/unity-catalog/mcp-services/main.default.my_mcp?update_mask=comment" \
--json '{ "comment": "Updated description" }'
Step 3. Authenticate
If the MCP Service references a connection that uses per-user OAuth, complete a one-time login before the first call:
- Open the MCP Service detail page in Catalog Explorer.
- Click Login and complete the provider's OAuth consent flow.
- After you sign in, the detail page automatically shows the list of discovered tools.
Unity Catalog stores the token against your identity. If you call the MCP Service before logging in, AI Gateway returns an error prompting you to authenticate.
Step 4. Grant access to teammates
By default, only the MCP Service owner can invoke it. Grant EXECUTE to let other users, groups, or service principals invoke the service. A single EXECUTE grant covers all of the service's tools.
- UI
- REST API
- Open the MCP Service in Catalog Explorer, or go to AI Gateway > MCPs and select the service.
- Go to the Permissions tab.
- Click Grant.
- Select the users, groups, or service principals to give access to.
- Select the EXECUTE privilege.
- Click Grant.
databricks api patch \
"/api/2.1/unity-catalog/permissions/mcp_service/main.default.my_mcp" \
--json '{
"changes": [
{ "principal": "data-team", "add": ["EXECUTE"] }
]
}'
Step 5. Invoke an MCP Service
Try an MCP Service in AI Playground, from the command line, or from your agent or client code.
Test the MCP Service
- AI Playground
- CURL
Test an MCP Service's tools in the UI without writing code:
- Go to AI Playground in your Databricks workspace.
- Select a model with the Tools enabled label.
- Click Tools > + Add tool and select MCP Servers.
- Select External MCP servers, then select the MCP Service.
- Chat with the model to see how it calls the MCP Service's tools.
You can also test from Genie Code — see Add MCP servers to the Assistant.
For a quick command-line check, use the generated request on the MCP Service detail page. In Get started, click Generate Access Token to copy an access token into the request examples. The examples pass the token as a bearer token in the Authorization header.
You can also authenticate the Databricks CLI to your workspace, then use databricks auth token to get an OAuth access token:
databricks auth login --host https://<workspace-url>
All requests go to the same MCP Service endpoint—the JSON-RPC method in the request body selects the operation. List the tools the service exposes:
TOKEN=$(databricks auth token | jq -r .access_token)
curl -s -X POST \
"https://<workspace-url>/ai-gateway/mcp-services/main.default.my_mcp" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
Call a tool:
curl -s -X POST \
"https://<workspace-url>/ai-gateway/mcp-services/main.default.my_mcp" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"<tool_name>","arguments":{}}}'
Use from agent code or a coding agent
- Agent code (OpenAI Agents SDK, LangGraph, or Model Serving): see Use MCP servers in agents.
- AI assistants and coding agents (Claude, Claude Code, Cursor): see Connect MCPs to AI assistants and coding agents.
Next steps
- Govern an MCP service to restrict which tools the service exposes and apply service policies.
- Connect agents to third-party tools with MCP Services for an overview of MCP Services and Databricks-provided services.
- AI governance with Unity AI Gateway to govern MCP servers and LLM endpoints from a central location.