Problem
Currently, CodeGraph has no way to discover which projects are already initialized/indexed. Each project stores its .codegraph/ directory independently, and all MCP tools require the caller to already know the exact project path via the projectPath parameter.
For AI agents working across multiple repositories, this means every cross-repo query requires the agent to be told every project path — it cannot discover what is available.
Current capability
All MCP tools (codegraph_explore, codegraph_search, codegraph_callers, codegraph_files, codegraph_status etc.) accept an optional projectPath string parameter to query a different project. But there is no tool to enumerate which projects exist.
Proposed solution
Add a new MCP tool (e.g. codegraph_projects) that returns a list of all initialized CodeGraph projects, with basic metadata per project:
- Project path — the root directory
- Index timestamp — when it was last indexed
- Stats — file/node/edge counts
- Status — whether the index is up-to-date with the working tree
Design considerations
-
Discovery mechanism — how to find projects? Options:
a. A registry file (e.g. ~/.config/codegraph/projects.json) that codegraph init writes to and codegraph uninit removes from
b. Scan well-known directories
c. Both: registry as primary, with a CODEGRAPH_PROJECTS_PATH env var for additional roots
-
Minimum viable — start with the registry approach: codegraph init registers the project, and the new tool reads the registry
-
MCP-only or also CLI? — the tool should work both as codegraph_projects via MCP and codegraph projects via CLI
/cc @woan-lufei
Problem
Currently, CodeGraph has no way to discover which projects are already initialized/indexed. Each project stores its
.codegraph/directory independently, and all MCP tools require the caller to already know the exact project path via theprojectPathparameter.For AI agents working across multiple repositories, this means every cross-repo query requires the agent to be told every project path — it cannot discover what is available.
Current capability
All MCP tools (
codegraph_explore,codegraph_search,codegraph_callers,codegraph_files,codegraph_statusetc.) accept an optionalprojectPathstring parameter to query a different project. But there is no tool to enumerate which projects exist.Proposed solution
Add a new MCP tool (e.g.
codegraph_projects) that returns a list of all initialized CodeGraph projects, with basic metadata per project:Design considerations
Discovery mechanism — how to find projects? Options:
a. A registry file (e.g.
~/.config/codegraph/projects.json) thatcodegraph initwrites to andcodegraph uninitremoves fromb. Scan well-known directories
c. Both: registry as primary, with a
CODEGRAPH_PROJECTS_PATHenv var for additional rootsMinimum viable — start with the registry approach:
codegraph initregisters the project, and the new tool reads the registryMCP-only or also CLI? — the tool should work both as
codegraph_projectsvia MCP andcodegraph projectsvia CLI/cc @woan-lufei