Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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-$UNIQUE_NAME

[dogfood]
host = $DATABRICKS_HOST
token = test-token-dogfood-$UNIQUE_NAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
41 changes: 41 additions & 0 deletions acceptance/cmd/aitools/mcp/add-agent-not-installed/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

=== An agent named with --agents that is not installed is refused; the installed agent still gets the server, and the command exits non-zero

>>> [CLI] aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents claude-code,antigravity --output json
{
"profile": "logfood",
"host": "[DATABRICKS_URL]",
"scope": "global",
"servers": [
{
"name": "genie_one_mcp-logfood",
"service": "system.ai.genie_one_mcp",
"sign_in_required": false,
"agents": [
{
"name": "claude-code",
"status": "installed",
"path": "[TEST_TMP_DIR]/home/.claude.json"
},
{
"name": "antigravity",
"status": "failed",
"error_category": "UNKNOWN_AGENT",
"message": "Antigravity is not installed; install it first or leave it out of --agents"
}
]
}
]
}

=== Nothing was created for Antigravity

>>> ls -A home
.claude
.claude.json
.databricks

=== With no installed agent named, the command is refused before any request, and the text output says what to do

>>> [CLI] aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents antigravity
Error: Antigravity is not installed; install it first or leave it out of --agents
17 changes: 17 additions & 0 deletions acceptance/cmd/aitools/mcp/add-agent-not-installed/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.
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

title "An agent named with --agents that is not installed is refused; the installed agent still gets the server, and the command exits non-zero"
musterr trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents claude-code,antigravity --output json

title "Nothing was created for Antigravity"
trace ls -A home

title "With no installed agent named, the command is refused before any request, and the text output says what to do"
musterr trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents antigravity
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood-$UNIQUE_NAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
23 changes: 23 additions & 0 deletions acceptance/cmd/aitools/mcp/add-default-config/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

=== Without DATABRICKS_CONFIG_FILE the server is added for the default config file

>>> [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

=== Claude Code config has no pinned variables for the server

>>> gron.py home/.claude.json
json.mcpServers.genie_one_mcp-logfood.env = {};

=== State holds the binding with no config file

>>> jq .mcp.servers[] | {name, profile, config_file} home/.databricks/aitools/skills/.state.json
{
"name": "genie_one_mcp-logfood",
"profile": "logfood",
"config_file": ""
}
17 changes: 17 additions & 0 deletions acceptance/cmd/aitools/mcp/add-default-config/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Isolate HOME. The profile is in the default config file, so DATABRICKS_CONFIG_FILE is unset and no config file is pinned.
sethome home
mkdir -p home/.claude
envsubst < .databrickscfg > home/.databrickscfg
unset DATABRICKS_CONFIG_FILE

# The services of system.ai, created in the fake workspace.
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

title "Without DATABRICKS_CONFIG_FILE the server is added for the default config file"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp --agents claude-code

title "Claude Code config has no pinned variables for the server"
trace gron.py home/.claude.json | grep -F 'mcpServers.genie_one_mcp-logfood.env'

title "State holds the binding with no config file"
trace jq '.mcp.servers[] | {name, profile, config_file}' home/.databricks/aitools/skills/.state.json
7 changes: 7 additions & 0 deletions acceptance/cmd/aitools/mcp/add-name-notices/.databrickscfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood-$UNIQUE_NAME

[dogfood]
host = $DATABRICKS_HOST
token = test-token-dogfood-$UNIQUE_NAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mcpServers": {"genie_one_mcp-dogfood": {"command": "users-own", "args": ["users-own"]}, "user-server": {"command": "true"}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
35 changes: 35 additions & 0 deletions acceptance/cmd/aitools/mcp/add-name-notices/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

=== A generated name that an entry this CLI did not write holds gets a suffix, and the output says who holds the base name

>>> [CLI] aitools mcp add --profile dogfood --names genie_one_mcp --agents cursor
Profile dogfood ([DATABRICKS_URL])
Agents (named with --agents): cursor

genie_one_mcp-dogfood-2 system.ai.genie_one_mcp
genie_one_mcp-dogfood is taken in Cursor; using genie_one_mcp-dogfood-2
cursor installed [TEST_TMP_DIR]/home/.cursor/mcp.json

Cursor may ask you to approve genie_one_mcp-dogfood-2. Run: cursor-agent mcp enable genie_one_mcp-dogfood-2 (`agent` in the Cursor docs), or approve it in Cursor's MCP settings.

=== --force replaces the user's own entry, and the output says so

>>> [CLI] aitools mcp add --profile dogfood --names dbsql --name user-server --agents cursor --force
Profile dogfood ([DATABRICKS_URL])
Agents (named with --agents): cursor

user-server system.ai.dbsql
replaced user-server in Cursor (not written by this CLI)
cursor installed [TEST_TMP_DIR]/home/.cursor/mcp.json
Needs an account admin to turn on the Enhanced Unity Gateway preview.

Cursor may ask you to approve user-server. Run: cursor-agent mcp enable user-server (`agent` in the Cursor docs), or approve it in Cursor's MCP settings.

=== The user's entry that was not replaced is intact

>>> jq .mcpServers["genie_one_mcp-dogfood"] home/.cursor/mcp.json
{
"command": "users-own",
"args": [
"users-own"
]
}
19 changes: 19 additions & 0 deletions acceptance/cmd/aitools/mcp/add-name-notices/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Isolate HOME so the agent config files and the state file land in this test directory.
sethome home
envsubst < .databrickscfg > out && mv out .databrickscfg
export DATABRICKS_CONFIG_FILE=.databrickscfg

# The services of system.ai, created in the fake workspace.
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
MSYS_NO_PATHCONV=1 $CLI api post "/api/2.1/unity-catalog/mcp-services?parent=schemas/system.ai&mcp_service_id=dbsql" --profile dogfood --json '{"comment": "Query your SQL warehouses"}' &> LOG.create-dbsql-dogfood

# home/.cursor/mcp.json holds the user's own Cursor servers. Their names are the ones the CLI would generate or use.

title "A generated name that an entry this CLI did not write holds gets a suffix, and the output says who holds the base name"
trace $CLI aitools mcp add --profile dogfood --names genie_one_mcp --agents cursor

title "--force replaces the user's own entry, and the output says so"
trace $CLI aitools mcp add --profile dogfood --names dbsql --name user-server --agents cursor --force

title "The user's entry that was not replaced is intact"
trace jq '.mcpServers["genie_one_mcp-dogfood"]' home/.cursor/mcp.json
3 changes: 3 additions & 0 deletions acceptance/cmd/aitools/mcp/add-text/.databrickscfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood-$UNIQUE_NAME
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/mcp/add-text/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
76 changes: 76 additions & 0 deletions acceptance/cmd/aitools/mcp/add-text/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

=== Text output: Cursor approval hint, and the sign-in step for github

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

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

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
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.

=== Running it again re-asserts the entries, and nothing is written twice

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

genie_one_mcp-logfood system.ai.genie_one_mcp
claude-code already installed, re-asserted [TEST_TMP_DIR]/home/.claude.json
cursor already installed, re-asserted [TEST_TMP_DIR]/home/.cursor/mcp.json

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
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

>>> cat home/.cursor/mcp.json
{
"mcpServers": {
"genie_one_mcp-logfood": {
"args": [
"aitools",
"mcp",
"serve",
"--profile",
"logfood",
"--service",
"system.ai.genie_one_mcp",
"--agent",
"cursor"
],
"command": "[CLI]",
"env": {
"DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
}
},
"github-logfood": {
"args": [
"aitools",
"mcp",
"serve",
"--profile",
"logfood",
"--service",
"system.ai.github",
"--agent",
"cursor"
],
"command": "[CLI]",
"env": {
"DATABRICKS_CONFIG_FILE": "[TEST_TMP_DIR]/.databrickscfg"
}
}
}
}
18 changes: 18 additions & 0 deletions acceptance/cmd/aitools/mcp/add-text/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Isolate HOME so the agent config files and the state file land in this test directory.
sethome home
mkdir -p home/.claude home/.cursor
envsubst < .databrickscfg > out && mv out .databrickscfg
export DATABRICKS_CONFIG_FILE=.databrickscfg

# The services of system.ai, created in the fake workspace.
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 "Text output: Cursor approval hint, and the sign-in step for github"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code,cursor

title "Running it again re-asserts the entries, and nothing is written twice"
trace $CLI aitools mcp add --profile logfood --names system.ai.genie_one_mcp,system.ai.github --agents claude-code,cursor

title "Cursor config"
trace cat home/.cursor/mcp.json
3 changes: 3 additions & 0 deletions acceptance/cmd/aitools/mcp/add-two-agents/.databrickscfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[logfood]
host = $DATABRICKS_HOST
token = test-token-logfood-$UNIQUE_NAME
9 changes: 9 additions & 0 deletions acceptance/cmd/aitools/mcp/add-two-agents/home/.claude.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"mcpServers": {
"my-server": {
"type": "stdio",
"command": "my-server",
"args": []
}
}
}
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/mcp/add-two-agents/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
Loading
Loading