Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2e86d65
Add aitools mcp list and remove
simonfaltum Nov 12, 2026
8e9f461
Edit the hand-changed server in list and remove tests by hand
simonfaltum Nov 12, 2026
3d8de31
Create the Claude Code config dir in the list and remove acceptance c…
simonfaltum Nov 12, 2026
1f6e234
Show list drift when mcp.Reconcile cannot check an entry
simonfaltum Nov 12, 2026
30bcd72
Read the MCP state from the shared skills state file in list acceptance
simonfaltum Nov 12, 2026
13fec1e
Adapt list and remove to the reviewed add command
simonfaltum Nov 12, 2026
72c090a
Export the MCP helpers that list and remove reuse
simonfaltum Nov 12, 2026
33005c0
Fix review findings in aitools mcp list and remove
simonfaltum Nov 12, 2026
ee97746
aitools mcp: name the server in serve drift hints, add per-entry checks
simonfaltum Nov 12, 2026
475bc28
aitools mcp list and remove: fix review findings (pass 2)
simonfaltum Nov 12, 2026
149114f
aitools mcp: refactor list and remove helpers (pass 3)
simonfaltum Nov 12, 2026
660c401
aitools mcp remove: server name wins, absolute config paths, and the …
simonfaltum Nov 12, 2026
a63dd15
aitools mcp list: profile filter, login hint, warnings, and changed e…
simonfaltum Nov 12, 2026
5e53303
aitools mcp: doc comments for list and remove helpers, scenario title
simonfaltum Nov 12, 2026
03c0843
aitools mcp remove: return the recorded file's read error from entryFile
simonfaltum Nov 12, 2026
2e7b747
Use a broken Codex config whose parse error ignores line endings
simonfaltum Nov 12, 2026
54c3a82
aitools mcp: move AbsoluteAsWritten to mcpconfig
simonfaltum Nov 12, 2026
c8a2c7c
aitools mcp: a root-relative config path keeps the working directory'…
simonfaltum Nov 12, 2026
4c070e3
aitools mcp agentconfig: drop Read and Remove, which had no productio…
simonfaltum Nov 12, 2026
a9c51be
aitools mcp list and remove: one reader for agent configs and one own…
simonfaltum Nov 12, 2026
877ae5b
aitools mcp: cache a config file that cannot be read, so each lookup …
simonfaltum Nov 12, 2026
d85eb6a
aitools mcp remove: exact server name first, --agents skips agentless…
simonfaltum Nov 12, 2026
f0090d0
aitools mcp list: report the entry remove acts on, one warning per ca…
simonfaltum Nov 12, 2026
5436af5
aitools mcp tests: quote config paths in hint expectations, and regen…
simonfaltum Nov 12, 2026
f1d49a5
Compare the unreadable-profile warning with the resolved path
simonfaltum Nov 12, 2026
95c5e54
Expect STATE_INVALID for an unreadable state file in mcp list
simonfaltum Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood

[dogfood]
host = $DATABRICKS_HOST
token = test-token-dogfood
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[dogfood]
host = https://adb-2.test
token = test-token-dogfood
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[dogfood]
host = $DATABRICKS_HOST
token = test-token-dogfood
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
91 changes: 91 additions & 0 deletions acceptance/cmd/aitools/mcp/drift-profile-missing/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

=== Both profiles get a server

>>> [CLI] aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents claude-code
Profile logfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

genie_one_mcp-logfood system.ai.genie_one_mcp
claude-code installed [TEST_TMP_DIR]/home/.claude.json

>>> [CLI] aitools mcp add --profile dogfood --names system.ai.genie_one_mcp --agents claude-code
Profile dogfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

genie_one_mcp-dogfood system.ai.genie_one_mcp
claude-code installed [TEST_TMP_DIR]/home/.claude.json

=== logfood is deleted from the Databricks config file: list reports it and exits 0

>>> [CLI] aitools mcp list
Profile dogfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-dogfood system.ai.genie_one_mcp Claude Code

Profile logfood (profile not found in [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
broken: run `databricks aitools mcp remove --names genie_one_mcp-logfood` or `DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks auth login --host [DATABRICKS_URL] --profile logfood`

=== dogfood now points at another host: list reports the host change

>>> [CLI] aitools mcp list --output json
{
"profiles": [
{
"profile": "dogfood",
"host": "https://adb-2.test",
"config_file": "[TEST_TMP_DIR]/.databrickscfg",
"status": "host_changed",
"servers": [
{
"name": "genie_one_mcp-dogfood",
"service": "system.ai.genie_one_mcp",
"host": "[DATABRICKS_URL]",
"sign_in_required": false,
"status": "host_changed",
"agents": [
{
"name": "claude-code",
"path": "[TEST_TMP_DIR]/home/.claude.json",
"status": "installed"
}
]
}
]
},
{
"profile": "logfood",
"host": "[DATABRICKS_URL]",
"config_file": "[TEST_TMP_DIR]/.databrickscfg",
"status": "profile_missing",
"servers": [
{
"name": "genie_one_mcp-logfood",
"service": "system.ai.genie_one_mcp",
"host": "[DATABRICKS_URL]",
"sign_in_required": false,
"status": "profile_missing",
"agents": [
{
"name": "claude-code",
"path": "[TEST_TMP_DIR]/home/.claude.json",
"status": "installed"
}
]
}
]
}
],
"unmanaged": [],
"warnings": []
}

=== The same change in text

>>> [CLI] aitools mcp list
Profile dogfood (https://adb-2.test, config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-dogfood system.ai.genie_one_mcp Claude Code
broken: it was set up for [DATABRICKS_URL], but profile "dogfood" now points at https://adb-2.test; run `databricks aitools mcp remove --names genie_one_mcp-dogfood` and add it again

Profile logfood (profile not found in [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
broken: run `databricks aitools mcp remove --names genie_one_mcp-logfood` or `DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks auth login --host [DATABRICKS_URL] --profile logfood`
24 changes: 24 additions & 0 deletions acceptance/cmd/aitools/mcp/drift-profile-missing/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Isolate HOME so the agent config files and the state file land in this test directory.
sethome home
mkdir -p home/.claude
envsubst < .databrickscfg > out && mv out .databrickscfg
export DATABRICKS_CONFIG_FILE=.databrickscfg

# The service, created in the fake workspace. The fake keeps one workspace per token, so each profile gets its own copy.
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=genie_one_mcp" --profile logfood --json '{"comment": "Ask questions about your data"}' &> LOG.create-genie_one_mcp-logfood
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=genie_one_mcp" --profile dogfood --json '{"comment": "Ask questions about your data"}' &> LOG.create-genie_one_mcp-dogfood

title "Both profiles get a server"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents claude-code
trace $CLI aitools mcp add --profile dogfood --names system.ai.genie_one_mcp --agents claude-code

title "logfood is deleted from the Databricks config file: list reports it and exits 0"
envsubst < dogfood-only.databrickscfg > out && mv out .databrickscfg
trace $CLI aitools mcp list

title "dogfood now points at another host: list reports the host change"
envsubst < dogfood-moved.databrickscfg > out && mv out .databrickscfg
trace $CLI aitools mcp list --output json

title "The same change in text"
trace $CLI aitools mcp list
7 changes: 7 additions & 0 deletions acceptance/cmd/aitools/mcp/list-and-remove/.databrickscfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood

[dogfood]
host = $DATABRICKS_HOST
token = test-token-dogfood
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/mcp/list-and-remove/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
178 changes: 178 additions & 0 deletions acceptance/cmd/aitools/mcp/list-and-remove/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

=== Two profiles, add twice: logfood gets two services, dogfood gets one

>>> [CLI] aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code
Profile logfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

genie_one_mcp-logfood system.ai.genie_one_mcp
claude-code installed [TEST_TMP_DIR]/home/.claude.json

github-logfood system.ai.github
claude-code installed [TEST_TMP_DIR]/home/.claude.json
system.ai.github needs sign-in. Run: databricks aitools mcp login system.ai.github --profile logfood

>>> [CLI] aitools mcp add --profile dogfood --names system.ai.genie_one_mcp --agents claude-code
Profile dogfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

genie_one_mcp-dogfood system.ai.genie_one_mcp
claude-code installed [TEST_TMP_DIR]/home/.claude.json

=== list groups the servers by profile

>>> [CLI] aitools mcp list
Profile dogfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-dogfood system.ai.genie_one_mcp Claude Code

Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
github-logfood system.ai.github Claude Code

=== list as JSON

>>> [CLI] aitools mcp list --output json
{
"profiles": [
{
"profile": "dogfood",
"host": "[DATABRICKS_URL]",
"config_file": "[TEST_TMP_DIR]/.databrickscfg",
"status": "ok",
"servers": [
{
"name": "genie_one_mcp-dogfood",
"service": "system.ai.genie_one_mcp",
"host": "[DATABRICKS_URL]",
"sign_in_required": false,
"status": "ok",
"agents": [
{
"name": "claude-code",
"path": "[TEST_TMP_DIR]/home/.claude.json",
"status": "installed"
}
]
}
]
},
{
"profile": "logfood",
"host": "[DATABRICKS_URL]",
"config_file": "[TEST_TMP_DIR]/.databrickscfg",
"status": "ok",
"servers": [
{
"name": "genie_one_mcp-logfood",
"service": "system.ai.genie_one_mcp",
"host": "[DATABRICKS_URL]",
"sign_in_required": false,
"status": "ok",
"agents": [
{
"name": "claude-code",
"path": "[TEST_TMP_DIR]/home/.claude.json",
"status": "installed"
}
]
},
{
"name": "github-logfood",
"service": "system.ai.github",
"host": "[DATABRICKS_URL]",
"sign_in_required": true,
"status": "ok",
"agents": [
{
"name": "claude-code",
"path": "[TEST_TMP_DIR]/home/.claude.json",
"status": "installed"
}
]
}
]
}
],
"unmanaged": [],
"warnings": []
}

=== remove --profile removes that profile only

>>> [CLI] aitools mcp remove --profile dogfood
Removed genie_one_mcp-dogfood system.ai.genie_one_mcp profile dogfood (Claude Code)

>>> [CLI] aitools mcp list
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
github-logfood system.ai.github Claude Code

=== A hand-edited entry is listed as modified; an unmanaged ug entry is listed and never changed

>>> [CLI] aitools mcp list
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
github-logfood system.ai.github Claude Code (modified)
changed outside this CLI in Claude Code: delete the entry from [TEST_TMP_DIR]/home/.claude.json by hand and run `databricks aitools mcp remove --names github-logfood` again, or add the server again with --force

Unmanaged Databricks MCP entries (not changed by this command):
Claude Code web_search ug mcp-proxy

=== --profile lists that profile only, without the unmanaged entries

>>> [CLI] aitools mcp list --profile logfood
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
github-logfood system.ai.github Claude Code (modified)
changed outside this CLI in Claude Code: delete the entry from [TEST_TMP_DIR]/home/.claude.json by hand and run `databricks aitools mcp remove --names github-logfood` again, or add the server again with --force

=== remove leaves the modified entry in place and says why

>>> [CLI] aitools mcp remove --names github-logfood,genie_one_mcp-logfood
Removed genie_one_mcp-logfood system.ai.genie_one_mcp profile logfood (Claude Code)
Skipped github-logfood: Claude Code has an entry named github-logfood that was changed outside this CLI; left in place. To remove it, delete the entry from [TEST_TMP_DIR]/home/.claude.json by hand and run `databricks aitools mcp remove --names github-logfood` again, or add the server again with --force

>>> jq .mcpServers | keys home/.claude.json
[
"github-logfood",
"web_search"
]

>>> jq .mcp | [.servers[] | {name, profile, agents: (.agents | keys)}] home/.databricks/aitools/skills/.state.json
[
{
"name": "github-logfood",
"profile": "logfood",
"agents": [
"claude-code"
]
}
]

=== remove --all removes what this CLI wrote and nothing else

>>> [CLI] aitools mcp remove --all --output json
{
"removed": [],
"skipped": [
{
"name": "github-logfood",
"agent": "claude-code",
"reason": "Claude Code has an entry named github-logfood that was changed outside this CLI; left in place. To remove it, delete the entry from [TEST_TMP_DIR]/home/.claude.json by hand and run `databricks aitools mcp remove --names github-logfood` again, or add the server again with --force"
}
]
}

>>> jq .mcpServers | keys home/.claude.json
[
"github-logfood",
"web_search"
]

>>> [CLI] aitools mcp list
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg)
github-logfood system.ai.github Claude Code (modified)
changed outside this CLI in Claude Code: delete the entry from [TEST_TMP_DIR]/home/.claude.json by hand and run `databricks aitools mcp remove --names github-logfood` again, or add the server again with --force

Unmanaged Databricks MCP entries (not changed by this command):
Claude Code web_search ug mcp-proxy
42 changes: 42 additions & 0 deletions acceptance/cmd/aitools/mcp/list-and-remove/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Isolate HOME so the agent config files and the state file land in this test directory.
sethome home
mkdir -p home/.claude
envsubst < .databrickscfg > out && mv out .databrickscfg
export DATABRICKS_CONFIG_FILE=.databrickscfg

# The services of system.ai, created in the fake workspace. The fake keeps one workspace per token, so each profile
# gets its own copy.
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=genie_one_mcp" --profile logfood --json '{"comment": "Ask questions about your data"}' &> LOG.create-genie_one_mcp-logfood
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=github" --profile logfood --json '{"comment": "Repositories, issues, pull requests", "config": {"source_connection": {"name": "connections/github", "options": {"oauth_provider": "OAUTH_PROVIDER_GITHUB_MCP"}}}}' &> LOG.create-github-logfood
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=genie_one_mcp" --profile dogfood --json '{"comment": "Ask questions about your data"}' &> LOG.create-genie_one_mcp-dogfood

title "Two profiles, add twice: logfood gets two services, dogfood gets one"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code
trace $CLI aitools mcp add --profile dogfood --names system.ai.genie_one_mcp --agents claude-code

title "list groups the servers by profile"
trace $CLI aitools mcp list

title "list as JSON"
trace $CLI aitools mcp list --output json

title "remove --profile removes that profile only"
trace $CLI aitools mcp remove --profile dogfood
trace $CLI aitools mcp list

title "A hand-edited entry is listed as modified; an unmanaged ug entry is listed and never changed"
jq '.mcpServers["github-logfood"].command = "/usr/bin/other" | .mcpServers.web_search = {"command": "ug", "args": ["mcp-proxy"]}' home/.claude.json > home/claude.tmp && mv home/claude.tmp home/.claude.json
trace $CLI aitools mcp list

title "--profile lists that profile only, without the unmanaged entries"
trace $CLI aitools mcp list --profile logfood

title "remove leaves the modified entry in place and says why"
trace $CLI aitools mcp remove --names github-logfood,genie_one_mcp-logfood
trace jq '.mcpServers | keys' home/.claude.json
trace jq '.mcp | [.servers[] | {name, profile, agents: (.agents | keys)}]' home/.databricks/aitools/skills/.state.json

title "remove --all removes what this CLI wrote and nothing else"
trace $CLI aitools mcp remove --all --output json
trace jq '.mcpServers | keys' home/.claude.json
trace $CLI aitools mcp list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[mcp_servers.broken]]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
Loading
Loading