Repository navigation
Add aitools mcp list and remove - #7549
Draft
simonfaltum wants to merge 26 commits into
Draft
simonfaltum wants to merge 26 commits into
simonfaltum wants to merge 26 commits into
Conversation
Contributor
|
Commit: Regression test reportSelected 10 changed tests (limit=20, 0 not selected) 10 tests: regression=10 unreleased=0 coverage=0 failing=0
TestAccept/cmd/aitools/mcp/add-agent-not-installed: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-default-config: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-text: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-two-agents: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): TestAccept/cmd/aitools/mcp/add-two-profiles: branch ✅ | main (8e70c8b) ❌ | latest (v1.26.0) ❌main (8e70c8b): latest (v1.26.0): 5 more failure details omitted, see the full report in the run. |
Collaborator
✅ Integration test reportCommit: 95c5e54
Top 10 slowest tests (at least 2 minutes):
|
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 12, 2026 14:32
99311a2 to
3abce18
Compare
simonfaltum
force-pushed
the
aitools-mcp/05-list-remove
branch
from
November 12, 2026 14:35
7db8c31 to
9967822
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 12, 2026 17:03
3abce18 to
7239f89
Compare
simonfaltum
force-pushed
the
aitools-mcp/05-list-remove
branch
from
November 12, 2026 17:07
9967822 to
3d361ee
Compare
simonfaltum
force-pushed
the
aitools-mcp/04-add
branch
from
November 12, 2026 19:33
f3c3d22 to
182ccf9
Compare
simonfaltum
force-pushed
the
aitools-mcp/05-list-remove
branch
2 times, most recently
from
November 12, 2026 20:05
6e86c42 to
30b949b
Compare
`list` groups the installed servers by profile and shows each agent entry as installed, missing on disk or modified. It reports profiles that are gone or re-pointed, and lists Databricks entries in agent configs that this CLI did not write. It needs no network and exits 0 when entries have drifted. `remove` takes --names, --profile or --all, with --agents to narrow the agents. It deletes only entries that run this CLI's serve command, skips the others, prunes state records whose entry is already gone, and needs no network. Co-authored-by: Isaac <no-reply@databricks.com>
The tests made a server look changed outside the CLI by writing it with agentconfig.Upsert and a command that is not the databricks binary. Upsert now refuses such a command, so the tests edit the Claude Code config file directly instead. Co-authored-by: Isaac <no-reply@databricks.com>
…ases mcp add now refuses an agent named with --agents whose config directory is missing. These two cases add for claude-code in a fresh HOME, so they create the directory first, as the other add cases do. Their goldens do not change. Co-authored-by: Isaac <no-reply@databricks.com>
Card 03 removed the profile.Profiler argument from mcp.Reconcile and made it return the drifts of the entries it could check, with a joined error for the others. `mcp list` keeps those drifts, renders as before, and then returns the error, so an unreadable config file is reported and the command exits non-zero. The list test entries are pinned to DATABRICKS_CONFIG_FILE, as `add` records them. Unpinned entries now check ~/.databrickscfg. Co-authored-by: Isaac <no-reply@databricks.com>
Card 03 moved MCP records into the `mcp` section of ~/.databricks/aitools/skills/.state.json. The list-and-remove script read the old path and its top-level `servers` array. Co-authored-by: Isaac <no-reply@databricks.com>
Rename the list reader, since add now has its own readAgentEntries, and seed the services in the list acceptance scripts through the fake workspace, which add's tests now use instead of a static listing. Co-authored-by: Isaac <no-reply@databricks.com>
SamePath, RemoveNamesCommand and RecreateCommand are exported from libs/aitools/mcp, and agentconfig.Path returns an agent's config path. Drift gets a NoHost flag for a profile whose section has no host. profileGoneError builds its recreate hint with RecreateCommand; its output does not change. Co-authored-by: Isaac <no-reply@databricks.com>
list and remove use the agent's current config path. An entry whose config moved is path_changed in list and is kept by remove, so an entry in a file the agent no longer reads is never pruned. Ownership of an entry is decided with mcp.EntryServes against the record's service, profile and config file, not the exact command. A re-add from another binary no longer makes the other agents' entries modified, and a hand-edited profile, service or pinned config file is modified. list groups profiles by name and resolved config file, reports drift per server (JSON adds config_file and a per-server status), and prints one hint per broken server with remove --names. The missing-profile text names the file that was checked and says when the section has no host. Hints come from the mcp command builders and keep DATABRICKS_CONFIG_FILE for pinned servers. Entries and agent configs that cannot be checked are warnings and status unknown; list exits 0. Entries that run serve without a record are listed as unmanaged (no-record); remove leaves them. remove reads each agent config once, drops records by server name, refuses a --profile with no servers and an --agents agent that no selected server has, fails when a server was removed from no agent, reports skipped entries with their agent, and prints results before a state save error. Tests: unit tests for each finding, and an acceptance scenario for path changes, unreadable configs, orphan entries and the refusals. Co-authored-by: Isaac <no-reply@databricks.com>
The serve errors for a drifted entry told the user to run `mcp remove --profile`, which removes every server of the profile in every config file. They now name the server (`mcp remove --names`), as `mcp list` does. The drift wording of the serve errors moves to DriftMessage, which `mcp list` also uses, so the workspace named in a host's query is shown, not an empty ID. CheckEntries returns one result per entry, reading each config file once, and Reconcile is built on it. IsUGProxy is the single definition of the ug bridge. ReadAt and RemoveAt work on the file a record names, so that `mcp remove` can clean up an entry whose agent config moved. Co-authored-by: Isaac <no-reply@databricks.com>
list: - --profile lists that profile only; the unmanaged section is skipped, since those entries have no profile, and an empty profile says so. - Drift hints are built from mcp.DriftMessage, with the workspace from the host query and the profile quoted; the pinned file is shown with slashes. - A profile with a server that cannot be checked is unknown, not ok. - An entry whose config file cannot be resolved is warned once, not once per agent. Each entry is checked through mcp.CheckEntries. - JSON carries error and error_category when the state cannot be read. - An entry that runs an mcp-proxy argument under another command is not labeled ug-proxy: agentconfig.IsUGProxy decides. remove: - --names accepts the leaf of a service name, case-insensitively. A leaf that names services in two schemas is refused with the full names. - A record for an agent this CLI cannot edit (outside the registry, or without MCP support) is dropped and listed with record_only, not a failure. - A moved agent config is cleaned in the file the record names; a record whose file is gone is pruned. The record goes with the entry. - Only the selected entries left without an agent are dropped from state. A named entry with no agent is removed. - The save of the state is a variable, so the save failure test does not depend on file permissions. The quiet context in JSON mode is removed. acceptance: the expected failures use musterr; the broken Codex config is a fixture; list --profile is shown; goldens regenerated and reviewed. Co-authored-by: Isaac <no-reply@databricks.com>
Remove mcp.Reconcile, which has no caller since list uses CheckEntries; its tests run on CheckEntries. Export mcp.LeafOf and use it in remove's name matching. EntryCheck carries the resolved config file, so list groups and checks ownership against the file that was checked. agentconfig.Remove is a thin wrapper over Path and RemoveAt. add reads the agent configs through readAgentConfig. No behavior change. Co-authored-by: Isaac <no-reply@databricks.com>
…moved file A --names value equal to a server name selects that server only, and is not refused as ambiguous when another schema has the same leaf. Service and leaf matching apply only when no server has the name. agentconfig records absolute config paths: a relative CLAUDE_CONFIG_DIR, CODEX_HOME or COPILOT_HOME is made absolute at add time, so remove from another directory edits the same file. When the recorded file no longer holds the entry and the agent now reads another file, remove takes the owned entry out of that file and drops the record. The entry is pruned only when neither file holds it. Co-authored-by: Isaac <no-reply@databricks.com>
…ntries --profile reads the configs of the agents the profile's servers are recorded for, not every agent. Warnings come in agent-name order, not map order. A login hint for an unpinned server whose profile is missing names the file the entry is checked against when DATABRICKS_CONFIG_FILE names another file, since login writes there. A profile listing with no server still prints its warnings in text. Each server's JSON carries the host it was set up for (additive). A pinned profile group's header names its config file, so two groups of one profile and host are told apart. A changed entry (modified) gets a hint with the file and the way out. remove gives the same way out in its skipped reason. A profile named DEFAULT whose section has no keys is missing, not a section with no host. Co-authored-by: Isaac <no-reply@databricks.com>
Doc comments for readAgentConfig, renderMcpList, profileHeader, listAgentsText, unmanagedKindText, printRemoveResults and readRecordedFile. The repair-and-warnings scenario title named Claude Code, which that step does not list; it now names Codex CLI. Goldens updated: pinned profile headers name the config file, list JSON servers carry host, and the new modified hint and remove reason. Co-authored-by: Isaac <no-reply@databricks.com>
Behavior is the same: an unreadable recorded file is still reported for its agent, as could not update. golangci-lint nilerr flagged the nil return on that branch. Co-authored-by: Isaac <no-reply@databricks.com>
Git checks the fixture out with CRLF on Windows, where the old content failed on the '\r' instead of the '\n' and the golden differed. The new content fails on a character inside the line. Co-authored-by: Isaac <no-reply@databricks.com>
agentconfig imported libs/aitools/mcp (the installer, databrickscfg and the SDK) only for this helper, which reversed the layering. mcpconfig is below both packages, so the helper moves there. No behavior change. Co-authored-by: Isaac <no-reply@databricks.com>
…s volume
On Windows, a path such as \claude is not absolute, so AbsoluteAsWritten joined it to the whole working
directory: CLAUDE_CONFIG_DIR=\claude recorded and wrote C:\work\claude\.claude.json instead of
C:\claude\.claude.json. The path now takes the working directory's volume. The table test expects the
volume through filepath only, and fails on Linux with the old join too ("C:/work/project//claude").
Co-authored-by: Isaac <no-reply@databricks.com>
…n caller The commands use Path with ReadAt and RemoveAt, which take the file a record names. The agentconfig tests call the same pair through a small helper. No behavior change. Co-authored-by: Isaac <no-reply@databricks.com>
…ership check list and remove read agent configs through two separate readers, and decided ownership in two ways (a re-resolved config file in remove, an inlined EntryServes in list). Remove also called agentconfig.Path and resolved the binding file once per agent. Now: - agentFiles reads each agent's current path once and each config file once per command, for list, remove and add's entry read. - bindingFile resolves a server's config file once, and owns() is the one ownership check for both commands. - Small cleanups: worseRank is package-level, the two skip branches of remove share one path, the test root helper is shared, LeafOf's comment names LeafOf, and the agent name comes from agentDisplayName. No behavior change; the existing tests pass unchanged apart from the helper rename. Co-authored-by: Isaac <no-reply@databricks.com>
…reads it once configFiles cached only files that parsed. An unreadable ~/.databrickscfg was parsed again for every server in a list, and each parse could differ. The failure is now cached with the file, and every profile of the file reports the same error. The test is internal (configFiles is unexported) and fails on the old code, where the second lookup reads the file again and succeeds. Co-authored-by: Isaac <no-reply@databricks.com>
… records, clear hint - --names matches a server name exactly before it matches without case. State can hold names that differ only in case, and the first case-insensitive match was taken. Several case-only matches are now refused as ambiguous. Tests: TestSelectInstallsExactServerNameWins (failed before: the first match was taken). - --agents selects only servers installed for those agents. An entry with no agent left was reported as removed and dropped from state. Test: TestMcpRemoveWithAgentsSkipsRecordWithoutAgents (failed before). - The kept reason offers --force only for an entry that is not a Databricks entry, the one case add can replace. For a Databricks entry that serves another binding, the reason says to delete it by hand and run remove again. The hint is changedEntryFix, shared with list. Test: TestMcpRemoveKeptReasonForDatabricksEntryOmitsForce (failed before). Co-authored-by: Isaac <no-reply@databricks.com>
…use, clear hints - Moved config (P5): list finds an entry the way remove does (locateEntry): in the file the record names when that file holds it, otherwise in the file the agent reads now. An entry found in the current file is installed or modified there, not path_changed. path_changed is for an entry in a record's file that the agent no longer reads. Remove uses the same lookup. Test: TestBuildMcpListAndRemoveAgreeAfterConfigMoved (the current-file case failed before: path_changed). - Hints (P1): a modified Databricks entry says to delete it by hand and run remove again, with no --force, since add refuses it whatever --force says. A foreign entry keeps the --force alternative. Test: TestRenderMcpListHintForDatabricksEntryOmitsForce (failed before). - An agent that takes no MCP servers (P10): a record for it is unknown, with a warning that says so, and no "could not read the config" warning. Remove drops such a record as before. Test: TestBuildMcpListRecordForAgentWithoutMCPIsUnknown (failed before). - An unreadable config file is one warning for the file, not one per server (P11). Test: TestBuildMcpListWarnsOncePerUnreadableProfileFile (failed before: two warnings). TestBuildMcpListUnknownServerIsWarnedNotOK now expects the file warning, which names the file. - An ownership error is warned about unless the entry check or the agent's config already reported that same error (P12). Test: TestBuildMcpListWarnsForOwnershipErrorWithAnotherCause (failed before: no warning). - Login hint expectations quote the config path with shellquote.BashArg, as the code does (P15). A Windows temp path with a tilde is quoted. Co-authored-by: Isaac <no-reply@databricks.com>
…erate list-and-remove Login hints quote a config path that a shell would read differently, such as a Windows temp path with a tilde. The binding and list tests expect the quoted form (shellquote.BashArg), as the code writes it. The acceptance drift scenario's golden has the bare path, so test.toml strips the quotes around a [TEST_TMP_DIR] path. The list-and-remove golden shows the remove skip reason, which now names the remove command in backticks. Co-authored-by: Isaac <no-reply@databricks.com>
The warning names the config file as resolved, which on Windows expands the short name of the temp directory, so the test resolves it the same way. Co-authored-by: Isaac <no-reply@databricks.com>
Main classifies a StateError as STATE_INVALID, so a state file that does not parse reports that category in the JSON listing rather than UNCATEGORIZED. Co-authored-by: Isaac <no-reply@databricks.com>
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/05-list-remove
branch
from
November 13, 2026 15:05
eb0b033 to
95c5e54
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 PR is part of a stack that adds the hidden
databricks aitools mcpcommand group, on top of #7544 (aitools mcp add). It addslist, which shows installed servers and their drift, andremove, which deletes only the entries this CLI wrote.Changes
aitools mcp listgroups servers by profile and shows each agent entry asinstalled,missing_on_disk,modifiedorpath_changed. Profile drift isprofile_missingorhost_changed. Entries this CLI did not write are listed as unmanaged. It makes no network calls.aitools mcp removechooses servers with--names,--profileor--all, and narrows agents with--agents. It deletes an entry only when it is the one this CLI wrote. A modified entry is left in place and reported.removetakes the entry from the file the agent now reads, if the record's file lost it.addrecords absolute config paths, soremoverun from another directory finds the same file.serveoutput changes in two places: its hints namedatabricks aitools mcp remove --names <server>, and an empty[DEFAULT]section reads as "no longer exists" instead of "has no host".Why
After
add, nothing shows which servers are installed, whether their profile still exists, or whether an agent config changed under them.removedeletes only what this CLI wrote, so an entry a user wrote under the same name is never touched.Decisions to review
removeedits the file the agent now reads, rather than refusing. Cost: it edits a file the record does not name, under the same ownership check.--namesmatches a server name exactly, then without case. A service name applies to every profile unless--profilenarrows it.unknown, rather than failinglistand hiding the other agents. Cost: a broken file leaves its servers unchecked until fixed.listkeeps showing it. The hint offers--forceonly for an entry this CLI did not write, becauseaddrefuses a Databricks entry for another binding whatever--forcesays.Tests
TestBuildMcpListAndRemoveAgreeAfterConfigMovedcovers both moved-config cases;TestSelectInstallsExactServerNameWinsandTestMcpRemoveWithAgentsSkipsRecordWithoutAgentscover name matching and--agents.TestRenderMcpListHintForDatabricksEntryOmitsForceandTestBuildMcpListWarnsOncePerUnreadableProfileFilecover the hint and the warnings.TestJoinWorkingDirKeepsTheVolumeOfRootRelativePathsruns on every OS. Its failing case is Windows-only, so it was checked red on Linux with the old join.list-and-remove,drift-profile-missingandrepair-and-warningscover text and JSON output.go test -race ./cmd/aitools/... ./libs/aitools/..., the aitools acceptance tests, golangci-lint,./task checksandGOOS=windows go vetpass.This pull request and its description were written by Isaac.