NewsDeveloper Tools

codebase-memory-mcp Cuts AI Agent Token Use by 121x

Network graph visualization showing code nodes connected by blue lines flowing into a central MCP hub, representing codebase-memory-mcp knowledge graph architecture

An open-source MCP server called codebase-memory-mcp is trending #1 on GitHub today — and for good reason. Built by DeusData and released June 20, 2026, it cuts the token cost of structural code questions by up to 121x. The mechanism is a persistent knowledge graph built from your codebase using tree-sitter AST parsing, exposed to any MCP-compatible coding agent as 14 queryable tools. Your agent stops reading files one-by-one and starts querying a graph at sub-millisecond speeds.

Why File-by-File Exploration Burns Your Token Budget

When your AI coding agent needs to answer a structural question — “what calls this function?” or “where are all my REST routes?” — the default approach is brute-force: read auth.py, read user.py, read routes.py, grep through each one. That works. It also costs a fortune in tokens.

The numbers from the arXiv research preprint, evaluated across 31 real-world repositories, are striking. Five typical structural queries — finding a function, tracing a call chain, detecting dead code, listing routes, and getting an architecture overview — consume roughly 3,400 tokens via codebase-memory-mcp. The same five queries via file-by-file exploration burn approximately 412,000 tokens. That is a 121x gap, and it grows with codebase size. If you have been hitting context limits on large repos, this is probably why.

Related: Tokenmaxxing Killed AI Budgets — What’s Replacing It

A Knowledge Graph That Answers in Milliseconds

codebase-memory-mcp builds a SQLite-backed graph of your codebase using tree-sitter — the same battle-tested parser powering GitHub’s code search, Neovim, and Helix. It indexes 158 languages and, for 9 of them (Python, TypeScript, Go, Rust, C, C++, Java, PHP, C#), adds language-server-grade type inference that catches imports, generics, and inheritance chains that pure syntax parsing would miss.

Indexing is fast: Django’s 49,000-node codebase takes about 6 seconds on an M3 Pro; the Linux kernel’s 28 million lines of code take 3 minutes. After that initial pass, everything persists in SQLite and re-indexes automatically as files change. There is no re-indexing every time you start a new Claude Code session. The graph is already there.

Once indexed, queries run in under a millisecond. The 14 exposed MCP tools cover the structural questions agents ask most: search_graph finds functions or classes by name or regex, trace_path walks call chains to any depth, get_architecture returns a full overview of routes and hotspots, and query_graph accepts raw Cypher graph queries for custom traversal. Dead-code detection, clone detection via MinHash, and change-impact analysis that maps a git diff to its blast radius round out the toolset.

One Command. Zero Dependencies. Zero Cloud.

Installation on macOS or Linux is a single line:

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash

The installer auto-detects whichever AI coding agents you have installed — Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, Kiro — and writes their MCP configuration entries automatically. No JSON editing required. Windows users get a PowerShell equivalent; npm, pip, Homebrew, Scoop, and AUR packages are also available.

The privacy story is unusually clean for this space. The tool is a single static C binary: no Docker, no runtime, no external APIs, no embedded LLM. Code never leaves your machine. All releases carry SLSA Level 3 cryptographic build provenance, are signed with Sigstore cosign, and are scanned by 70+ antivirus engines before release. For teams working with sensitive codebases, the combination of MIT license and 100% local processing is hard to argue with.

The Honest Trade-Off

codebase-memory-mcp is not a universal replacement for agent file-reading. The arXiv evaluation puts answer quality at 83% versus 92% for file-based agents — the gap comes from what a knowledge graph can and cannot capture. Semantic questions (“why does this function exist?” or “what is the business logic here?”) still need the agent to read actual source. Macro-heavy C codebases hit a harder wall: preprocessor directives do not appear in the AST, and quality scores drop to around 0.58 on those repos.

However, the tool is purpose-built for structural queries — call graphs, dead code, route maps, cross-service dependency chains — and it excels at exactly those. Use it for structural navigation. Let your agent read files for reasoning. The two approaches are complementary, not competing.

Key Takeaways

  • codebase-memory-mcp reduces token consumption on structural code queries by up to 121x — five typical questions drop from 412,000 tokens to 3,400 tokens.
  • It uses tree-sitter AST parsing across 158 languages plus optional LSP type inference, stored in local SQLite. Queries run in under 1 millisecond.
  • One install command auto-configures 11 AI coding agents simultaneously — no JSON editing, no Docker, no cloud APIs, 100% local and MIT licensed.
  • Answer quality is 83% vs 92% file-based on structural queries; semantic reasoning and macro-heavy C still require file reading.
  • 16,000+ GitHub stars, trending #1 today — the MCP ecosystem is producing genuinely useful infrastructure, not just agent wrappers.
ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *

    More in:News