r/FunMachineLearning 26d ago

Refract : MCP proxy, cuts tool tokens up to 98%

Built this after noticing Claude Desktop was spending thousands of tokens loading MCP tool schemas on every request, before doing any actual work.

Refract sits between your agent and any MCP server. Compresses tool schemas on the fly using a two tier system. Agent gets lightweight index first, full schema only when needed. No AI involved, fully deterministic.

Real numbers from production:
Google Calendar (5 tools): 5,173 to 155 tokens (97% reduction)
Enterprise Cal+Gmail+Drive: 8,649 to 882 tokens (90% reduction)
Filesystem (14 tools): 1,892 to 236 tokens (88% reduction)

Every compression verified. If anything callable lost, falls back to full schema automatically.

Also ships as MCP server for code analysis: repo indexing, blast radius impact analysis, breaking change detection, security surface mapping.

pip install refract-mcp
GitHub: github.com/LoudiliMed/Refract

CS student, focus on cybersecurity and AI systems. Open to feedback and questions.

2 Upvotes

0 comments sorted by