feat: multi-repo MCP with global registry (Phase 2.5)#16
Merged
carlos-alm merged 1 commit intomainfrom Feb 22, 2026
Merged
Conversation
Add a global registry at ~/.codegraph/registry.json so AI agents can query multiple codebases from a single MCP session. Projects are auto-registered on build; an optional `repo` param on every MCP tool lets agents switch context. - New src/registry.js with CRUD operations (load/save/register/ unregister/list/resolve) and atomic writes - Add optional `repo` param to all 11 existing MCP tools - Add 12th MCP tool `list_repos` to enumerate registered repos - Add `codegraph registry list|add|remove` CLI commands - Auto-register projects after `codegraph build` (non-fatal) - Export registry functions from programmatic API - 18 unit tests for registry, 4 new MCP tests, 4 CLI integration tests - Update ROADMAP.md and README.md to mark Phase 2.5 complete
Contributor
Greptile SummaryThis PR implements Phase 2.5 of the roadmap, adding multi-repo support to the MCP server via a global registry at Key Changes
Implementation QualityThe implementation follows established patterns in the codebase:
All tests reported passing in the PR description (322 total). The code is clean, well-structured, and ready for production use. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant AI as AI Agent
participant MCP as MCP Server
participant REG as Registry Module
participant FS as File System
participant DB as SQLite DBs
Note over AI,DB: Multi-Repo Query Flow
AI->>MCP: list_repos()
MCP->>REG: listRepos()
REG->>FS: Read ~/.codegraph/registry.json
FS-->>REG: Registry data
REG-->>MCP: List of repos
MCP-->>AI: Available repositories
AI->>MCP: query_function(name, repo="my-project")
MCP->>REG: resolveRepoDbPath("my-project")
REG->>FS: Check registry.json
REG->>FS: Verify DB exists
alt DB found
FS-->>REG: DB path
REG-->>MCP: Resolved path
MCP->>DB: Query my-project DB
DB-->>MCP: Results
MCP-->>AI: Function data
else DB not found
REG-->>MCP: undefined
MCP-->>AI: Error: repo not found
end
Note over AI,DB: Auto-Registration on Build
participant CLI as CLI
participant BLD as Builder
CLI->>BLD: codegraph build
BLD->>FS: Build graph.db
BLD->>REG: registerRepo(rootDir)
REG->>FS: Atomic write to registry.json
REG-->>BLD: Registration complete
BLD-->>CLI: Build complete
Last reviewed commit: 54ea9f6 |
3 tasks
This was referenced Feb 25, 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.
Summary
~/.codegraph/registry.jsonso AI agents can query multiple codebases from one MCP sessionsrc/registry.jsmodule with atomic-write CRUD operations (load/save/register/unregister/list/resolve)repoparam to all 11 existing MCP tools + newlist_repostool (12th)codegraph registry list|add|removeCLI commandscodegraph build(non-fatal on failure)src/index.js)Test plan
npx vitest run tests/unit/registry.test.js— 18 tests passnpx vitest run tests/unit/mcp.test.js— 22 tests pass (4 new)npx vitest run tests/integration/cli.test.js— 18 tests pass (4 new)npm test— full suite 322 tests passnpm run lint— clean🤖 Generated with Claude Code