Skip to content

Index project dependency paths from wrapper#821

Open
st0012 wants to merge 1 commit into
mainfrom
mcp-dependencies/pass-index-paths
Open

Index project dependency paths from wrapper#821
st0012 wants to merge 1 commit into
mainfrom
mcp-dependencies/pass-index-paths

Conversation

@st0012

@st0012 st0012 commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

Start rubydex_mcp from the Ruby wrapper with the target Bundler context, then pass workspace and dependency roots to the Rust server.

Changes

  • Load bundler/setup in the wrapper (Rubydex::MCPServerBridge), inferring BUNDLE_GEMFILE from the target path or cwd.
  • Collect Bundler require paths for the active bundle and pass all index roots as argv to the packaged MCP binary.
  • Allow the Rust MCP CLI to accept multiple positional paths. canonicalize_path now warns and falls back to the original path instead of panicking on non-UTF-8 paths.
  • Document that overlapping index roots are idempotent: the graph keys documents by UriId and overwrites on re-index, so a file discovered through two roots only costs wasted indexing work, never duplicate declarations.
  • Broaden the dependency-path collection rescue to StandardError (it touches the filesystem), and document the BUNDLE_GEMFILE side effect plus the workspace-vs-argv contract (only the first argv entry drives the Bundler context; all entries become index roots).
  • Document the launcher (MCPServerBridge) in AGENTS.md.

Verification

  • bundle exec ruby -Itest test/mcp_server_bridge_test.rb (ENV save/restore, passthrough?, dependency-path collection, empty-argv default)
  • cargo test --manifest-path rust/Cargo.toml -p rubydex-mcp (includes an overlapping-roots dedup test asserting a doubly-discovered file yields exactly one definition)
  • cargo clippy --manifest-path rust/Cargo.toml -p rubydex-mcp --all-targets -- -D warnings
  • cargo fmt --manifest-path rust/Cargo.toml --all --check
  • bundle exec rubocop exe/rubydex_mcp lib/rubydex/mcp_server_bridge.rb test/mcp_server_bridge_test.rb
  • End-to-end in this repo through bundle exec exe/rubydex_mcp: found workspace declaration Rubydex::MCPServerBridge and dependency declaration Rake::Task.
  • End-to-end in a large monolith through the wrapper: indexed over 1.5M declarations and fetched the full MCP-reported descendant set of ActiveRecord::Base through the resolved dependency paths.

st0012 commented May 26, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@st0012 st0012 force-pushed the mcp-dependencies/pass-index-paths branch 4 times, most recently from b3c1fba to e4a0c56 Compare May 26, 2026 20:49
@st0012 st0012 force-pushed the codex/package-mcp-executable branch from bc19a73 to 28572bc Compare May 26, 2026 20:49
@st0012 st0012 marked this pull request as ready for review May 28, 2026 15:39
@st0012 st0012 requested a review from a team as a code owner May 28, 2026 15:39
Base automatically changed from codex/package-mcp-executable to main May 28, 2026 16:06
@st0012 st0012 force-pushed the mcp-dependencies/pass-index-paths branch 2 times, most recently from 8a9dae2 to db06ee9 Compare May 28, 2026 16:27
@st0012 st0012 force-pushed the mcp-dependencies/pass-index-paths branch from db06ee9 to 12f74c7 Compare May 28, 2026 21:32
@st0012 st0012 changed the title Index MCP dependency paths from wrapper Index project dependency paths from wrapper May 29, 2026
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.

1 participant