Original Reddit post

I built an MCP server that cuts Claude Code token usage by ~70–90% I built a small MCP server for Claude that gives it a proper code search engine instead of reading entire files. When working with larger repos in Claude Code, I noticed it often reads full files just to locate a function. That can easily burn thousands of tokens. So I built an MCP server that lets Claude query the repo instead of reading it . Instead of loading files, Claude can search for exactly what it needs. Example Before: Claude reads 3 files → ~5400 tokens → ~5 seconds After: Claude queries “auth middleware” → ~230 tokens → ~85ms So roughly 70–90% token savings and much faster responses. What it does Instead of file reads, Claude gets tools like: natural language code search symbol lookup (functions/classes) fuzzy matching for typos BM25 relevance ranking code summaries instead of full files You can ask things like: find the authentication middleware show all payment related functions what does UserService do? Claude pulls only the relevant code blocks , not the entire repo. How I built it with Claude Code I used Claude Code while developing the project to: help design the MCP tool interface generate parts of the search pipeline iterate on ranking and fuzzy matching logic test different token-reduction strategies debug indexing and symbol extraction Claude was also useful for quickly experimenting with different search approaches and validating whether the MCP responses were useful enough for Claude to navigate a repo without reading full files. The result is an MCP server that Claude can call during development to fetch minimal context instead of entire files . Features Natural language search BM25 ranking (same relevance algorithm used in Elasticsearch) Fuzzy matching ( athenticate → authenticate ) Works across multiple languages (TypeScript, JavaScript, Python, Go, Rust, C/C++, C#, Lua) <100ms search on large repos ~1 second indexing per 1000 files Setup npm install -g claude-mcp-context mcp-context-setup Then tell Claude: Index this repository After that Claude automatically uses the search tools instead of reading files. Real example (3.5k file repo) Index time: 45s Search: ~78ms Token reduction: ~87% average Repo (free & open source) https://github.com/transparentlyok/mcp-context-manager It’s free and open source if anyone wants to try it with their own repos. I’d be curious to hear how much token usage it saves for other Claude Code users. submitted by /u/Actual-Thanks5168

Originally posted by u/Actual-Thanks5168 on r/ClaudeCode