Skip to main content

MCP API and SDK reference

Use these examples to automate MCP setup. The API represents each MCP as an McpService resource. For the workspace UI, see External MCP servers. For access controls and policies, see Govern an MCP.

Prerequisites​

Replace main.default.my_mcp, the connection name, and data-team with your own values. Creating MCPs with SQL commands such as CREATE MCP SERVICE isn't supported.

API operations​

The MCP REST API provides these operations. Follow each link for its fields, permissions, and responses.

Operation

Use it to

Create

Register an MCP server through an HTTP connection.

List

Find MCPs you can access in a schema.

Get

Read an MCP's configuration and current etag.

Update

Change the comment, connection, tool selection, or rate limits.

Delete

Remove a registered MCP.

Sign in

Sign in or re-authenticate the caller with the provider.

Check sign-in

Read the caller's provider login state.

Sign out

Revoke the caller's provider credential.

Operation

Use it to

Create

Register an MCP server through an HTTP connection.

List

Find MCPs you can access in a schema.

Get

Read an MCP's configuration and current etag.

Update

Change the comment, connection, tool selection, or rate limits.

Delete

Remove a registered MCP.

Sign in

Sign in or re-authenticate the caller with the provider.

Check sign-in

Read the caller's provider login state.

Sign out

Revoke the caller's provider credential.

To discover and call tools, use an MCP client with the MCP URL, https://<workspace-hostname>/ai-gateway/mcp-services/<catalog>.<schema>.<service>. These management APIs use the unity-catalog OAuth scope. MCP tool calls use ai-gateway.

Create a connection​

Create a schema-level HTTP connection to your MCP server. These examples connect to https://mcp.example.com/mcp with a bearer token. For OAuth and other authentication settings, see HTTP connection settings.

For REST or CLI, save this request as connection.json, replacing the URL and token with your server's values. Keep this credential file out of source control.

JSON
{
"name": "my_connection",
"parent": "schemas/main.default",
"connection_type": "HTTP",
"options": {
"host": "https://mcp.example.com",
"port": "443",
"base_path": "/mcp",
"bearer_token": "<mcp-server-token>"
}
}

Send the request to the Connections API:

Bash
databricks api post /api/2.1/unity-catalog/connections --json @connection.json

The connection's full name is main.default.my_connection. Reference it as connections/main.default.my_connection when creating the MCP below. If the connection already exists, use its name and skip this step.

Create an MCP​

The MCP references an existing HTTP connection. To limit the tools it exposes, configure tool selection.

Send a POST to /api/2.1/unity-catalog/mcp-services, passing parent and mcp_service_id as query parameters. config.source_connection.name identifies the Unity Catalog HTTP connection to the MCP server. Set include_tool_selectors to restrict tools, or omit it to expose all tools. See Choose available tools.

Bash
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": {
"source_connection": {
"name": "connections/main.default.my_connection"
}
}
}'

Find an MCP​

List the MCPs you can access in a schema, then get an MCP's configuration by its resource name. For built-in MCPs, use schemas/system.ai as the parent.

Bash
databricks api get \
"/api/2.1/unity-catalog/mcp-services?parent=schemas/main.default&view=FULL"

databricks api get "/api/2.1/unity-catalog/mcp-services/main.default.my_mcp"

When the list response includes next_page_token, pass it as page_token in the next request. Continue until next_page_token is absent or empty.

List responses use BASIC view by default, which omits source-connection details and rate-limit principal names. Use FULL to include those fields. The CLI and Python iterator handle pagination for you.

Grant access​

These examples grant EXECUTE on the MCP. For the full access requirements, including parent permissions, see Share an MCP.

Bash
databricks api patch \
"/api/2.1/unity-catalog/permissions/mcp_service/main.default.my_mcp" \
--json '{
"changes": [
{ "principal": "data-team", "add": ["EXECUTE"] }
]
}'

Manage provider sign-in​

For MCPs that use per-user OAuth, each caller signs in to the external provider. For interactive sign-in, follow External services setup.

The credential APIs are in Beta. To integrate them into your own OAuth flow:

  1. Create the caller's credential with the OAuth exchange fields: authorization_code, pkce_verifier, and oauth_redirect_uri.
  2. Check the credential status. provisioning_info.state must be ACTIVE before the credential is usable. NOT_FOUND means the caller has no credential yet.
  3. To sign out, delete the caller's credential.

These operations manage the calling user's credential. The caller needs access to the MCP.

Update an MCP​

These examples update the MCP comment. The MCP name cannot be changed.

Set update_mask to the fields you want to change, such as comment, config.source_connection.name, config.include_tool_selectors, or config.rate_limits. Using config replaces the whole configuration and clears omitted optional fields. When changing the connection, the MCP owner also needs USE CONNECTION on the new connection.

For a conditional update, first get the MCP and pass its etag with the update. The update succeeds only if the MCP hasn't changed since that read. URL-encode the etag when adding it to a REST query string.

Bash
databricks api patch \
"/api/2.1/unity-catalog/mcp-services/main.default.my_mcp?update_mask=comment" \
--json '{"comment": "Updated: governs an MCP server"}'

Example: update tool selection​

To expose only tools whose names start with get_:

Bash
databricks api patch \
"/api/2.1/unity-catalog/mcp-services/main.default.my_mcp?update_mask=config.include_tool_selectors" \
--json '{
"config": {
"include_tool_selectors": ["get_*"]
}
}'

An empty include_tool_selectors list exposes all tools. See Choose available tools for the UI steps.

Delete an MCP​

Delete only the MCP you intend to remove. Clients configured with its URL can no longer call it.

You can also pass the MCP's current etag to make deletion conditional on it not having changed since the last read. URL-encode the etag in REST query strings.

Bash
databricks api delete "/api/2.1/unity-catalog/mcp-services/main.default.my_mcp"

Additional resources​