graphify-ts: Local MCP server cuts Claude Code PR review tokens from 63K to 8.7K

If you've used Claude Code on a real codebase, you've seen the problem: every question triggers 8-10 sequential tool calls (glob, grep, read, read, read) to build context from scratch. Input tokens pile up, latency drags, and the agent rediscovers the same structure each time. graphify-ts is a free, open-source MCP server that pre-indexes your code into a local knowledge graph, so Claude makes a single retrieve call instead.
How it works
At index time, graphify-ts parses your code with tree-sitter AST, extracts structural relationships (files, functions, classes, calls, imports), runs Louvain community detection to group related modules, indexes with BM25, and optionally re-ranks with a local ONNX model. The resulting graph is served via MCP stdio — fully local, no data leaves your laptop. The default core profile exposes 6 tools to keep session overhead low (about 5K tokens); you can opt into the full 21-tool surface with GRAPHIFY_TOOL_PROFILE=full.
Benchmarks you can verify
The repo includes a verify.sh script that re-derives all numbers from committed evidence. Results measured on a real production NestJS + Next.js codebase (1,268 files) with Claude Opus 4.7:
- Single code query: 9 tool calls → 3, 615,190 input tokens → 233,508 (2.6× fewer), latency 96 sec → 35 sec (2.8× faster). Both from Claude's
--output-format jsonusage field. - 36-file PR review: Prompt tokens dropped from 63,024 to 8,690 (7.25× smaller). Same reviewer, same diff, same review depth — both runs flagged the same hotspots.
- Multi-repo question across 3 repos: Estimated naive prompt ~1.5M tokens (wouldn't fit any window) vs. 2,800 tokens with graphify-ts. The author notes this is a structural estimate, not a sent prompt.
Install & use
npm install -g @mohammednagy/graphify-ts
cd your-project
graphify-ts generate .
graphify-ts claude installAlso works with Cursor, Copilot, Gemini CLI, Aider, OpenCode via <agent> install.
Trade-offs to know
- Cold-start cost: First session costs about 13% more than no-graph baseline due to tool-schema overhead (~5K tokens). Multi-question sessions amortize this.
- Language support: Deep extraction is best on JS/TS with framework-aware passes (Express, NestJS, Next.js, Redux Toolkit, React Router). Python/Ruby/Go/Java/Rust use plain tree-sitter AST. C/Kotlin/C#/Scala/PHP/Swift/Zig use a generic structural extractor.
- Limits: This is a structural map for an agent, not a full program-analysis database. Heavily meta-programmed routes fall back to the base AST.
The author is actively seeking counterexamples — repos where structural slicing breaks. MIT licensed, requires Node 20+.
📖 Read the full source: r/ClaudeAI
👀 See Also

Synapse: Real-Time Dashboard for Visualizing Claude Code Agent Sessions
Synapse is a real-time dashboard that visualizes Claude Code agent sessions as interactive node graphs, showing agent spawns, tool calls, and subagents. It requires Node.js and Claude, installs via npm, and offers multiple analysis views and remote approval features.

Free OpenClaw Cost Calculator Shows Configuration Expenses Before Execution
A developer built a free, open-source browser tool that calculates OpenClaw configuration costs before running, breaking down expenses by primary model, fallback chains, heartbeat burn, and billing mode.

boxBot: An Open-Source Smart Speaker Powered by Claude and Hailo AI
A developer built a smart speaker named boxBot using Claude for agent-driven hardware control, Raspberry Pi, Hailo AI accelerator, and custom SDK—open-sourced on GitHub.

Claude Usage Monitor: Floating CRT Widget for Windows
A developer built a Windows widget that displays Claude API usage in real-time with session and weekly bars, featuring seven color themes and automatic pausing when screens are locked or in fullscreen mode.