Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
28a4230
Add aitools mcp login, logout and list --check
simonfaltum Nov 12, 2026
f0a9662
Create the Claude Code config dir in the list-check and login accepta…
simonfaltum Nov 12, 2026
8965233
Update the public-repository note in the login acceptance golden
simonfaltum Nov 12, 2026
3095413
Read the MCP state from the shared skills state file in login acceptance
simonfaltum Nov 12, 2026
a071943
Seed MCP services in the sign-in acceptance tests
simonfaltum Nov 13, 2026
db6e246
Update the MCP golden outputs for the list and add flags
simonfaltum Nov 13, 2026
2879f3f
Share the sign-in helpers between login, logout and add
simonfaltum Nov 13, 2026
4e7eb44
Check the binding in login and logout, and classify their failures
simonfaltum Nov 13, 2026
e4e9fb5
Bound the sign-in wait and ignore a FAILED state left by an earlier a…
simonfaltum Nov 13, 2026
9fefd7d
Sign in to every server in add --login, and keep sign-in failures
simonfaltum Nov 13, 2026
c7f1c09
Report list --check failures as warnings and check each profile in it…
simonfaltum Nov 13, 2026
f87cb1c
Tidy the sign-in messages and drop the internal references from comments
simonfaltum Nov 13, 2026
d4f795a
Acceptance: set MSYS_NO_PATHCONV on the sign-in credential calls and …
simonfaltum Nov 13, 2026
ba9fe08
Format and lint the list and login tests
simonfaltum Nov 13, 2026
d944fd6
Escape service names in credential and service requests
simonfaltum Nov 13, 2026
7d43722
Refuse service names with URL syntax in login and logout
simonfaltum Nov 13, 2026
6a6414c
Refuse service names with URL syntax in serve
simonfaltum Nov 13, 2026
6d9d398
Delete a FAILED sign-in left by an earlier attempt before the page opens
simonfaltum Nov 13, 2026
5efccff
Name the unrelated-error check in mapListError
simonfaltum Nov 13, 2026
52ebf55
Treat only the service's own 404 as not found in sign-in
simonfaltum Nov 13, 2026
f2ce716
Share the service lookup of sign-in commands
simonfaltum Nov 13, 2026
65634e1
Check sign-in against the service's requirement in list --check
simonfaltum Nov 13, 2026
b4bf0a4
Check the profile's token with a request in list --check
simonfaltum Nov 13, 2026
c07d09f
Report a directory or an empty command as a missing binary in list --…
simonfaltum Nov 13, 2026
2e1a0c1
Name the profile in login and logout JSON as soon as it is resolved
simonfaltum Nov 13, 2026
50af916
Keep the run error when login or logout JSON cannot be written
simonfaltum Nov 13, 2026
9e870de
Set the browser explicitly in the sign-in tests that expect it to open
simonfaltum Nov 13, 2026
fba5003
Poll for the sign-in while the browser command is still running
simonfaltum Nov 13, 2026
4bab9d0
Send the output of the browser command to stderr during sign-in
simonfaltum Nov 13, 2026
829fc7c
Share the DATABRICKS_CONFIG_FILE prefix of hint commands
simonfaltum Nov 13, 2026
0cfd322
Name the config file in auth and login hints for a pinned server
simonfaltum Nov 13, 2026
a8f38e1
Print the add --login sign-in hint once and with the right command
simonfaltum Nov 13, 2026
230ca0d
Restore the config file environment in a defer in list --check
simonfaltum Nov 13, 2026
3dd7304
Reuse the failed status and group the timeout category with the others
simonfaltum Nov 13, 2026
c730b4c
Fix the top-level failure docs, the --login help and the sign-in fixt…
simonfaltum Nov 13, 2026
59d4ebb
Update the aitools goldens for the pinned hints and the --login help
simonfaltum Nov 13, 2026
0f91402
Order the results of the sign-in test helper as the linter expects
simonfaltum Nov 13, 2026
af4ce3c
Expect the resolved config file in the list --check warning test
simonfaltum Nov 13, 2026
face438
Write pinned config file paths with forward slashes in hints
simonfaltum Nov 13, 2026
7f6150b
Serialize the default browser opener and return when a browser comman…
simonfaltum Nov 13, 2026
2e6ef77
Name the pinned config file in the login hint of a refresh or binding…
simonfaltum Nov 13, 2026
7c1984d
Name the file the shell reads in the login hint of an unpinned list -…
simonfaltum Nov 13, 2026
0c1a58f
Let logout remove a credential whose service the profile can no longe…
simonfaltum Nov 13, 2026
c53dde1
Print no login hint after an add --login failure that a login does no…
simonfaltum Nov 13, 2026
69f146a
Report a skipped list --check and the sign-in of a server the service…
simonfaltum Nov 13, 2026
6791c3c
Synchronize the sign-in test that reads the opened URL, and gate the …
simonfaltum Nov 13, 2026
a31e921
Describe refused service names in PathSafeName's doc as the commands'…
simonfaltum Nov 13, 2026
c159abb
Name the profile of a failed state read, and say when login finds the…
simonfaltum Nov 13, 2026
632f9ca
Document the sign-in commands, switch on the sign-in state, and link …
simonfaltum Nov 13, 2026
11800de
List the remaining sign-in states explicitly in the switches
simonfaltum Nov 13, 2026
2cb8447
libs/browser: stub the default launcher in the tests
simonfaltum Nov 13, 2026
dad7467
libs/browser: do not wait for the browser the default opener starts
simonfaltum Nov 13, 2026
c655525
libs/exec: test WithInheritOutputToStderr and correct its doc
simonfaltum Nov 13, 2026
19480b3
aitools mcp login: keep polling through server and network errors
simonfaltum Nov 13, 2026
9678a0c
aitools mcp login: name the sign-in URL only when the page was shown
simonfaltum Nov 13, 2026
c0738f0
aitools mcp list --check: say how to sign in when a sign-in is needed
simonfaltum Nov 13, 2026
a4f3e77
aitools mcp list --check: bound each profile and mark only refused to…
simonfaltum Nov 13, 2026
c96c767
aitools mcp list --check: skip only the servers that cannot be checked
simonfaltum Nov 13, 2026
af2a856
aitools mcp add --login: record each server's sign-in in the JSON doc…
simonfaltum Nov 13, 2026
a2682e2
aitools mcp list: derive the profile token from the servers' checks
simonfaltum Nov 13, 2026
267e56e
acceptance: keep setup output in LOG files and edit the state with up…
simonfaltum Nov 13, 2026
db94f42
aitools, browser: table tests and doc comments
simonfaltum Nov 13, 2026
040c1cb
libs/aitools/mcp: discard the timeout helper's result in a test
simonfaltum Nov 13, 2026
8ebeb64
aitools mcp list --check: bound each request, not the whole profile
simonfaltum Nov 13, 2026
63db3a3
Adapt serve's tests to the rejected-token refresh rule
simonfaltum Nov 13, 2026
d84867f
Expect STATE_INVALID for an unreadable state file in mcp login
simonfaltum Nov 13, 2026
aa7370e
Regenerate the hidden help golden for pflag 1.1 boolean flags
simonfaltum Nov 16, 2026
39b51ff
List the existing profiles when login names a missing one
simonfaltum Nov 16, 2026
8e9fa58
Regenerate the add and help goldens after the reworded add help
simonfaltum Nov 16, 2026
7eeb9e7
Regenerate the list and remove help golden for list --check
simonfaltum Nov 16, 2026
3f1c897
Pass the pinned file to serveProxy in the redirect and debug-log tests
simonfaltum Nov 16, 2026
ab8898b
aitools mcp login: plainer help, examples, and a hint for leaf names
simonfaltum Nov 16, 2026
7829aa4
aitools mcp list --check: run a profile's sign-in checks concurrently
simonfaltum Nov 16, 2026
6e87133
Name every mcp command in the group help and point remove at logout
simonfaltum Nov 16, 2026
e60b9d0
Regenerate the add golden for the single Cursor approval hint
simonfaltum Nov 16, 2026
608d7f7
Call SignInRequired as a method in login, list --check and their tests
simonfaltum Nov 16, 2026
10344cb
Adapt login and add to the failure helper from card 04
simonfaltum Nov 17, 2026
f5084ee
Handle the SignInURL error in login and add --login
simonfaltum Nov 17, 2026
9337927
Import shellquote for the stored-name check that card 04 added
simonfaltum Nov 17, 2026
807cf33
Update the goldens for the card 04 review's sign-in indent and notes
simonfaltum Nov 17, 2026
c1d2179
Regenerate goldens for the GovCloud GitHub app in the service note
simonfaltum Nov 17, 2026
976c9be
aitools mcp login: print the service note once, and drop the trailing…
simonfaltum Nov 17, 2026
7e8fb8b
aitools mcp add --login and list --check: fix sign-in state, cancella…
simonfaltum Nov 17, 2026
f86f90f
aitools mcp serve: name the config file in the sign-in hint as Config…
simonfaltum Nov 17, 2026
01b3f89
aitools mcp list --check and login: keep a refused OAuth refresh failed
simonfaltum Nov 17, 2026
869c748
aitools mcp add --login: report a cancelled sign-in once, and reuse d…
simonfaltum Nov 17, 2026
466befa
Add a changelog fragment for the browser open that no longer waits
simonfaltum Nov 17, 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
1 change: 1 addition & 0 deletions .nextchanges/cli/browser-open-no-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* `databricks auth login` no longer waits for the browser that the default opener starts to close before it continues. ([#7551](https://github.com/databricks/cli/pull/7551))
4 changes: 2 additions & 2 deletions acceptance/cmd/aitools/mcp/add-text/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ genie_one_mcp-logfood system.ai.genie_one_mcp
github-logfood system.ai.github
claude-code installed [TEST_TMP_DIR]/home/.claude.json
cursor installed [TEST_TMP_DIR]/home/.cursor/mcp.json
system.ai.github needs sign-in. Run: databricks aitools mcp login system.ai.github --profile logfood
system.ai.github needs sign-in. Run: DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).

Cursor may ask you to approve genie_one_mcp-logfood, github-logfood. Run cursor-agent mcp enable <name> for each (`agent` in the Cursor docs), or approve them in Cursor's MCP settings.
Expand All @@ -30,7 +30,7 @@ genie_one_mcp-logfood system.ai.genie_one_mcp
github-logfood system.ai.github
claude-code already installed, re-asserted [TEST_TMP_DIR]/home/.claude.json
cursor already installed, re-asserted [TEST_TMP_DIR]/home/.cursor/mcp.json
system.ai.github needs sign-in. Run: databricks aitools mcp login system.ai.github --profile logfood
system.ai.github needs sign-in. Run: DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).

=== Cursor config
Expand Down
11 changes: 7 additions & 4 deletions acceptance/cmd/aitools/mcp/help/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Each agent of a server has one of these statuses. The JSON output uses the same
--profile lists the servers of that profile only. Unmanaged entries have no profile, so they are not
listed then.

This command makes no network calls. It always exits 0 when entries have drifted or cannot be checked;
an entry or agent config that cannot be checked is a warning.
Without --check this command makes no network calls. With --check, a token is requested for each profile,
the sign-in state of each sign-in-required server is read, and the recorded binary is checked. It always exits 0
when entries have drifted or cannot be checked; an entry or agent config that cannot be checked is a warning.

Usage:
databricks aitools mcp list [flags]
Expand All @@ -31,7 +32,8 @@ Examples:
databricks aitools mcp list --output json

Flags:
-h, --help[=true|false] help for list
--check[=true|false] Also check tokens, sign-in state and the recorded binary (uses the network)
-h, --help[=true|false] help for list

Global Flags:
--debug[=true|false] enable debug logging
Expand All @@ -51,7 +53,8 @@ With --profile or --all and nothing installed to remove, the command succeeds an
Only entries this CLI wrote are removed. An entry that was changed outside this CLI is left in place
and reported. When an agent's config moved, the entry is removed from the file it was written to.
Entries that run 'aitools mcp serve' without an install record are not chosen by any flag;
'aitools mcp list' shows them as unmanaged. Provider credentials are not deleted.
'aitools mcp list' shows them as unmanaged. Your sign-ins to services are kept; 'aitools mcp logout'
removes one.

Usage:
databricks aitools mcp remove [flags]
Expand Down
20 changes: 13 additions & 7 deletions acceptance/cmd/aitools/mcp/hidden/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ aitools help does not list mcp

>>> [CLI] aitools mcp --help
Databricks managed MCP servers give coding agents tools for Databricks services, such as GitHub or web search.
Use 'add' to install them into coding agents, bound to a Databricks profile.
Use 'add' to install them into coding agents, bound to a Databricks profile, 'list' to see what is installed,
and 'remove' to uninstall them. Some services use your account with an external provider, such as GitHub:
'login' signs you in to one and 'logout' removes the sign-in.

Usage:
databricks aitools mcp [command]

Available Commands:
add Install Databricks managed MCP servers into coding agents
list List Databricks managed MCP servers installed by this CLI
login Sign in to a Databricks managed MCP service with your account
logout Remove your sign-in to a Databricks managed MCP service
remove Remove Databricks managed MCP servers from coding agents

Flags:
Expand Down Expand Up @@ -50,12 +54,14 @@ Examples:
databricks aitools mcp add --names github,web_search --agents claude-code,cursor --profile dogfood

Flags:
--agents string Agents to install for, comma-separated (default: every detected MCP-capable agent)
--force[=true|false] Overwrite an existing server with the same name that this CLI did not write
-h, --help[=true|false] help for add
--location string Schema to resolve leaf names in, as <catalog>.<schema> (default: system.ai, or the one schema that the full names in --names share when there are no leaf names)
--name string Server name to use instead of the generated one; only with exactly one service
--names string Services to install: full names (system.ai.github) or leaf names (github), comma-separated
--agents string Agents to install for, comma-separated (default: every detected MCP-capable agent)
--force[=true|false] Overwrite an existing server with the same name that this CLI did not write
-h, --help[=true|false] help for add
--location string Schema to resolve leaf names in, as <catalog>.<schema> (default: system.ai, or the one schema that the full names in --names share when there are no leaf names)
--login[=true|false] Sign in to each sign-in-required server that was installed, after the installs
--name string Server name to use instead of the generated one; only with exactly one service
--names string Services to install: full names (system.ai.github) or leaf names (github), comma-separated
--no-login[=true|false] Do not sign in; print the login commands for sign-in-required servers (default)

Global Flags:
--debug[=true|false] enable debug logging
Expand Down
2 changes: 1 addition & 1 deletion acceptance/cmd/aitools/mcp/list-and-remove/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ genie_one_mcp-logfood system.ai.genie_one_mcp

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
system.ai.github needs sign-in. Run: DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).

>>> [CLI] aitools mcp add --profile dogfood --names system.ai.genie_one_mcp --agents claude-code
Expand Down
3 changes: 3 additions & 0 deletions acceptance/cmd/aitools/mcp/list-check/.databrickscfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-list-check
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/mcp/list-check/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
97 changes: 97 additions & 0 deletions acceptance/cmd/aitools/mcp/list-check/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

=== Install a service that needs no sign-in and one that does

>>> [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_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).

=== list --check: the token mints, and GitHub needs sign-in

>>> [CLI] aitools mcp list --check
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg) token ok
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code
github-logfood system.ai.github Claude Code sign-in needed
to sign in: run `DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood`

=== Once the sign-in completes, GitHub is signed in

>>> [CLI] api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json {}

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

=== A recorded binary that is gone is reported as missing

>>> [CLI] aitools mcp list --check --output json
{
"profiles": [
{
"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"
}
],
"check": {
"token": "ok",
"binary": "failed"
}
},
{
"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"
}
],
"check": {
"token": "ok",
"sign_in": "ok",
"binary": "failed"
}
}
]
}
],
"unmanaged": [],
"warnings": []
}

=== logout ends the sign-in; list --check shows it needed again

>>> [CLI] aitools mcp logout system.ai.github --profile logfood
Signed out of system.ai.github on profile logfood.

>>> [CLI] aitools mcp list --check
Profile logfood ([DATABRICKS_URL], config file [TEST_TMP_DIR]/.databrickscfg) token ok
genie_one_mcp-logfood system.ai.genie_one_mcp Claude Code binary missing
github-logfood system.ai.github Claude Code sign-in needed, binary missing
to sign in: run `DATABRICKS_CONFIG_FILE=[TEST_TMP_DIR]/.databrickscfg databricks aitools mcp login system.ai.github --profile logfood`
28 changes: 28 additions & 0 deletions acceptance/cmd/aitools/mcp/list-check/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 serves what the scripts create, as in add-text.
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

title "Install a service that needs no sign-in and one that does"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code

title "list --check: the token mints, and GitHub needs sign-in"
trace $CLI aitools mcp list --check

title "Once the sign-in completes, GitHub is signed in"
MSYS_NO_PATHCONV=1 trace $CLI api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json '{}' > /dev/null
trace $CLI aitools mcp list --check

title "A recorded binary that is gone is reported as missing"
# The state records the binary that add was started with, which is $CLI, as JSON writes it. Both servers record it.
update_file.py home/.databricks/aitools/skills/.state.json "$(python3 -I -c 'import json,sys; print(json.dumps(sys.argv[1])[1:-1])' "$CLI")" /nonexistent/databricks
trace $CLI aitools mcp list --check --output json

title "logout ends the sign-in; list --check shows it needed again"
trace $CLI aitools mcp logout system.ai.github --profile logfood
trace $CLI aitools mcp list --check
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-login-flips-active
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
90 changes: 90 additions & 0 deletions acceptance/cmd/aitools/mcp/login-flips-active/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

=== A service that needs no sign-in exits 0 and says so

>>> [CLI] aitools mcp login system.ai.genie_one_mcp --profile logfood
system.ai.genie_one_mcp does not need sign-in.

=== login prints the sign-in URL and waits; the sign-in completes in the browser

>>> retry --until Waiting for sign-in cat login.txt
Sign in with the same account you use for Databricks profile logfood.
Open this URL to sign in to system.ai.github:
[DATABRICKS_URL]/mcp-service-login?name=system.ai.github&o=[WORKSPACE_ID]
Waiting for sign-in...

>>> [CLI] api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json {}

>>> cat login.txt
Sign in with the same account you use for Databricks profile logfood.
Open this URL to sign in to system.ai.github:
[DATABRICKS_URL]/mcp-service-login?name=system.ai.github&o=[WORKSPACE_ID]
Waiting for sign-in...
Signed in to system.ai.github on profile logfood.
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).

=== login again when already signed in returns at once

>>> [CLI] aitools mcp login system.ai.github --profile logfood --output json
Already signed in to system.ai.github on profile logfood.
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).
{
"service": "system.ai.github",
"profile": "logfood",
"host": "[DATABRICKS_URL]",
"state": "ACTIVE"
}

=== logout removes the sign-in; a second logout finds nothing and still exits 0

>>> [CLI] aitools mcp logout system.ai.github --profile logfood
Signed out of system.ai.github on profile logfood.

>>> [CLI] aitools mcp logout system.ai.github --profile logfood --output json
Not signed in to system.ai.github on profile logfood.
{
"service": "system.ai.github",
"profile": "logfood",
"host": "[DATABRICKS_URL]",
"state": "NOT_SIGNED_IN"
}

=== add --login installs the server and signs in during the same run

>>> retry --until Waiting for sign-in cat add.txt
Profile logfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

github-logfood system.ai.github
claude-code installed [TEST_TMP_DIR]/home/.claude.json
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).
Sign in with the same account you use for Databricks profile logfood.
Open this URL to sign in to system.ai.github:
[DATABRICKS_URL]/mcp-service-login?name=system.ai.github&o=[WORKSPACE_ID]
Waiting for sign-in...

>>> [CLI] api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json {}

>>> cat add.txt
Profile logfood ([DATABRICKS_URL])
Agents (named with --agents): claude-code

github-logfood system.ai.github
claude-code installed [TEST_TMP_DIR]/home/.claude.json
Public repositories only until a repository owner installs https://github.com/apps/databricks-github-connector (on AWS GovCloud, https://github.com/apps/databricks-gh-connector-gov-cloud).
Sign in with the same account you use for Databricks profile logfood.
Open this URL to sign in to system.ai.github:
[DATABRICKS_URL]/mcp-service-login?name=system.ai.github&o=[WORKSPACE_ID]
Waiting for sign-in...
Signed in to system.ai.github on profile logfood.

>>> jq .mcp | [.servers[] | {name, service, profile, agents: (.agents | keys)}] home/.databricks/aitools/skills/.state.json
[
{
"name": "github-logfood",
"service": "system.ai.github",
"profile": "logfood",
"agents": [
"claude-code"
]
}
]
39 changes: 39 additions & 0 deletions acceptance/cmd/aitools/mcp/login-flips-active/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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
# No browser: the CLI prints the sign-in URL and polls.
export BROWSER=none

# The services of system.ai, created in the fake workspace. The fake serves what the scripts create, as in add-text.
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

title "A service that needs no sign-in exits 0 and says so"
trace $CLI aitools mcp login system.ai.genie_one_mcp --profile logfood

title "login prints the sign-in URL and waits; the sign-in completes in the browser"
$CLI aitools mcp login system.ai.github --profile logfood > login.txt 2>&1 &
PID=$!
trace retry --until "Waiting for sign-in" cat login.txt
MSYS_NO_PATHCONV=1 trace $CLI api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json '{}' > /dev/null
wait $PID
trace cat login.txt

title "login again when already signed in returns at once"
trace $CLI aitools mcp login system.ai.github --profile logfood --output json

title "logout removes the sign-in; a second logout finds nothing and still exits 0"
trace $CLI aitools mcp logout system.ai.github --profile logfood
trace $CLI aitools mcp logout system.ai.github --profile logfood --output json

title "add --login installs the server and signs in during the same run"
$CLI aitools mcp add --profile logfood --names system.ai.github --agents claude-code --login > add.txt 2>&1 &
PID=$!
trace retry --until "Waiting for sign-in" cat add.txt
MSYS_NO_PATHCONV=1 trace $CLI api post /api/2.1/unity-catalog/mcp-services/system.ai.github/user-credentials --profile logfood --json '{}' > /dev/null
wait $PID
trace cat add.txt
trace jq '.mcp | [.servers[] | {name, service, profile, agents: (.agents | keys)}]' home/.databricks/aitools/skills/.state.json
rm login.txt add.txt
7 changes: 7 additions & 0 deletions acceptance/cmd/aitools/mcp/login-flips-active/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The background login and add print their sign-in line after a moment, which a slow runner can take longer than the
# retry default of 2.5 seconds to show. The retries wait up to 30 seconds.
Env.RETRY_MAX_ATTEMPTS = "60"
Env.RETRY_INTERVAL_MS = "500"

# The background login and add write these files, and the script removes them.
Ignore = ["login.txt", "add.txt"]
Loading