Repository navigation
Add MCP service discovery, known services and naming for aitools - #7538
Merged
Merged
Conversation
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 12, 2026 11:49
0510ae3 to
27c9441
Compare
Collaborator
✅ Integration test reportCommit: b5f9653
Top 9 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
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
simonfaltum
force-pushed
the
aitools-mcp/01-agentconfig
branch
from
November 16, 2026 12:47
07cc225 to
f178f46
Compare
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
6 times, most recently
from
November 17, 2026 12:36
5fedd5e to
f1ff0ee
Compare
simonfaltum
marked this pull request as ready for review
November 18, 2026 16:20
anton-107
approved these changes
Nov 19, 2026
anton-107
left a comment
Contributor
There was a problem hiding this comment.
Reviewed only what this PR adds on top of aitools-mcp/01-agentconfig. Unit tests, go vet (including GOOS=windows) and golangci-lint pass on libs/aitools/mcp and libs/testserver. I found nothing that blocks the merge.
Non-blocking notes:
- Sign-in detection (
discovery.go,oauthProvider). The SDK documentssource_connection.optionsas "options needed to build the U2M authorize request; when set, it includesauthorization_endpoint,token_endpoint,oauth_scope,client_id, andoauth_provider". The test case where{"client_id": "abc"}means no sign-in describes a shape that contract says can't happen. That's fine forsystem.ai, which you checked live. Beforeaddandloginrely onSignInRequired()for customer schemas, it would help to check one service backed by a custom per-user U2M connection, to confirm it really reportsoauth_provider. - The
w=branch inSignInURL. Downstream,auth.ResolveWorkspaceIDformats an int64 unless the config has aworkspace_idset by hand. Sow=only applies to a hand-typed non-numeric ID. That's fine if the page really accepts it. If not, it's a fallback nobody needs. - Testserver
McpServicesList. It returns an empty list for an unknownparent, where the real API returns 404. Fine for now, but acceptance tests for the not-found path will need it. - Naming stability.
ServerNameandcapServerNameare frozen once 03/04 persist names into agent configs (mcp__<name>__<tool>), so any later change renames tools for existing installs. That's worth a line in the 03-state PR.
Member
Author
|
Thanks for the review! On the notes:
|
One commit for the restack onto main. The individual commits, up to 09e8767, are in the pull request's history. Co-authored-by: Isaac <no-reply@databricks.com>
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 19, 2026 11:42
09e8767 to
b5f9653
Compare
simonfaltum
enabled auto-merge
November 19, 2026 11:43
idelafuente-oc
pushed a commit
to idelafuente-oc/cli
that referenced
this pull request
Nov 20, 2026
…icks#7537) This pull request is part of a stack, on top of databricks#7538, that adds the hidden `databricks aitools mcp` command group. It adds MCP state records, drift checks and profile binding checks. Nothing calls them yet. ## Changes - MCP records are the `mcp` section of the aitools state file (schema v3). A file with only MCP records counts as no install. Installer saves keep the section. Uninstall and `SaveMCPState` remove the file once nothing remains. - `Reconcile` reports `profile_missing` and `host_changed`, using the host and workspace the SDK resolves, with no network. - `Bind` checks the profile before it resolves credentials, so a re-pointed host is never contacted. - SDK configuration errors are `UNCATEGORIZED`. Only failed authentication is `AUTH_FAILED`. `BindError.ExitCode()` returns 2, which the `serve` PR maps to the process exit status. ## Why A proxy must refuse to start when its profile was deleted or re-pointed, or an agent would silently use the wrong workspace. It must never send another workspace's credential. ## Decisions to review - MCP records share the skills state file. A CLI older than schema v3 drops the `mcp` section on its next save, and its `uninstall` deletes a file that holds only MCP records. - An entry pinned to another config file fails the bind with `PROFILE_HOST_CHANGED`, rather than printing the no-record notice, because binding through this file would switch the server silently. Changing `DATABRICKS_CONFIG_FILE` means removing and adding the server again. - An entry with no pinned config file is checked against `~/.databrickscfg`, not `DATABRICKS_CONFIG_FILE`. - Binding never reads `DATABRICKS_TOKEN` or other auth variables into the profile. A profile without a token uses the SDK chain for its host. - Host comparison ignores case, unlike `profile.WithHost`. A profile that drops its workspace selector is not detected, since the recorded ID may come from the API. - Server names are frozen once records and agent entries hold them. `ServerName` and `capServerName` from databricks#7538 produce them, and agents name tools `mcp__<name>__<tool>`, which users' allow rules match, so changing either function later renames the tools of every existing install. ## Tests - `TestBindHostChangedDoesNotContactNewHost` fails if a re-pointed host gets a request. `TestBindWorkspaceFollowsSDKResolution` covers the host query. - `TestBindEntryInOtherConfigFileFailsClosed` and `TestBindNeverUsesEnvTokenForProfileWithoutToken` cover the config-file and credential rules. - `TestUninstallRemovesLeftoverFilesWithoutSkills`, `TestUpdateAfterPruningEverySkillAddsNewSkills` and `TestInstallSpecificSkillWithEmptyStateFile` pass on main's behavior, which users without MCP records keep. - `TestLoadStateHidesOnlyMCPOnlyFiles` and `TestUninstallKeepsStateFileWithMCPRecords` cover the shared file. - Ran: race tests on the touched packages, `experimental/aitools` and `cmd/aitools` acceptance tests (goldens unchanged), `GOOS=windows go vet`, `golangci-lint` and `task checks`. - Not run: the Windows and macOS test suites. No acceptance test covers MCP-only output, since no CLI path writes MCP records yet. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
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 find Databricks managed MCP services, name their servers and build their URLs. No command calls them yet.Changes
Discoverlists the services in acatalog.schemalocation withListMcpServicesAllandview=FULL, so each source connection comes back. Other locations are refused before a request. Services with a deleted source connection are dropped.Service.SignInRequired()is true when the source connection has anoauth_provideroption. The schema and leaf come from the name the API returns, which Unity Catalog lowercases.system.aiservices get a label, summary and note from a static table of 11 services. Notes say which services need the Enhanced Unity Gateway preview, and the GitHub note names the GovCloud app. Other services carry only the API comment.ServerNamereturns<leaf>-<profile>insystem.aiand<catalog>-<schema>-<leaf>-<profile>elsewhere. Parts are sanitized to[a-z0-9_-]with_runs collapsed, so no name contains__, which agents split tool names on. A leaf with no usable characters returnsErrNoServerName.UniqueNameappends-2,-3, ... and stays within the cap.ServiceURLbuilds the endpoint frommcpconfig.MCPServicesPathPrefix.SignInURLrefuses an empty ornoneworkspace ID, passes a numeric ID aso=and any other ID asw=. Its path and the schema parent prefix are thesignInPathandschemaParentPrefixconstants.*ListErrorwith kindsMCP_LOCATION_NOT_FOUND,MCP_PERMISSION_DENIEDandRATE_LIMITED. Each keeps the server's message, since the SDK maps every 404, and a private-link 403, to the same sentinels. The 403 hint namesUSE_CATALOGandUSE_SCHEMAand says an invalid access token gets the same error.ENDPOINT_NOT_FOUND,FEATURE_DISABLEDand private-link failures get no hint.parentin 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_provider, 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, so this package does not depend on the state file.Tests
httptestserver: one call per page, pagination, sign-in detection, deleted connections, mixed-case locations, non-catalog.schemalocations (no request), and 404 and 403 mapping with their messages.TestKnownSystemAITable,TestSanitize,TestServerName*,TestUniqueName*,TestServiceURLEscapesTheNameandTestSignInURL*cover naming, URLs and the workspace ID cases. Testserver tests coverFULLandBASICoutput andparentfiltering.go teston both packages, golangci-lint andGOOS=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.