Repository navigation
Add non-interactive aitools mcp add behind a hidden group - #7544
Draft
simonfaltum wants to merge 49 commits into
Draft
simonfaltum wants to merge 49 commits into
simonfaltum wants to merge 49 commits into
Conversation
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 12, 2026 12:11
99f703a to
39c0dec
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 12, 2026 12:11
8dfe722 to
99311a2
Compare
Contributor
|
Commit: Regression test reportSelected 9 changed tests (limit=20, 0 not selected) 9 tests: regression=9 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/mcp/add-agent-not-installed: branch ✅ | main (bf8caad) ❌ | latest (v1.26.0) ❌main (bf8caad): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-default-config: branch ✅ | main (bf8caad) ❌ | latest (v1.26.0) ❌main (bf8caad): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-name-notices: branch ✅ | main (bf8caad) ❌ | latest (v1.26.0) ❌main (bf8caad): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-text: branch ✅ | main (bf8caad) ❌ | latest (v1.26.0) ❌main (bf8caad): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-two-agents: branch ✅ | main (bf8caad) ❌ | latest (v1.26.0) ❌main (bf8caad): latest (v1.26.0): 4 more failure details omitted, see the full report in the run. |
Collaborator
✅ Integration test reportCommit: 763aebd
Top 12 slowest tests (at least 2 minutes):
|
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 12, 2026 14:25
39c0dec to
acc3ee6
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
3 times, most recently
from
November 12, 2026 19:33
f3c3d22 to
182ccf9
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 13, 2026 15:05
1dade3d to
03c01a0
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 13, 2026 15:05
39b5bc1 to
aa53c0e
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 16, 2026 12:47
03c01a0 to
8356812
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 16, 2026 12:47
aa53c0e to
86996e1
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 16, 2026 13:19
8356812 to
c1301e6
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 16, 2026 13:19
86996e1 to
24cec5b
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 16, 2026 13:32
c1301e6 to
94587e4
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 16, 2026 13:32
24cec5b to
3e359a6
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 16, 2026 14:49
94587e4 to
a9c735c
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 16, 2026 14:49
3e359a6 to
73db797
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 16, 2026 15:53
a9c735c to
fa4d812
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
2 times, most recently
from
November 17, 2026 10:52
113a0d4 to
2ad5e5b
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 17, 2026 10:52
fa4d812 to
13dc173
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 17, 2026 12:02
631f7bd to
64f9579
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 17, 2026 12:02
13dc173 to
3233f8f
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 17, 2026 12:36
64f9579 to
e4be8db
Compare
`databricks aitools mcp add` installs Databricks managed MCP servers into coding agents, bound to one CLI profile. Each server is written as a stdio entry that runs `databricks aitools mcp serve`, which lands in a later change. The group stays hidden until the stack is complete. Co-authored-by: Isaac <no-reply@databricks.com>
mcpconfig.Spec.IsOurs is gone, so the unmanaged check calls mcpconfig.IsDatabricksEntry directly. serverNamePattern is replaced by mcpconfig.ValidServerName so the --name rule cannot drift from the writer. The add-two-agents Codex golden changes: agentconfig now edits TOML as text, so the server tables are written flush-left without the [mcp_servers] parent header. The entries are unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
An agent named explicitly with --agents whose config directory does not exist now fails for that agent alone: nothing is written and its directory is not created. The other agents still install, and the command exits 1. Agents picked by detection are installed by construction, so they are unchanged. The failure uses the UNKNOWN_AGENT category, since the SPEC table has no row for an agent that is not installed. The add cases whose agents must exist now create their config directories first, and add-agent-not-installed covers the refusal. Co-authored-by: Isaac <no-reply@databricks.com>
Describe the mcp group, add an example to mcp add, and use "services" for the --names values in its help. The Cursor hint names the Cursor docs' term "agent" instead of calling the CLI "agent" in a parenthetical. Co-authored-by: Isaac <no-reply@databricks.com>
When an --agents name matches exactly one MCP-capable agent by binary name or name prefix, the error says "did you mean <agent>?". The shared agent registry is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
A profile with no installed server that does not exist is usually mistyped, so add lists the profiles that exist after the shared binding text. serve keeps that text, and so does add when a server is installed for the profile. Co-authored-by: Isaac <no-reply@databricks.com>
The document's error_category defaulted to TYPE_UNSPECIFIED on every run, so a successful add reported a failure category. The field is now omitted unless the command fails at the top level. Co-authored-by: Isaac <no-reply@databricks.com>
The text output now explains a generated name that got a suffix, and which agents hold the base name. It also says when --force replaced an entry that this CLI did not write. The JSON document is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
A multi-server add printed the hint after every server. It now comes once, after the servers, and names each server Cursor may ask about. cursor-agent mcp enable takes one identifier, so for several servers the hint says to run it for each. Co-authored-by: Isaac <no-reply@databricks.com>
Card 02 replaced the SignInRequired field of mcp.Service with a method derived from OAuthProvider. Co-authored-by: Isaac <no-reply@databricks.com>
A profile named like a serve flag, such as --service, was taken for the flag because the lookup searched every argument. Skip the value of each flag that takes one while reading, so the profile value is never read as a flag. Co-authored-by: Isaac <no-reply@databricks.com>
A profile with a host and an account_id but no workspace_id passed the binding check and reached the workspace requests, where it failed with an opaque error. The workspace commands refuse it up front, so mcp add does the same from the profile file, which makes no request. Also list the existing profiles on their own line, and only for a profile that does not exist, so the suggested login command copies without a trailing period. Co-authored-by: Isaac <no-reply@databricks.com>
Move the TestCheckBindingMatchesBind doc comment onto its own test, name the helpers of TestInstalledForMCP as functions, commit the Cursor config that add-name-notices wrote with a heredoc, and capture the hidden help output in a LOG file. The cliError comment no longer claims telemetry reporting that mcp add does not do. Co-authored-by: Isaac <no-reply@databricks.com>
withExistingProfiles looked up the existing profiles to tell a missing profile from one without a host, but the loader skips sections without a host, so a host-less profile was still listed as missing. The missing-profile error now carries ErrProfileMissing as its cause, and mcp add checks that with errors.Is. The account-level refusal reads a workspace from a ?w= query on the host, as the SDK does, so a host that names a workspace is accepted. The serve argv is defined once in mcpconfig, and a stored name that another server of the run already uses is refused. Co-authored-by: Isaac <no-reply@databricks.com>
… add The account-level refusal read the profile file, so a workspace profile whose workspace ID comes from the host or from discovery was refused, though the workspace commands accept it. The check now runs in profileClient on the config BoundConfig resolves, before the credential is sent. An agent whose config cannot be read is refused with its error before any request, as a refused agent is, instead of failing after the workspace calls. The cliError type is folded into categorizedError, the failure helper of the other aitools commands, and the five new functions that lacked doc comments have them. Co-authored-by: Isaac <no-reply@databricks.com>
writeFakeCLI repeated fakeBinsOnPath for one binary, so the test uses fakeBinsOnPath and the duplicate goes. The runMcpAdd doc comment is shorter and no longer repeats the control flow. Co-authored-by: Isaac <no-reply@databricks.com>
Card 02 now returns ErrNoServerName for a leaf that sanitizes to nothing. Add passes that error on with "pass --name", in place of its own check for an empty name. Co-authored-by: Isaac <no-reply@databricks.com>
…tools mcp add Claude Code, Gemini CLI and OpenCode move their MCP config file with CLAUDE_CONFIG_DIR, GEMINI_CLI_HOME and XDG_CONFIG_HOME (APPDATA on Windows). When such a variable was set and the agent's binary was on PATH, add was accepting the agent and writing its config into a directory that did not exist yet. The guard that Codex and Copilot CLI already have now covers these agents too: when one of the variables is set, the directory the MCP config file lives in must exist. Co-authored-by: Isaac <no-reply@databricks.com>
The invoked path was read into a package variable at init, so an empty argv panicked before the CLI started, and a test had to swap the variable. mcpBinaryPath now reads os.Args[0] when it is called, and an empty argv yields no path, which the caller refuses as not the databricks binary. Co-authored-by: Isaac <no-reply@databricks.com>
With no --profile, aitools mcp add picked the only workspace profile, but it filtered out an account-style profile whose host carries the workspace in ?w=. --profile accepts that profile, so auto-detect now accepts it too. Co-authored-by: Isaac <no-reply@databricks.com>
A server name recovered from the state file or an agent entry was reused without the checks --name gets, so a hand edit could give an agent a name that does not split as mcp__<name>__<tool> does. The stored name now gets the same check, and the error names the command that removes the entry. Co-authored-by: Isaac <no-reply@databricks.com>
On Windows, a rooted path with no drive, such as \tools\databricks.exe, is not absolute, so AbsoluteAsWritten joined it to the working directory and produced a doubled separator under the working directory instead of the current drive's root. The path now takes the working directory's volume, which the binary command path and the config file path share. Co-authored-by: Isaac <no-reply@databricks.com>
The writer refuses a config file the user made read-only with the ErrReadOnly sentinel, and no longer names --agents, which the writer does not know. aitools mcp add adds the hint, so its message reads as it did before. Co-authored-by: Isaac <no-reply@databricks.com>
Refuse a run where every detected agent has an unreadable config before any request, as --agents does, and keep the error category of the first refusal. Refuse --agents that names no agent instead of writing every detected agent. Check the held names of a stored server, and refuse a stored name that is empty. Match the existing profiles hint on the same profiles that --profile accepts. Print a service's prerequisite note after its results. Resolve a drive-relative path on the working directory's drive. Read serve flags as pflag does, taking the last value and the equals form. Move the OpenCode home variable to the one its config directory reads on each OS, and define the Codex and Copilot home variables with the other constants. Co-authored-by: Isaac <no-reply@databricks.com>
Count an agent refused for its config as failing every server, so a run where the other agents also fail ends before any request. Keep XDG_CONFIG_HOME as an OpenCode home variable on Windows, where it is the fallback to APPDATA. Keep a root working directory from doubling its separator in a relative config path, print that path with forward slashes in its error, and resolve a "./" binary path given with forward slashes on Windows. Use one constant for the server name rules in both messages that refuse a name. Co-authored-by: Isaac <no-reply@databricks.com>
Keep a relative binary path with repeated separators after "./" relative, so ".//bin/databricks" is not persisted as /bin/databricks. Use XDG_CONFIG_HOME alone as the OpenCode home variable, since APPDATA is the default location on Windows and is always set there. Require Gemini's mandatory file when GEMINI_CLI_HOME makes the directory the only signal, as Detected does. Check the read-only error by its type before adding the agents hint. Say in the --location help that the shared schema is the default only when there are no leaf names, and indent the sign-in line like the other server lines. Co-authored-by: Isaac <no-reply@databricks.com>
Refuse an agent whose detection fails with that error, rather than writing it as detected. A name conflict in an agent that is refused, and so not written, no longer refuses the run with --agents: only the agents that are written decide. Co-authored-by: Isaac <no-reply@databricks.com>
A generated server name is capped at 32 characters, because agents limit mcp__<server>__<tool> to about 64 characters. A --name over that cap was accepted, and so was a stored name that a hand edit made longer. Refuse both: --name at flag validation with the limit and the length given, and a stored name in chooseName with the command that removes and re-adds the server, as the other stored-name refusals do. The cap is exported from libs/aitools/mcp as MaxServerNameLen so that cmd/aitools checks the same constant. Co-authored-by: Isaac <no-reply@databricks.com>
InstalledForMCP takes the agent as installed only when the directory of its MCP config file exists, once one of its home variables is set. A variable that holds the default location, such as XDG_CONFIG_HOME=~/.config or GEMINI_CLI_HOME=$HOME, made an installed agent that had never run count as absent. A variable now counts only when its cleaned value differs from the default that the agent's path code uses when the variable is unset. Each default is in mcpHomeDefaults, so the comparison follows the agent's own path code. Co-authored-by: Isaac <no-reply@databricks.com>
A read-only config file is refused with a hint to make it writable or to leave the agent out of --agents. The hint is right when the agent was named with --agents. When the agents were detected, --agents is not a way out, so the refusal keeps the writer's own message. Co-authored-by: Isaac <no-reply@databricks.com>
Card 02 names the AWS GovCloud app in the GitHub note, which add prints. Co-authored-by: Isaac <no-reply@databricks.com>
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 17, 2026 15:11
2d1b8f3 to
1d8c127
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 17, 2026 15:11
763aebd to
2c5b663
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 pull request is part of the stack that adds the hidden
databricks aitools mcpcommand group. It builds on #7537 and addsaitools mcp add, which installs Databricks managed MCP servers into coding agents non-interactively, bound to one CLI profile.Changes
aitools mcp add --names ... --agents ...installs full names (system.ai.github) or leaf names into the named agents, or into every detected agent without--agents. Leaf names resolve in--location, which defaults tosystem.aior to the one schema the full names share. A leaf next to full names outsidesystem.aiis refused.--force.InstalledForMCPcounts an agent as installed when its config directory, skills, MCP file or a binary on PATH is present. A home variable (CODEX_HOME,COPILOT_HOME,CLAUDE_CONFIG_DIR,GEMINI_CLI_HOME,XDG_CONFIG_HOME) set away from its default leaves only the MCP file's directory to count.--nameand stored names over 32 characters (mcp.MaxServerNameLen) are refused, as are invalid names.databricks aitools mcp serve, withDATABRICKS_CONFIG_FILEpinned when it is set. The binary path comes from argv at run time, made absolute when possible. Otherwise the output notes that agents must finddatabrickson PATH.?w=is auto-detected. On Windows, a drive-relative path is refused unless it is on the working directory's drive.--agentsonly for named agents. A successful add prints the service's note, if it has one.Why
Coding agents cannot use Databricks managed MCP servers yet. The state and agent-config writers from the earlier PRs need a command that calls them. The group stays hidden until
servelands, so no release ships an entry that cannot start.Decisions to review
addstill fails when a requested service reaches no agent.serveruns, so both commands print the same text. Without an install record it names the service and how to set it up, with noremovehint.UNKNOWN_AGENTcovers a known agent that is not installed. No telemetry category fits.--forceoverride.addcreates its config directory on the first write.How to review
Refactors, no behavior change:
Bindis split intoCheckBinding,BoundConfigandAuthenticateBound(libs/aitools/mcp/binding.go). The exported helpers areResolveConfigFileandAbsoluteAsWritten(configfile.go),FindEntry(binding.go),ErrProfileMissing(state.go),SystemAILocation(known.go), andmcpconfig.EnvKeys(mcpconfig/spec.go).New behavior, to read closely:
cmd/aitools/mcp_add.go(planAdds,chooseName,locationOf,agentFailureError),libs/aitools/agents/agents.go(InstalledForMCP,mcpHomeMoved),cmd/aitools/mcp.go(mcpWorkspaceProfile), and the drive-relative rule inAbsoluteAsWritten.Tests
cmd/aitools: name planning and conflicts, refusals before any request, recording when one server fails, distinct agent failures, and which agents count as installed.libs/aitools: the MCP-home presence rule, the profile check with no entry, andEntryEnv.acceptance/cmd/aitools/mcp/: two services and agents, text and JSON output, two profiles, an unparsable config, an uninstalled agent, and the hidden group.go test -raceoncmd/aitoolsandlibs/aitools, the aitools acceptance tests,GOOS=windows go vet, golangci-lint and./task checkspass.serve(a later PR), the picker, and real agent processes.This pull request and its description were written by Isaac.