Repository navigation
Add per-project MCP server for domain-context retrieval - #4
Merged
Merged
Conversation
Expose the retrieval engine as a stdio MCP server (FastMCP) that the plugin starts for every opened project, so the agent can ground new work in the repo's existing implementations before writing code. - engine/retrieval/mcp_server.py: search_domain_context, index_project, index_status tools, a ground_implementation prompt, server instructions and a retrieval://index/status resource. Reuses the CLI query/index paths; stdout is reserved for the protocol. - Lazy builds: lexical is built on first query; heavier strategies are used only once index_project builds them. lexical+ctx is never built or overwritten implicitly (cost opt-in stays on the CLI). - Search never raises: skipped strategies come back with actionable reasons, top_k is clamped and snippets are byte-capped. - In-process retriever cache, one fingerprint walk per request, and a separate build lock so status/search stay responsive during builds. - `retrieval mcp` subcommand, `retrieval-mcp` script, optional `mcp` extra; registered via plugin.json mcpServers + scripts/retrieval-mcp.sh. - New domain-context-retrieval skill; docs updated, shell snippets made zsh-safe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019qtBjPUTJs57FUt6JJRk6K
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019qtBjPUTJs57FUt6JJRk6K
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.
Summary
Adds a per-project MCP server so the agent can look up the repo's own existing code and patterns before it implements anything.
engine/retrieval/mcp_server.py), stdio via FastMCP:search_domain_context,index_project,index_statusground_implementation(task)promptretrieval://index/statusresourceindex_projectbuilds them.lexical+ctxindex is never built or overwritten implicitly. Building it still requires an explicit CLI run.top_kis clamped to 25, and snippets are size-capped with atruncatedflag.index_statusand searches don't wait on a long build. While a build runs, pi-serini is skipped with a retry hint.retrieval mcpsubcommand andretrieval-mcpscript.mcpextra.plugin.jsonmcpServersandscripts/retrieval-mcp.sh. There is no root.mcp.json, so opening this repo doesn't create a broken project-scope server.domain-context-retrievalskill so agents check these tools on their own while working in a repo. It falls back to the CLI when the server is unavailable.set -- … "$@", so they work in zsh as well as bash.Notes
engine/uv.lockdiff is large mainly because a newer uv rewrote the lock format (revision 3 → 5). No dependency versions were bumped.Test plan
uv run --directory engine python -m unittest discover -s tests: 582 tests, OK (18 skipped)ruff checkandisort --checkare clean on the changed Python filesuv buildproduces the sdist and wheelinitializehandshake throughscripts/retrieval-mcp.shsucceedsplugin:agentic-retrieval:retrievalshows as connected in/mcp🤖 Generated with Claude Code
https://claude.ai/code/session_019qtBjPUTJs57FUt6JJRk6K