Skip to content

Add MCP state records, drift check and profile binding checks - #7537

Merged
simonfaltum merged 1 commit into
mainfrom
aitools-mcp/03-state
Nov 19, 2026
Merged

simonfaltum merged 1 commit into
mainfrom
aitools-mcp/03-state

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

This pull request is part of a stack, on top of #7538, that adds the hidden databricks aitools mcp command group. It adds MCP state records, drift checks and profile binding checks. Nothing calls them yet.

Changes

  • MCP records are the mcp section of the aitools state file (schema v3). A file with only MCP records counts as no install. Installer saves keep the section. Uninstall and SaveMCPState remove the file once nothing remains.
  • Reconcile reports profile_missing and host_changed, using the host and workspace the SDK resolves, with no network.
  • Bind checks the profile before it resolves credentials, so a re-pointed host is never contacted.
  • SDK configuration errors are UNCATEGORIZED. Only failed authentication is AUTH_FAILED. BindError.ExitCode() returns 2, which the serve PR maps to the process exit status.

Why

A proxy must refuse to start when its profile was deleted or re-pointed, or an agent would silently use the wrong workspace. It must never send another workspace's credential.

Decisions to review

  • MCP records share the skills state file. A CLI older than schema v3 drops the mcp section on its next save, and its uninstall deletes a file that holds only MCP records.
  • An entry pinned to another config file fails the bind with PROFILE_HOST_CHANGED, rather than printing the no-record notice, because binding through this file would switch the server silently. Changing DATABRICKS_CONFIG_FILE means removing and adding the server again.
  • An entry with no pinned config file is checked against ~/.databrickscfg, not DATABRICKS_CONFIG_FILE.
  • Binding never reads DATABRICKS_TOKEN or other auth variables into the profile. A profile without a token uses the SDK chain for its host.
  • Host comparison ignores case, unlike profile.WithHost. A profile that drops its workspace selector is not detected, since the recorded ID may come from the API.
  • Server names are frozen once records and agent entries hold them. ServerName and capServerName from Add MCP service discovery, known services and naming for aitools #7538 produce them, and agents name tools mcp__<name>__<tool>, which users' allow rules match, so changing either function later renames the tools of every existing install.

Tests

  • TestBindHostChangedDoesNotContactNewHost fails if a re-pointed host gets a request. TestBindWorkspaceFollowsSDKResolution covers the host query.
  • TestBindEntryInOtherConfigFileFailsClosed and TestBindNeverUsesEnvTokenForProfileWithoutToken cover the config-file and credential rules.
  • TestUninstallRemovesLeftoverFilesWithoutSkills, TestUpdateAfterPruningEverySkillAddsNewSkills and TestInstallSpecificSkillWithEmptyStateFile pass on main's behavior, which users without MCP records keep.
  • TestLoadStateHidesOnlyMCPOnlyFiles and TestUninstallKeepsStateFileWithMCPRecords cover the shared file.
  • Ran: race tests on the touched packages, experimental/aitools and cmd/aitools acceptance tests (goldens unchanged), GOOS=windows go vet, golangci-lint and task checks.
  • Not run: the Windows and macOS test suites. No acceptance test covers MCP-only output, since no CLI path writes MCP records yet.

This pull request and its description were written by Isaac.

@simonfaltum
simonfaltum changed the base branch from main to aitools-mcp/02-discovery November 12, 2026 11:49
@simonfaltum
simonfaltum force-pushed the aitools-mcp/03-state branch 2 times, most recently from e003f2d to 99f703a Compare November 12, 2026 11:57
@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from 773f68b to 93a7090 Compare November 12, 2026 14:24
@simonfaltum simonfaltum changed the title Add MCP state file, drift check, and profile binding checks Add MCP state records, drift check and profile binding checks Nov 12, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 01d1905

Run: 44525153517

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 19 7:36
💚​ aws-windows-latest-4core-16gb 1 274 17 5:19
💚​ azure linux-2core-8gb 1 271 19 8:36
💚​ azure-windows-latest-4core-16gb 1 273 17 5:58
💚​ gcp linux-2core-8gb 1 272 19 7:57
💚​ gcp-windows-latest-4core-16gb 1 274 17 6:48
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 7 slowest tests (at least 2 minutes):
duration env testname
4:48 gcp-windows-latest-4core-16gb TestFsCpDirToDirFileNotOverwritten/uc-volumes_to_local
3:49 azure-windows-latest-4core-16gb TestAccept
3:08 aws-windows-latest-4core-16gb TestAccept
3:02 gcp-windows-latest-4core-16gb TestAccept
2:21 azure linux-2core-8gb TestSyncIncrementalFileSync
2:14 aws linux-2core-8gb TestFilerWorkspaceFilesExtensionsReadDir
2:02 azure linux-2core-8gb TestAccept

@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from 93a7090 to a4521da Compare November 13, 2026 15:05
@pietern pietern added the aitools AI tools (databricks aitools) related changes label Nov 16, 2026
@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from a4521da to 833aeaa Compare November 16, 2026 12:47
@simonfaltum
simonfaltum force-pushed the aitools-mcp/03-state branch 3 times, most recently from 94587e4 to a9c735c Compare November 16, 2026 14:49
@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from 20af1c2 to 68461a5 Compare November 16, 2026 14:49
@simonfaltum
simonfaltum force-pushed the aitools-mcp/03-state branch 2 times, most recently from fa4d812 to 13dc173 Compare November 17, 2026 10:52
@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch 2 times, most recently from 1a3cc65 to 7350da2 Compare November 17, 2026 12:02
@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from 5fedd5e to f1ff0ee Compare November 17, 2026 12:36
@simonfaltum
simonfaltum force-pushed the aitools-mcp/03-state branch 2 times, most recently from 2d1b8f3 to 1d8c127 Compare November 17, 2026 15:11
@simonfaltum
simonfaltum marked this pull request as ready for review November 18, 2026 16:20
@simonfaltum
simonfaltum requested review from a team and lennartkats-db as code owners November 18, 2026 16:20
@simonfaltum
simonfaltum requested review from a team as code owners November 18, 2026 16:20

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me — no issues found.

@anton-107 anton-107 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings. I checked the order Bind runs in against SDK v0.199.0. ResolveNonAuthFromEnv skips the host, the auth attributes and workspace_id, so cfg.Host and the credential come only from the profile section, and both are checked before EnsureResolved contacts the host. A file that holds only MCP records loads as no install on every LoadState path: version, scope, update, uninstall, the legacy guard and plugin records. Older CLIs read schema v3 without a version check. Unit tests pass locally and CI is green on Linux, macOS and Windows.

Non-blocking notes:

  • Losing records disables the drift check. An older CLI that saves the shared file drops the mcp section, as the description says. After that, serve takes the "No install record" path and binds to whatever host the profile names now. The check fails open, and remove can no longer find the entry. This is worth keeping in mind for how strict the no-record path should be once add ships.
  • binding.go:83: ctx = env.Set(ctx, mcpconfig.ConfigFileEnv, configFile) doesn't seem to reach anything. The loaders use cfg.ConfigFile or the process env, and the doc comment says the token store reads the process env. Either drop it or name who reads it.
  • profileGoneError and configFileError hardcode DATABRICKS_CONFIG_FILE in their messages. They could use mcpconfig.ConfigFileEnv, now that this PR adds it.
  • A config-file mismatch reports PROFILE_HOST_CHANGED. A separate category would be easier to tell apart in later telemetry. This one is optional.

@simonfaltum

Copy link
Copy Markdown
Member Author

Thanks! On the notes:

  • Losing records: agreed. That's the cost of sharing the file, and the no-record path then binds to whatever host the profile names now. I'll keep it in mind for how strict that path should be before add ships.
  • binding.go:83: right, nothing read it. The SDK configures credentials with its own refresh context, not this one, and resolveConfigFile doesn't read the variable. Dropped in 9bc1ae9.
  • Both messages use mcpconfig.ConfigFileEnv now, in the same commit.
  • A separate category for the config-file mismatch needs a new value in the telemetry schema, so it stays PROFILE_HOST_CHANGED for now.

@simonfaltum
simonfaltum force-pushed the aitools-mcp/02-discovery branch from 09e8767 to b5f9653 Compare November 19, 2026 11:42
Base automatically changed from aitools-mcp/02-discovery to main November 19, 2026 12:24
One commit for the restack onto main. The individual commits, up to 9bc1ae9, are in the pull request's history.

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit a96c087 Nov 19, 2026
28 checks passed
@simonfaltum
simonfaltum deleted the aitools-mcp/03-state branch November 19, 2026 13:05
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

❌ Integration test report

Commit: a96c087

Run: 44530088831

Env 💥​PANIC ❌​FAIL 🟨​KNOWN 🤯​MISS 💚​RECOVERED ✅​pass 🙈​skip Time
💥​ aws linux-2core-8gb 1 3 754 15 857 1392 320:00
💥​ aws-windows-latest-4core-16gb 1 3 669 20 853 1420 320:04
💥​ azure linux-2core-8gb 1 3 919 15 672 1400 320:00
💥​ azure-windows-latest-4core-16gb 1 3 6 816 12 688 1428 320:03
💥​ gcp linux-2core-8gb 1 2 2 586 18 1008 1398 320:00
❌​ gcp-windows-latest-4core-16gb 2 508 5 1018 1426 320:03
1295 interesting tests: 1277 MISS, 8 KNOWN, 5 PANIC, 5 FAIL
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
🤯​ TestAccept 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/job_permissions 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/job_permissions/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/apps/job_permissions/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_doesnot_exist/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/artifacts/artifact_path_with_volume/volume_not_deployed/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_permissions/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/config_edits 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/config_edits/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/config_edits/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/dashboard_etag/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/flushed_cache/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/formatting_preserved/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_multiple_tasks/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_params_variables/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_pipeline_task/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_missing_state/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/json_status_selectors/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_files 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/multiple_files/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_files/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_json 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/output_json/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_json/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/output_no_changes/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/resolve_variables/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_basic 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/select_basic/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_basic/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_multiple 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/select_multiple/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/select_multiple/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_deployment/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/skip_permissions/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/target_override 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/target_override/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/target_override/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert 🤯​M 🙈​s 🤯​M 🙈​s 🤯​M 🙈​s
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert/DMS= 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/task_rename_revert/DMS=true 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/debug/fetch-repository-info/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=true/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/empty-bundle/DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC=true/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/files/no-snapshot-sync/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/basic 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/basic/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/breakglass 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/breakglass/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/can-manage 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/can-manage/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/destroy-redeploy 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/destroy-redeploy/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/dev-mode 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/dev-mode/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/legacy-state 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/legacy-state/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/missing-snapshot 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/missing-snapshot/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts/DMS=/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/no-artifacts/DMS=/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/permissions-change 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/permissions-change/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/select 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/immutable/select/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/mlops-stacks/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deploy/spark-jar-task/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/alert/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/catalog/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster/DMS= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/cluster/DMS=true 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=true/READPLAN= 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/DMS=true/READPLAN=1 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/deployment/bind/dashboard/recreation 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M 🤯​M
Top 50 slowest tests (at least 2 minutes):
duration env testname
15:04 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
14:15 gcp linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=
13:57 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
13:55 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=schema_empty_grants.yml.tmpl/READPLAN=
13:26 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
11:58 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
11:50 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
11:43 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=vector_search_index.yml.tmpl/READPLAN=
11:36 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/materialization_sets/immutable/DMS=true
11:32 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
11:22 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
11:17 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
11:14 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=vector_search_index.yml.tmpl/READPLAN=1
10:57 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
10:47 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
10:39 gcp linux-2core-8gb TestAccept/bundle/resources/schemas/rename_then_change/DMS=true
10:16 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=volume.yml.tmpl/READPLAN=
10:05 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
9:43 azure linux-2core-8gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=feature_spec.yml.tmpl/READPLAN=1
9:41 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
9:40 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=instance_pool.yml.tmpl/READPLAN=1
9:30 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
9:27 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
9:27 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=
9:19 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=
9:11 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
9:11 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
9:07 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=secret_scope_default_backend_type.yml.tmpl/READPLAN=1
9:03 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
9:00 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
8:58 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1
8:51 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=sql_warehouse.yml.tmpl/READPLAN=
8:50 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=
8:47 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=volume_path_job_ref.yml.tmpl/READPLAN=
8:45 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=model_with_permissions.yml.tmpl/READPLAN=1
8:43 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
8:35 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=pipeline_config_dots.yml.tmpl/READPLAN=1
8:33 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=sql_warehouse.yml.tmpl/READPLAN=
8:29 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=model_with_permissions.yml.tmpl/READPLAN=
8:29 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=app.yml.tmpl/READPLAN=
8:22 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=vector_search_index.yml.tmpl/READPLAN=
8:22 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
8:18 aws linux-2core-8gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=vector_search_endpoint.yml.tmpl/READPLAN=1
8:17 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=secret_scope_default_backend_type.yml.tmpl/READPLAN=
8:16 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=job_with_task.yml.tmpl/READPLAN=
8:16 azure linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=sql_warehouse.yml.tmpl/READPLAN=1
8:14 azure-windows-latest-4core-16gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=volume.yml.tmpl/READPLAN=1
8:14 aws linux-2core-8gb TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=job.yml.tmpl/READPLAN=
8:09 gcp linux-2core-8gb TestAccept/bundle/quiet-levels/DMS=true
8:04 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
(1148 table rows omitted to keep the report under 60000 bytes)

idelafuente-oc pushed a commit to idelafuente-oc/cli that referenced this pull request Nov 20, 2026
…#7544)

This pull request is part of the stack that adds the hidden `databricks
aitools mcp` command group. It builds on databricks#7537 and adds `aitools 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 to `system.ai` or to the one schema the full names share.
A leaf next to full names outside `system.ai` is refused.
- Refusals that need no request come first: flags, unknown or non-MCP
agents, the binary name, a profile that is missing, has no host, or is
account-level (refused before any credential is sent), a server whose
profile changed, and a name held by another server or by an entry this
CLI did not write, unless `--force`.
- A named agent that is not installed is refused. `InstalledForMCP`
counts 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.
- `--name` and stored names over 32 characters (`mcp.MaxServerNameLen`)
are refused, as are invalid names.
- A name conflict refuses the run for a named agent, and fails only that
agent for a detected one. An agent that already holds the server's
binding under another name refuses the run either way, since a second
entry would run the same server twice; the error says which entry to
remove or rename.
- Entries run `databricks aitools mcp serve`, with
`DATABRICKS_CONFIG_FILE` pinned when it is set. The binary path comes
from argv at run time, made absolute when possible. When PATH finds it
only in the working directory (`exec.ErrDot`, which Windows returns),
the running executable's absolute path is used. Otherwise the output
notes that agents must find `databricks` on PATH.
- A sole profile whose host names its workspace in `?w=` is
auto-detected. On Windows, a drive-relative path is refused unless it is
on the working directory's drive.
- The read-only refusal suggests `--agents` only 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 `serve` lands, so no release ships an
entry that cannot start.

## Decisions to review
- A conflict in a detected agent skips that agent for one server, and
the run continues. Cost: no top-level error for it. `add` still fails
when a requested service reaches no agent.
- A missing or host-less profile is refused by the check `serve` runs,
so both commands print the same text. Without an install record it names
the service and how to set it up, with no `remove` hint.
- `UNKNOWN_AGENT` covers a known agent that is not installed. No
telemetry category fits.
- A stored name held by another state entry has no `--force` override.
- An agent whose binary is on PATH counts as installed, so `add` creates
its config directory on the first write.
- A server whose profile changed is refused, never rebound.

## How to review
Refactors, no behavior change: `Bind` is split into `CheckBinding`,
`BoundConfig` and `AuthenticateBound` (`libs/aitools/mcp/binding.go`).
The exported helpers are `ResolveConfigFile` and `AbsoluteAsWritten`
(`configfile.go`), `ErrProfileMissing` (`state.go`), `SystemAILocation`
(`known.go`), and `mcpconfig.EnvKeys` (`mcpconfig/spec.go`).

New behavior, to read closely: `FindEntry` (`binding.go`), now exported,
matches services ignoring case, as Unity Catalog names do, and `Bind`
inherits that; `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 in
`AbsoluteAsWritten`.

## Tests
- Unit, `cmd/aitools`: name planning and conflicts, refusals before any
request, recording when one server fails, distinct agent failures, and
which agents count as installed.
- Unit, `libs/aitools`: the MCP-home presence rule, the profile check
with no entry, and `EntryEnv`.
- Acceptance `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 -race` on `cmd/aitools` and `libs/aitools`, the aitools
acceptance tests, `GOOS=windows go vet`, golangci-lint and `./task
checks` pass.
- Not tested: `serve` (a later PR), the picker, and real agent
processes.

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aitools AI tools (databricks aitools) related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants