Diet Toke
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Diet Toke (v1.1.0)
Full-payload token compression, TypeScript Compiler AST skeletonization, and live cost analytics for AI coding agents in VS Code.
Diet Toke sits transparently between your VS Code AI coding agent (Cline, Roo Code, Continue) and your LLM provider as a zero-dependency local HTTP proxy (127.0.0.1:48192) and Model Context Protocol (MCP) server. It compacts repetitive system prompts, verbose tool schemas, file reads, terminal logs, and multi-turn conversation history—cutting 65.0% of total session input tokens (and up to 77.6% on multi-turn requests) while keeping active target files intact during edits.
Measured Benchmark (v1.1.0)
Benchmarked across multi-turn repository analysis sessions in Cline (gpt-6-astra, 128k context window):
Metric | Uncompressed Raw | With Diet Toke | Net Reduction |
Total Session Input Tokens (6 Requests) |
|
|
|
Peak Single-Turn Payload |
|
|
|
History Compaction & SHA-256 Dedup | — | — |
|
Dynamic Tool & MCP Schema Pruning | — | — |
|
AST & 1-Hop Import Slicing | — | — |
|
Related MCP server: Lore MCP Server
Key Capabilities
1. Multi-Protocol Local Proxy (127.0.0.1:48192)
OpenAI, Anthropic & Native Gemini Support: Intercepts and compresses
/chat/completions,/v1/messages, and native Gemini:generateContent/:streamGenerateContentpayloads (including SSE streams).Multi-Window Workspace Isolation: Routes concurrent VS Code windows through a single shared proxy port (
48192) using isolated per-workspace state (Map<root, WindowState>), preventing cross-project file or symbol collisions.Remote-Ready Lifecycle: Automatically forwards port
48192viavscode.env.asExternalUriin Remote SSH, WSL, and GitHub Codespaces, and guards shell RC exports withnc -zliveness checks so disconnected terminals never break API calls.
2. Compiler AST & Multi-Language Skeletonizer (src/astSkeletonizer.ts)
TypeScript & JavaScript Compiler AST (
.ts,.tsx,.mts,.cts,.js,.jsx,.mjs,.cjs): Usests.createSourceFile()span editing to replace function, method, constructor, and accessor bodies with{ ... }, removeprivateand#privatemembers, and condense JSDoc comments to their summary line—immune to regex literals or nested template braces.Multi-Language Compactors: Structural skeletonization for Ruby, HTML/XML/SVG, SQL, YAML, and Shell scripts.
Intent-Aware Edit Guard: Automatically classifies every prompt (
read-onlyvs.edit):read-onlymode: Aggressively skeletonizes target files, dependencies, and Turn-1<file_content>/ MCP file reads.editmode: Preserves active target files 100% verbatim so patches and diffs never fail, while still skeletonizing surrounding dependencies.
3. Dynamic Tool Pruning, History Folding & Cache Stability
Schema & Property Compaction: Strips write and shell-execution tool definitions during
read-onlytasks and trims verbose tool andparameters.propertiesdescriptions while keepingtype,enum, andrequiredfields intact.4-Turn Active Window Folding: Folds older intermediate turns into concise action summaries once a session exceeds 6 messages, while preserving
messages[0..1]byte-for-byte to keep upstream KV prefix caches warm.SHA-256 Block Deduplication: Replaces repeated file contents and code blocks across turns with lightweight back-references.
4. MCP Server & Live Token Analytics Dashboard
Built-In MCP Endpoint (
POST /mcp): Exposesdiet_read_skeletonfor on-demand AST skeletonization directly from MCP-compatible agents.Exact Provider Usage & Cost Reconciliation: Reconciles pre-flight token estimates with actual upstream
usageandcached_tokenstelemetry using model-aware input/cache pricing ($0.00for local Ollama /localhostendpoints).
5. Security & Monorepo Guardrails
Sensitive File Protection: Blocks
.env,.pem,.key, and private credential dotfiles from workspace indexing while allowlisting.githuband.gitignore.Monorepo Scaling Cap: Caps workspace dependency scanning at 100 files to maintain low latency in large repositories.
Quick Start
1. Install the Extension
Install the packaged VSIX in VS Code:
code --install-extension diet-toke-1.1.0.vsixThen reload your VS Code window (Cmd+Shift+P / Ctrl+Shift+P → Developer: Reload Window).
2. Verify Status Bar & Agent Routing
Confirm
Diet Toke: -0% (0 saved)appears in the bottom-right VS Code status bar.Diet Toke automatically configures supported extensions (such as Cline) to route API traffic through
http://127.0.0.1:48192/proxy/<base64url-upstream>and registers its local MCP server.
3. Monitor Live Savings
Click Diet Toke in the status bar to open Live Token Analytics, where you can inspect:
Session & lifetime tokens saved and dollar cost savings
Per-layer savings breakdown (AST Slicing, Tool Pruning, Log Distillation, History & Dedup)
Billed vs. upstream cached token counts per request
Controls to pause compression, clear the dedup cache, or reset counters
Development & Release
# Type-check and compile
npx tsc --noEmit
# Package VSIX
npm run package
# Commit and tag release
git add -A && git commit -m "Release v1.1.0" && git tag -a v1.1.0 -m "Diet Toke v1.1.0"License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Codebase structural query, delivered per API call as an atom service on Conduit Atoms.
Repository knowledge graph MCP server for codebase understanding and debugging.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn AST-based MCP server that provides token-efficient codebase skeletons to LLM agents, reducing context token usage by 80-95% by exposing structural information instead of full source files.53MIT
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to query a codebase's structural knowledge (symbols, imports, call graphs, etc.) via MCP, reducing tokens and improving correctness compared to raw file access.33 npm7MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that folds function and class implementations into structural skeletons while preserving signatures, interfaces, and docstrings, reducing tokens by up to 90%+ for AI agents. Exposes tools to get repository skeletons, unfold specific symbols on demand, and retrieve exact token and prompt cost savings metrics.MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables coding agents and developers to parse Python source into ASTs and compute complexity metrics that pinpoint refactoring hotspots, dead code, and breaking API diffs. It returns decomposition plans and dependency-graph telemetry over MCP, keeping token usage low with zero external dependencies.-