TokenGuard

•

Optimizes Large Language Model token consumption for agentic coding workflows by providing condensed, relevant information.

TokenGuard is a local MCP server engineered to significantly reduce LLM token consumption in agentic coding environments. It achieves this by returning fewer, denser tokens per tool call, offering structural code summaries instead of entire files, providing diffs for changes, caching tool results, and enabling a scripting mode that collapses multiple tool calls into one. Additionally, it features a proxy mode that allows multiplexing other MCP servers through its optimization layers, ensuring comprehensive token savings across various development setups.

Características Principales

01Diff/Distill Engine: Returns code differences and structural summaries for file reads and edits, rather than full file contents.
02AST Index: Provides class/method outlines, signatures, and hierarchy information for Java codebases, significantly smaller than file reads.
03Semantic Cache: Intelligently caches tool results with dependency-based invalidation for exact and semantic matches, reducing redundant LLM calls.
04Code Mode: Allows agents to execute sandboxed JavaScript programs against a read-only workspace API, getting only needed data and composing downstream tools in-script.
05Proxy / Multiplexer: Exposes other MCP servers through a fixed, context-efficient facade, keeping tool schemas out of context and caching results.
060 GitHub stars

Casos de Uso

01Minimizing token expenditure for Large Language Models in agentic coding scenarios.
02Optimizing output and reducing context window pressure when using multiple MCP servers concurrently.
03Rapidly rebuilding agent working state after context compaction or system restarts.