codegraph-ast-mcp
by DjohnHK
README.md
# codegraph-ast-mcp
[](https://www.python.org/)
[](LICENSE)
[](https://modelcontextprotocol.io)
[](https://github.com/astral-sh/ruff)
**Polyglot Native C Tree-sitter Call-Graph, Cross-Stack HTTP Route Linker, Reverse BFS Blast-Radius Analyzer, and Surgical AST Context Slicing MCP Server for AI Coding Agents.**
---
## The Problem
When AI coding agents (**Claude Code**, Cursor, Windsurf, custom MCP agents) navigate large full-stack or embedded monorepos, they typically burn tens of thousands of context tokens reading entire 1,500-line files and running blind regex searches—while still missing **cross-stack dependencies** (for example, a backend Python function whose response contract is consumed via `axios.post("/api/invoices/checkout")` inside a Vue/TypeScript component).
`codegraph-ast-mcp` solves both problems with deterministic **native C Tree-sitter parsing** backed by an incremental **SQLite WAL** graph (`(mtime_ns, size_bytes)` delta indexing in milliseconds):
1. **75%–92% Context Token Compression (`surgical_ast_slice`):** Extracts only the exact AST symbol lines (`start_line..end_line`) instead of loading whole files.
2. **Cross-Stack Frontend ↔ Backend Route Graph:** Links `fetch()` / `axios` / `$http` calls in `.vue`, `.ts`, `.tsx`, and `.js` directly to Django `urls.py` and FastAPI `@router.get/post` route handlers.
3. **Multi-Hop Reverse BFS Blast Radius (`codegraph_blast_radius`):** Computes upstream impact across functions, classes, HTTP endpoints, and UI views before an agent refactors a symbol.
---
## Quickstart with Claude Code
```bash
pip install "git+https://github.com/DjohnHK/codegraph-ast-mcp.git"
# Register with Claude Code CLI:
claude mcp add codegraph -- codegraph-ast-mcp
```
Or use directly from the command line:
```bash
codegraph-cli sync --root .
codegraph-cli callers compute_invoice_tax --root .
codegraph-cli blast compute_invoice_tax --root . --depth 3
codegraph-cli slice compute_invoice_tax --root .
```
---
## Exposed MCP Tools
| Tool | Description |
| :--- | :--- |
| `codegraph_sync` | Incrementally indexes Python, TypeScript, JavaScript, Vue SFCs, Go, PHP, C, and C++ files into SQLite WAL |
| `codegraph_callers` | Finds symbol definitions and all upstream callers, importers, subclasses, and HTTP consumers |
| `codegraph_callees` | Resolves all downstream symbols and endpoints invoked inside a function, class, or component |
| `codegraph_blast_radius` | Computes N-hop reverse BFS blast radius across backend logic, HTTP routes, and frontend views |
| `surgical_ast_slice` | Extracts exact AST line ranges with token-savings telemetry |
---
## License
Released under the [MIT License](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues