Repository navigation
Add MCP state records, drift check and profile binding checks - #7537
Draft
simonfaltum wants to merge 7 commits into
Draft
simonfaltum wants to merge 7 commits into
simonfaltum wants to merge 7 commits into
Conversation
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
2 times, most recently
from
November 12, 2026 11:57
e003f2d to
99f703a
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 12, 2026 12:11
99f703a to
39c0dec
Compare
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 12, 2026 14:24
773f68b to
93a7090
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 12, 2026 14:25
39c0dec to
acc3ee6
Compare
Collaborator
✅ Integration test reportCommit: 03c01a0
Top 6 slowest tests (at least 2 minutes):
|
Adds the state file that records MCP servers the CLI wrote, a drift check against the Databricks profiles file, and the binding checks a stdio proxy runs before it reads stdin. These are the building blocks for `aitools mcp`. Co-authored-by: Isaac <no-reply@databricks.com>
Keep MCP records in the shared aitools state file as an optional mcp section (schema v3). Uninstall keeps the file while MCP records remain. Binding checks now compare the host and the workspace ID with the profile before any credential is resolved, read the config file named in the context, and never fill credentials from the environment. Drift reconciliation checks each entry against its pinned config file, and entries match on service, profile and config file. Host comparison is case-insensitive. Error and notice messages no longer end with a period, and paths are slash-separated. Co-authored-by: Isaac <no-reply@databricks.com>
- Compare the workspace a profile names in its host query (?o=, ?w=, ?workspace_id=) as well as in workspace_id. "none" names no workspace. - Compare config files by resolved absolute path. An entry with no pinned file is the default ~/.databrickscfg, and Reconcile checks it there. - Treat a state file that holds only MCP records as having no skills or plugins in version, update, uninstall, scope detection and the legacy install guard. - Installer saves keep the MCP section on disk. SaveMCPState replaces it. Uninstall re-reads the MCP section before it deletes the state file. - Move the DATABRICKS_CONFIG_FILE name into mcpconfig.ConfigFileEnv, shared with the agent entry writer. - Read the home directory only when a config file path needs it. Co-authored-by: Isaac <no-reply@databricks.com>
- Derive the profile's host and workspace with the SDK's own resolution, without network: workspace_id first, then the ?w= query, then a numeric ?o= or ?workspace_id=. "none" names no workspace. - Resolve the config file once. Symlinks are resolved before the path is made absolute, so ".." after a symlink matches the file the OS reads. Paths compare case-insensitively on Windows and macOS. The profile lookup, the entry match and the SDK all use that path. - An entry whose "~" path cannot be resolved is skipped while another entry matches. It fails the bind only when nothing else matches. Reconcile reports the error for that entry and still checks the others. - Share the per-entry drift check between Bind and Reconcile, and the profile lookup too. A section with no host is reported as having no host, not as missing. - SDK configuration errors are UNCATEGORIZED with no login hint. Only failures from Authenticate are AUTH_FAILED. - Export databrickscfg.ResolveConfigFilePath and reuse it. - SaveState removes the state file when no skills, plugins, files, repo directories or MCP servers remain. Uninstall uses this instead of its own re-read of the MCP section. - aitools list treats a state file with only MCP records as no install. - Fix the spacing in the profile-gone message. Document ConfigFileEnv and the helpers that lacked comments. Co-authored-by: Isaac <no-reply@databricks.com>
- Bind fails closed when an entry for the service and profile is pinned to another config file, instead of binding through the file in use. - A profile with an empty host is reported as having no host. - The recorded workspace is read from the recorded host's query, as the SDK resolves the profile's. - Each config file is read once per check; Reconcile no longer takes a Profiler. - A path through a missing directory is kept as written, and existing files are compared by identity. - The recreate, remove and login hints quote their values, and pinned entries name their config file. - A state file that holds only MCP records loads as no install, so installer and cmd behavior for users without MCP records is main's again. SaveState no longer removes the file; SaveMCPState and uninstall do. Co-authored-by: Isaac <no-reply@databricks.com>
The two config-file mismatch tests built the expected message from the native resolved path, while the message prints it with forward slashes, so they failed on Windows. Co-authored-by: Isaac <no-reply@databricks.com>
Main renamed UninstallSkillsOpts to UninstallSkillsWithResult, which returns the result as well, and replaced the schema v2 constant with the current schema version. Return the new signature, use the current schema version in the test fixtures, and restore the state path that readState needs. Co-authored-by: Isaac <no-reply@databricks.com>
simonfaltum
force-pushed
the
aitools-mcp/02-discovery
branch
from
November 13, 2026 15:05
93a7090 to
a4521da
Compare
simonfaltum
force-pushed
the
aitools-mcp/03-state
branch
from
November 13, 2026 15:05
1dade3d to
03c01a0
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request is part of a stack, on top of #7538, that adds the hidden
databricks aitools mcpcommand group. It adds MCP state records, drift checks and profile binding checks. Nothing calls them yet.Changes
mcpsection of the aitools state file (schema v3). A file with only MCP records counts as no install. Installer saves keep the section. Uninstall andSaveMCPStateremove the file once nothing remains.Reconcilereportsprofile_missingandhost_changed, using the host and workspace the SDK resolves, with no network.Bindchecks the profile before it resolves credentials, so a re-pointed host is never contacted.UNCATEGORIZED. Only failed authentication isAUTH_FAILED.BindError.ExitCode()returns 2, which theservePR 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
mcpsection on its next save, and itsuninstalldeletes a file that holds only MCP records.PROFILE_HOST_CHANGED, rather than printing the no-record notice, because binding through this file would switch the server silently. ChangingDATABRICKS_CONFIG_FILEmeans removing and adding the server again.~/.databrickscfg, notDATABRICKS_CONFIG_FILE.DATABRICKS_TOKENor other auth variables into the profile. A profile without a token uses the SDK chain for its host.profile.WithHost. A profile that drops its workspace selector is not detected, since the recorded ID may come from the API.Tests
TestBindHostChangedDoesNotContactNewHostfails if a re-pointed host gets a request.TestBindWorkspaceFollowsSDKResolutioncovers the host query.TestBindEntryInOtherConfigFileFailsClosedandTestBindNeverUsesEnvTokenForProfileWithoutTokencover the config-file and credential rules.TestUninstallRemovesLeftoverFilesWithoutSkills,TestUpdateAfterPruningEverySkillAddsNewSkillsandTestInstallSpecificSkillWithEmptyStateFilepass on main's behavior, which users without MCP records keep.TestLoadStateHidesOnlyMCPOnlyFilesandTestUninstallKeepsStateFileWithMCPRecordscover the shared file.experimental/aitoolsandcmd/aitoolsacceptance tests (goldens unchanged),GOOS=windows go vet,golangci-lintandtask checks.This pull request and its description were written by Isaac.