Open-Source MCP Server: Precise Code Slicing for Claude Code/Codex, Saving ~87% Input Tokens
naruto_uzumaki00 · reddit · 2026-07-05
The author open-sourced a vendor-neutral token reduction layer centered around an MCP server. By using retrievecode(query) and explainsymbol(name), it returns only relevant AST slices (based on tree-sitter, supporting 12 languages), preventing agents from stuffing entire files into the context. A single STDIO server can connect to both Claude Code and Codex.
Benchmark tests on heavy tasks (based on actual billed tokens) show: GPT-5.5 input dropped from 16,875 to 2,232 (an 86.8% reduction) with a constant quality score of 3/3; Opus 4.8 dropped from 26,573 to 3,343 (an 87.4% reduction). The repository is Apache-2.0 licensed and includes reproducible benchmarks. The author acknowledged limitations, noting that the test set was small and slightly favorable, and that static embeddings did not outperform standard keyword search in evaluations.
Related event: Open MCP Server Slashes LLM Input Tokens by 87%(2 posts)→
More from coding & agent
- A 9B Ollama agent can run a fully local DJ radio with tools, memory, and TTS — pinku1 · 2026-07-27
- Bugbot rejects an MCP permission flag because it would break path-scoped isolation — zeeg · 2026-07-27
- One GPT-5.6 agent is guarding a Blink security system while another makes a parody rap album — repligate · 2026-07-27
- An agent got unblocked by reusing a logged-in browser, not stealth tricks — armanidev_ · 2026-07-27
- Paper argues graph topology can become the core operating system for AI agents — theomitsa · 2026-07-27
- Claude Code desktop adds UI markup feedback for smoother visual editing — EricBuess · 2026-07-27