Skip to content

Add universal cross-root MCP support#90

Open
VooDisss wants to merge 4 commits intouserFRM:mainfrom
VooDisss:fix/cross-root-state-cleanup
Open

Add universal cross-root MCP support#90
VooDisss wants to merge 4 commits intouserFRM:mainfrom
VooDisss:fix/cross-root-state-cleanup

Conversation

@VooDisss
Copy link
Copy Markdown
Contributor

Closes #89

PR intent: cross-root MCP support

Intent

This change intentionally makes project_root a first-class contract across the Stage 1 MCP tool surface.

Intentional outcomes

  • tools can target another repository through per-call project_root without changing the active root
  • set_project_root remains the explicit default-root switch for subsequent calls
  • blank project_root values are normalized as “no override” at the root-resolution boundary
  • default-root compatibility state is synchronized from authoritative root-scoped state instead of open-coded mirroring across handlers
  • set_project_root uses reset semantics for transient runtime state while preserving persisted .rpg artifacts
  • request-shape hardening intentionally tolerates real MCP client behavior such as blank optional strings and empty batch arrays
  • large-root hierarchy workflows are intentionally supported by removing the sharded hierarchy deadlock
  • cross-root semantic search intentionally uses a shared embedding model cache for stable behavior across repositories

@VooDisss VooDisss force-pushed the fix/cross-root-state-cleanup branch from 22f445f to ec814c8 Compare April 21, 2026 03:21
Introduce root-scoped runtime state and extend the project_root contract across the 
pg-mcp tool surface so calls can target an effective root without mutating the active session root. set_project_root remains the explicit mechanism for switching the default root for later calls.

This Stage 1 functionality commit folds the validated Rust changes into one cross-root checkpoint. It includes the root-aware server and tool plumbing, blank-parameter and empty-batch hardening needed for real MCP clients, reset semantics for transient runtime state on project-root switches, centralized compatibility-state syncing for the default root, the large-repository sharded hierarchy deadlock fix, and the shared embedding model cache needed for stable cross-root semantic search behavior.

Live validation confirmed the resulting surface on healthy external roots, including search, fetch, explore, build, reload, update, lifting submission, routing submission, file synthesis submission, hierarchy submission, and large-root hierarchy workflows. Documentation remains separate from this Stage 1 functionality commit.
@VooDisss VooDisss force-pushed the fix/cross-root-state-cleanup branch from ec814c8 to 099eefe Compare April 21, 2026 03:35
Document the expanded per-call project_root behavior in the README and harden path expansion in the MCP server so '~' resolution works across Windows and Unix-style environments.

This keeps the follow-up focused only on files touched after the original cross-root feature commit. The README clarifies the additional tool surface and override behavior, while server.rs now resolves the home directory from USERPROFILE/HOMEDRIVE+HOMEPATH before falling back to HOME so project_root overrides behave correctly on Windows hosts.
Keep the cross-root PR surface separate from baseline maintenance needed to satisfy today's CI environment. This commit updates the lockfile for the current RustSec advisories and applies the minimal lint-driven cleanup now required by stable Clippy across the workspace.

The source changes are intentionally mechanical: remove unnecessary trailing commas, prefer sort_by_key where Clippy requires it, simplify one Rust parser match arm, iterate map values directly, and use clearer Duration units. Together with the rustls-webpki lockfile bump to 0.103.12, this restores green results for fmt, clippy, test, and audit without mixing feature behavior changes into the maintenance commit.
@VooDisss VooDisss force-pushed the fix/cross-root-state-cleanup branch from 39445be to b645856 Compare April 21, 2026 15:01
Sanitize whitespace-only MCP since values before dispatching update_rpg. The handler previously forwarded Some("") into the committed-diff path, which caused git OID parsing to fail with 'invalid base_commit SHA' instead of falling back to the default workdir update behavior.

Treating blank input as unset preserves the intended API contract for optional since values and fixes cross-root callers that serialize an empty string rather than omitting the field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-root MCP support

1 participant