Add universal cross-root MCP support#90
Open
VooDisss wants to merge 7 commits intouserFRM:mainfrom
Open
Conversation
22f445f to
ec814c8
Compare
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.
ec814c8 to
099eefe
Compare
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.
39445be to
b645856
Compare
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.
Large repositories enter the sharded build_semantic_hierarchy flow, where the server needs both a graph snapshot and a hierarchy session update. The previous implementation held a read lock on the root-scoped runtime state and then tried to acquire a write lock on that same RwLock, which can block forever and surface as a timeout or aborted MCP call. Take the graph-derived cluster snapshot in a short read section, release that guard, then mutate hierarchy_session under the write lock and reacquire a read guard only for rendering the batch output. This preserves the existing sharded workflow and prompt behavior while removing the self-deadlock in the large-repository hierarchy path.
Contributor
Author
|
Don't merge yet - found 2 bugs |
OpenCode can launch the release rpg-mcp-server binary with logging flags before any positional project path. The server previously read argv[1] directly, so a flag like --log was misinterpreted as the project root and the default session started against the wrong directory until set_project_root was called manually. Parse startup arguments so only a real positional path overrides the default root, while known logging flags are skipped. When no positional project path is present, the server now falls back to the directory it was started from. Keep the npm wrapper aligned by explicitly launching the binary from the current process directory, and document that startup-directory behavior in the README files. Add regression tests for both startup-root fallback and flags-only launch configurations.
Resolve the new rustls-webpki advisory with a lockfile refresh and remove the unmaintained core2 chain that was coming in through fastembed's default image-model stack. The repo only uses text embeddings, so keeping the image-related defaults pulled in unnecessary transitive dependencies and caused cargo audit to fail. Pin fastembed to the current 5.13.x line, disable its default features, and enable only the text-embedding features this workspace actually uses. Switch ONNX runtime loading to the dynamic mode so verification does not depend on downloading prebuilt binaries during local builds. The lockfile refresh updates hf-hub, ort, and rustls-webpki accordingly while preserving the existing embedding API usage.
Contributor
Author
|
Noticed issues fixed. Can merge. I'm using it currently |
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.
Closes #89
PR intent: cross-root MCP support
Intent
This change intentionally makes
project_roota first-class contract across the Stage 1 MCP tool surface.Intentional outcomes
project_rootwithout changing the active rootset_project_rootremains the explicit default-root switch for subsequent callsproject_rootvalues are normalized as “no override” at the root-resolution boundaryset_project_rootuses reset semantics for transient runtime state while preserving persisted.rpgartifacts