Build a local API and data-asset knowledge graph for any target project, exposed to OpenCode, Cursor, and other AI tools via MCP — without repeatedly grepping or reading spec and config files in chat.
Architecture follows CodeGraph: transport → session → engine → tools, stdio JSON-RPC MCP. Design rationale and architecture: docs/CONCEPT.md.
After codegraphplus init -i in a project root, CodeGraphPlus creates .codegraphplus/ and writes these assets and their relations to a local SQLite graph:
| Asset kind | Meaning | Example |
|---|---|---|
http_api |
HTTP / RPC routes | GET /users/{id} |
http_dependency |
Outbound HTTP to other services | call payment-service /charge |
db_table |
Database tables | orders, user_profile |
redis_key |
Redis key patterns | session:{userId} |
topic |
Message topics | order.created |
dto_schema |
Request / response schemas | CreateOrderRequest |
thread_pool |
Thread pools / executors | asyncExecutor |
Relation types (filled when indexers are implemented): uses_table, uses_redis, publishes, subscribes, uses_schema, calls_http, runs_on_pool, references.
Typical use: open a Java backend project in OpenCode and query API routes, related tables, Redis keys, topics, and dependencies via MCP.
Scope: Indexers and docs target Java backend projects (Spring Boot, Maven/Gradle, Flyway, JPA, Feign, etc.). TypeScript / Node / Python / Go targets are not supported by built-in indexers yet.
Current status: Indexer plugin interfaces are ready; parsing is stub — candidate files are scanned and tracked, but assets are not written yet.
indexStatusisstub; the graph may be empty; MCP tools still work and return empty results (not errors).
- Node.js >= 22.5 (uses built-in
node:sqlite)
git clone <repo-url> CodeGraphPlus
cd CodeGraphPlus
npm install
npm run buildOutput is in dist/; CLI entry: dist/bin/codegraphplus.js.
Option A — npm global (recommended for end users)
npm install -g codegraphplus
codegraphplus install
codegraphplus --versionOption B — local development (npm link)
npm link
codegraphplus install --dev
codegraphplus --versionOption C — invoke via node
node dist/bin/codegraphplus.js --help
node dist/bin/codegraphplus.js install --devOption D — npm script
npm run cli -- --help
npm run cli -- init -i --path C:/path/to/target-projectnpm test
codegraphplus --versionRun in the business project that needs a graph (not inside the CodeGraphPlus repo):
cd /path/to/your-service
codegraphplus init -i
codegraphplus statusApplication code lives under src/:
CodeGraphPlus/
├── src/
│ ├── bin/ ★ CLI entry (codegraphplus command)
│ ├── mcp/ ★ MCP server (OpenCode / Cursor)
│ ├── indexer/ ★ Indexer plugins (API, tables, Redis, topics, …)
│ ├── enrich/ ★ Agent write-back (baseline + apply updates)
│ ├── db/ ★ SQLite layer
│ ├── index.ts ★ Core facade (init / index / search)
│ ├── directory.ts .codegraphplus/ directory helpers
│ └── types.ts Asset and relation types
├── docs/
│ ├── CONCEPT.md Design (why, vs CodeGraph, architecture)
│ ├── EXTENDING.md Extension guide (indexers, plugins)
│ └── CONSISTENCY.md Graph version / multi-agent alignment
├── __tests__/ Tests
├── dist/ Build output (npm run build)
├── package.json
└── tsconfig.json
| Path | Role | When to edit |
|---|---|---|
src/bin/ |
CLI: init, index, status, search, serve --mcp |
New commands, CLI flags |
src/mcp/ |
MCP: transport → session → engine → tools |
MCP tools, server instructions |
src/indexer/ |
Indexer orchestration + built-in plugins | Real indexing (tables, APIs, Redis, …) |
src/enrich/ |
Baseline report + applyUpdates |
Agent graph updates |
src/db/ |
schema.sql, queries.ts, SQLite adapter |
Schema and queries |
src/index.ts |
CodeGraphPlus class |
Public API |
src/directory.ts |
.codegraphplus/ creation and discovery |
Index directory rules |
src/types.ts |
AssetKind, RelationKind |
New asset/relation kinds |
Data is not in this repo: the index DB is written to .codegraphplus/codegraphplus.db in each target project.
Suggested reading order:
src/bin/codegraphplus.ts— CLI entrysrc/index.ts+src/indexer/index.ts— init / index flowsrc/mcp/tools.ts— MCP surfacesrc/indexer/plugins/— built-in stub plugins
cd /path/to/your-service
codegraphplus init -iCreates:
your-service/
.codegraphplus/
codegraphplus.db
.gitignore
| Command | Description |
|---|---|
codegraphplus init [path] |
Create .codegraphplus/ only |
codegraphplus init -i [path] |
Create + run stub index |
codegraphplus index [path] |
Re-run index |
codegraphplus plugins [path] |
List indexer slots and scripts |
codegraphplus baseline [path] |
Baseline report (Agent enrichment) |
codegraphplus traverse --kind <kind> [path] |
Paginated traversal by kind |
codegraphplus apply --file patches.json |
Apply Agent patch JSON |
codegraphplus status [path] |
Kind counts and indexStatus |
codegraphplus search <query> [path] |
CLI search |
codegraphplus install |
Register MCP in Cursor / OpenCode |
codegraphplus version [path] |
Graph version |
codegraphplus serve --mcp [--path <path>] |
Start MCP server |
Path examples:
node C:/ApiGraph/dist/bin/codegraphplus.js init -i --path C:/path/to/target-project
node C:/ApiGraph/dist/bin/codegraphplus.js status --path C:/path/to/target-projectAfter installing the CLI globally:
codegraphplus installThis registers the MCP server in:
| Target | Global config (default) |
|---|---|
| Cursor | ~/.cursor/mcp.json |
| OpenCode | ~/.config/opencode/opencode.jsonc |
Options:
codegraphplus install --target cursor # Cursor only
codegraphplus install --target opencode # OpenCode only
codegraphplus install --location local # project .cursor/mcp.json
codegraphplus install --dev # use node + script path (npm link / dev)
codegraphplus install --print # show config without writing
codegraphplus install --uninstall # remove entriesRestart Cursor / OpenCode after install.
codegraphplus serve --mcp --path /path/to/target-projectExample for .cursor/mcp.json (when not using install):
{
"mcpServers": {
"codegraphplus": {
"command": "codegraphplus",
"args": ["serve", "--mcp", "--path", "${workspaceFolder}"]
}
}
}Why --path? Cursor often starts MCP with a cwd that is not the workspace root and may not pass rootUri on initialize. Like CodeGraph, ${workspaceFolder} points at the project that contains .codegraphplus/.
For projects on another machine, pass projectPath on tool calls.
| Project state | initialize |
tools/list |
Tool calls |
|---|---|---|---|
| Not initialized | inactive instructions | empty list | unavailable |
| Initialized, stub index | full playbook | 11 tools | OK; empty graph returns empty (not error) |
| Initialized, enriched / real index | same | 11 tools | graph data |
| Tool | Purpose | CodeGraph analogue |
|---|---|---|
codegraphplus_explore |
Primary — explore an API/data area | codegraph_explore |
codegraphplus_search |
Cross-kind search | codegraph_search |
codegraphplus_node |
Single asset details | codegraph_node |
codegraphplus_dependencies |
What an asset uses | codegraph_callees |
codegraphplus_consumers |
Who uses an asset | codegraph_callers |
codegraphplus_impact |
Change impact | codegraph_impact |
codegraphplus_files |
Tracked spec/config files | codegraph_files |
codegraphplus_status |
Index health, kind stats | codegraph_status |
codegraphplus_baseline |
Indexer baseline overview | — |
codegraphplus_traverse |
Paginated traversal by kind | — |
codegraphplus_apply_updates |
Agent write-back | — |
All tools accept optional projectPath for cross-project queries.
CodeGraphPlus does not run an LLM; the Agent reads code and writes back via MCP:
codegraphplus_traverse—kind(e.g.db_table,http_api), paginate withnextOffset- Read/Grep each
sourceFile codegraphplus_apply_updates(trydryRun: truefirst)- Verify with
codegraphplus_search/codegraphplus_explore
CLI: codegraphplus traverse --kind db_table, codegraphplus apply --file patches.json [--dry-run]
See Extension guide — Agent enrichment.
Recommended: map each slot in .codegraphplus/indexers.config.json (e.g. db-table → plugins/db-table.ts); use null for the built-in stub. CLI: codegraphplus plugins.
Built-in plugins in src/indexer/plugins/ are currently stubs:
| Plugin | Scans (Java) |
|---|---|
openapi |
OpenAPI / Swagger (yaml, json) |
db-table |
Flyway / Liquibase SQL, JPA @Entity, MyBatis XML |
redis |
application.yml, Redis config |
topic |
Spring Kafka / RabbitMQ |
thread-pool |
@EnableAsync, ThreadPoolTaskExecutor |
http-dependency |
OpenFeign, RestTemplate, WebClient |
Details: Extension guide.
npm run dev # tsc --watch
npm test
npm run cli -- status /path/to/project
npm run clean # remove dist/| CodeGraph | CodeGraphPlus | |
|---|---|---|
| Index target | Code symbols, call graph | APIs, tables, Redis, topics, … |
| Index dir | .codegraph/ |
.codegraphplus/ |
| Parsing | tree-sitter AST | Java multi-plugin (OpenAPI, Flyway, JPA, Feign, …) |
| Project languages | Multi-language | Java backend (current) |
| Daemon / file watch | Yes | No (direct stdio MCP) |
| MCP install helper | codegraph install |
codegraphplus install |
Maintainers (requires npm login):
npm run build
npm test
npm publish --access publicprepublishOnly runs build + tests automatically. The published package includes dist/, README.md, and LICENSE only.
MIT