MCP Context Condenser Token-slimming AST code outliner, surgical symbol extractor, and log compressor cutting AI agent context usage and API bills by up to 85%.** Designed for **Cursor**, **Claude Desktop**, **Cline**, and **Antigravity**.
MCP Context Condenser ⚡
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> **Token-slimming AST code outliner, surgical symbol extractor, and log compressor cutting AI agent context usage and API bills by up to 85%.**
Designed for **Cursor**, **Claude Desktop**, **Cline**, and **Antigravity**. Works seamlessly as an **MCP stdio server** or standalone **terminal CLI**.
---
🛑 The Problem: LLM Context Saturation & Financial Bleed
Feeding entire 1,000–3,000 line source files into Claude 3.7 Sonnet or GPT-4o context windows causes two critical issues:
1. **Financial Bleed**: Massive prompt token burns ($15–$50+/day on active pair-programming sessions).
2. **"Lost in the Middle" Degradation**: Drowning models in boilerplate internal implementations increases hallucination rates and degrades adherence to subtle architectural rules.
Most agent interactions only need **exported interfaces, type signatures, or one specific helper function**.
---
✨ Superpowers
| Tool / Command | Description | Token Reduction |
| :--- | :--- | :--- |
| condense_source / outline | Generates type-safe AST code skeletons preserving imports, interfaces, types, and method signatures while condensing function bodies. | **Up to 85%** |
| extract_symbol / symbol | Surgically extracts only the requested class, interface, or function with relevant file-level imports. | **Up to 95%** |
| compress_log / log | Strips noisy terminal passes and boilerplate, pinpointing failing assertions, compiler errors, and app stack frames. | **Up to 90%** |
| token_budget / budget | Calculates token weight (~3.8 chars/token) and provides context-window safety warnings before ingesting huge files. | Proactive Guardrail |
---
📊 Live Benchmark
Ingesting a 450-line TypeScript payment gateway service (PaymentGatewayService.ts):
---
🚀 Quickstart Installation
Option 1: Claude Desktop
Add to your claude_desktop_config.json:
Option 2: Cursor
Add to your .cursor/mcp.json:
Option 3: Terminal CLI (Zero Configuration)
Run directly from your terminal:
---
🛠️ MCP Tool Reference
1. condense_source
* **Inputs**:
* sourceCode *(string)*: Raw code to outline.
* preserveDocstrings *(boolean, optional)*: Whether to preserve JSDoc / TSDoc comments.
* **Returns**: Condensed outline, line count diff, token reduction percentage.
2. extract_symbol
* **Inputs**:
* sourceCode *(string)*: Full source code.
* symbolName *(string)*: Name of function, class, interface, or type.
* **Returns**: Extracted symbol with file imports and line numbers.
3. compress_log
* **Inputs**:
* rawLog *(string)*: Raw test, compiler, or build output.
* **Returns**: Isolated failures, root-cause assertion messages, and source code line pointers.