Repository navigation
Add MCP service discovery, known services and naming for aitools - #7538
Draft
simonfaltum wants to merge 4 commits into
Draft
simonfaltum wants to merge 4 commits into
simonfaltum wants to merge 4 commits into
Conversation
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 12, 2026 11:49
0510ae3 to
27c9441
Compare
Collaborator
✅ Integration test reportCommit: a4521da
Top 6 slowest tests (at least 2 minutes):
|
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 12, 2026 14:24
773f68b to
93a7090
Compare
Add the libs/aitools/mcp helpers that the `databricks aitools mcp` commands will use: Discover lists the MCP services in a schema with one paginated call and reports sign-in requirements from the source connection options, a static table describes the system.ai services, and naming and URL helpers build server names and service and sign-in URLs. The testserver gains GET /api/2.1/unity-catalog/mcp-services, which filters by parent and drops source connections unless view is FULL. Co-authored-by: Isaac <no-reply@databricks.com>
Take the schema and leaf from the name the API returns, so a mixed-case --location still finds the leaf and the system.ai table. Name the grants listing needs and keep the server's message in listing errors. Collapse underscore runs in server names so agents cannot split them at "__". Escape the service name in the endpoint path. Use ListMcpServicesAll and drop table fields nothing reads. Co-authored-by: Isaac <no-reply@databricks.com>
ServerName now takes the service full name, so the system.ai check comes from one source in any casing, and parts that sanitize to nothing are left out instead of leaving a stray "-". Listing errors for a missing endpoint, a disabled feature or private link keep the server's message without a schema or grants hint. The fake list handler matches the parent in any casing and uses the SDK's view constant; its seed helper moves into the test file. Co-authored-by: Isaac <no-reply@databricks.com>
One return path for unclassified listing errors, doc comments on Unwrap and the testserver helper, the docs URL for the system.ai table, and terminal- friendly service notes. Co-authored-by: Isaac <no-reply@databricks.com>
simonfaltum
force-pushed
the
aitools-mcp/01-agentconfig
branch
from
November 13, 2026 15:05
6f07e48 to
07cc225
Compare
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 13, 2026 15:05
93a7090 to
a4521da
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part of a stack that adds the hidden
databricks aitools mcpcommand group, on top of #7539. This PR adds the helpers that group needs to discover Databricks managed MCP services, name their servers and build their URLs. No command calls them yet.Changes
Discoverlists the services in a schema withListMcpServicesAll(view=FULL, so the response carries each service's source connection). Services whose source connection is deleted are dropped.oauth_provideroption.Main.ToolsorSystem.AIas a location work.system.aiservices get a label, summary and note from a static table. Other services carry only the API comment.ServerName(fullName, profile)returns<leaf>-<profile>forsystem.aiand<catalog>-<schema>-<leaf>-<profile>elsewhere, leaving out parts that sanitize to nothing.Sanitizelowercases, maps other characters to-, collapses_runs and trims-and_, so a name never contains__, which agents use to splitmcp__<server>__<tool>.UniqueNamereturns the first free-2,-3, ... name for a caller-supplied taken check.ServiceURL(path-escaped) andSignInURLbuild the MCP endpoint and the sign-in page URL.*ListErrorwith kindsMCP_LOCATION_NOT_FOUND,MCP_PERMISSION_DENIEDandRATE_LIMITED. The message names the likely cause and keeps the server's message, because the SDK maps every 404, and a private-link 403, to the same sentinels. The 403 hint names the grants listing needs:USE_CATALOGon the catalog andUSE_SCHEMAon the schema. A 404ENDPOINT_NOT_FOUND,FEATURE_DISABLEDor a private-link failure keeps only the server's message, because it is not about the schema or grants.GET /api/2.1/unity-catalog/mcp-services, filtering byparent(in any casing) and omitting source connections unlessviewisFULL.Why
Adding, listing and removing servers all need the same service list, names and sign-in check. With
view=FULLthe list response carriesoauth_providerfor external services, so sign-in detection needs no per-service request. Built-in service docs: https://docs.databricks.com/aws/en/agents/mcp-tools/built-in-mcp-servicesDecisions to review
Knownis set only forsystem.ai, so a customer schema'sgithubservice gets no table entry.UniqueNametakes atakenfunction instead of reading state, so this package does not depend on the state file.Tests
httptestserver. They cover one call for one page, pagination, sign-in detection, deleted connections,system.ai-only table lookup, mixed-case locations, and 404 and 403 mapping with their messages. 429, the other sentinels and the workspace and network error codes are covered throughmapListError.TestKnownSystemAITablechecks the 11system.ailabels.TestSanitize,TestServerNameandTestUniqueNamecover naming, including_runs.TestServiceURLEscapesTheNamecovers a#in a name.FULLandBASIClist output andparentfiltering.go test -raceon both packages,golangci-lintandGOOS=windows go vetpass.schemas/System.AIon a real workspace returned the same 11 services, with lowercase names, asschemas/system.ai.This pull request and its description were written by Isaac.