Code-Graph-MCP: Open Source MCP Server Reduces Claude Code Token Usage by 40-60%

code-graph-mcp is an open source MCP server that indexes codebases into an AST knowledge graph to reduce Claude Code token usage. Instead of Claude making multiple grep/read/glob calls to understand code structure, it queries the graph for structured answers in single calls.
How It Works
The tool parses code with Tree-sitter, extracts symbols (functions, classes, types, interfaces) and their relationships (calls, imports, inheritance, exports, HTTP route bindings), then stores everything in SQLite with FTS5 full-text search and sqlite-vec for vector similarity. It supports 10 languages: TypeScript, JavaScript, Go, Python, Rust, Java, C, C++, HTML, and CSS.
Key Tools
project_map— Full architecture overview in one call (modules, dependencies, hot functions, entry points)semantic_code_search— Hybrid search combining BM25 + vector similarity with RRF fusionget_call_graph— Trace callers/callees with recursive CTEsimpact_analysis— See everything that depends on a function before changing ittrace_http_chain— Trace HTTP routes from handler to DB call (supports Express, Flask/FastAPI, Go)module_overview,dependency_graph,find_similar_code,get_ast_node— Additional toolkit functions
Efficiency Results
On a 33-file Rust project:
- Understanding project architecture: Reduced from 5-8 tool calls to 1 call
- Tracing a 2-level call chain: Reduced from 8-15 calls to 1 call
- Pre-change impact analysis: Reduced from 10-20+ calls to 1 call
- Finding function by concept: Reduced from 3-5 calls to 1 call
Overall: ~80% fewer tool calls per navigation task, ~95% less source code dumped into context, and 40-60% total session token savings.
Technical Details
Incremental indexing uses BLAKE3 Merkle tree to track content hashes — only changed files get re-parsed. Unchanged directory subtrees skip entirely via mtime cache. When a function signature changes, dirty propagation regenerates context for all downstream callers automatically.
The tool has zero external dependencies — it's a single 19MB binary with embedded SQLite and bundled sqlite-vec. No Docker, cloud API, or database server required. Optional local embeddings use a Candle-based embedding model, feature-gated so you can build without it if vector search isn't needed.
Installation
Works with Claude Code, Cursor, Windsurf, or any MCP client.
Claude Code plugin (recommended):
/plugin marketplace add sdsrss/code-graph-mcp
/plugin install code-graph-mcp
This includes the MCP server plus slash commands (/understand, /trace, /impact), auto-indexing hooks (re-indexes on every file edit), StatusLine health display, and automatic updates.
For any MCP client:
npx -y @sdsrs/code-graph
Or add to your MCP config:
{
"mcpServers": {
"code-graph": {
"command": "npx",
"args": ["-y", "@sdsrs/code-graph"]
}
}
}
When Not to Use It
grep is still better for exact string/constant search. If you need to find every occurrence of TODO or a specific error code, use grep. code-graph-mcp shines when you need to understand structure, relationships, and code architecture.
📖 Read the full source: r/ClaudeAI
👀 See Also

General Bots: Open-source AI agent platform for self-hosted enterprise automation
General Bots is an open-source platform started in 2019 that provides AI agents, workflow automation, document processing, and integrations with local AI model support, designed for organizations needing full control over their infrastructure.

mcp-optimizer reduces token waste from idle MCP servers in Claude Code
mcp-optimizer is a plugin that addresses token waste from MCP servers in Claude Code by analyzing tool usage and generating optimized configurations. It includes four utilities: mcp-doctor for server health checks, mcp-audit for usage analysis, mcp-optimize for creating project-local configs, and mcp-to-skills for converting tools to on-demand Skills.

MCP Context Bloat: Real Costs and a Practical Fix for Claude Code Users
Running 9 MCP servers in Claude Code leads to 38k token cold starts, ~$700/month in tool definition overhead, and degraded model performance. A gateway pattern with BM25 ranking cuts context to 4k.
Spine Swarm: Multi-Agent AI System on Visual Canvas for Non-Coding Projects
Spine Swarm is a multi-agent system that works on an infinite visual canvas to complete complex non-coding projects like competitive analysis, financial modeling, SEO audits, pitch decks, and interactive prototypes. The system uses blocks as abstractions on top of AI models that can be connected to pass context between different model types.