Refactor: extract shared MCP setup helpers (no behavior change)#235
Draft
xsh310 wants to merge 1 commit into
Draft
Refactor: extract shared MCP setup helpers (no behavior change)#235xsh310 wants to merge 1 commit into
xsh310 wants to merge 1 commit into
Conversation
Prep for the upcoming `ucode configure skills` rework. Pure, behavior-preserving refactor of src/ucode/mcp.py: - Extract `_setup_mcp_clients(state, section)` from `configure_mcp_command` (workspace validation, cross-workspace purge, installed/configured client resolution, auth, and section/notes/warnings), returning (workspace, profile, clients). - Extract `_split_catalog_schema(location, flag)` from `_resolve_location_mcp_servers`; the error message now names the flag. - Add an `always_load` keyword to `build_mcp_http_entry`; default off, no caller uses it yet. Existing tests stay green; adds unit tests for `_split_catalog_schema` and `build_mcp_http_entry(always_load=)`. Co-authored-by: Isaac
This was referenced Jul 23, 2026
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.
Pure, behavior-preserving refactor of
src/ucode/mcp.py, prepping for the upcomingucode configure skillsrework. No behavior change: same errors, same ordering, same prints. Existing tests pass unchanged.Extractions
_setup_mcp_clients(state, section) -> (workspace, profile, clients)— pulled out ofconfigure_mcp_command: workspace validation,purge_cross_workspace_mcp_residue, installed/configured client resolution (with the two "no clients" errors),apply_pat_environment+ensure_databricks_auth, andprint_section(section)+ "Configuring for" note + per-missing-client warnings.configure_mcp_commandnow calls it with"MCP Servers"._split_catalog_schema(location, flag) -> (catalog, schema)— the "exactly one dot, both parts non-empty" validation lifted out of_resolve_location_mcp_servers, which now calls it with"--location". The error message names the passedflag.build_mcp_http_entry(url, *, always_load=False)— newalways_loadkeyword setsentry["alwaysLoad"] = Truewhen true. Default off; all existing callers unchanged; no caller uses it yet.Tests
_split_catalog_schemaaccept/reject cases (message names the flag) andbuild_mcp_http_entrywith/withoutalways_load.This pull request and its description were written by Isaac.