mcp-context-condenser
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-context-condenser Condense the payment service source into an AST skeleton"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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. 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:
Financial Bleed: Massive prompt token burns ($15β$50+/day on active pair-programming sessions).
"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.
Related MCP server: tokencut
β¨ Superpowers
Tool / Command | Description | Token Reduction |
| Generates type-safe AST code skeletons preserving imports, interfaces, types, and method signatures while condensing function bodies. | Up to 85% |
| Surgically extracts only the requested class, interface, or function with relevant file-level imports. | Up to 95% |
| Strips noisy terminal passes and boilerplate, pinpointing failing assertions, compiler errors, and app stack frames. | Up to 90% |
| 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):
- RAW FULL FILE DUMP:
- Lines: 450 lines
- Token Weight: ~4,820 tokens
- Latency / Cost: High token latency, potential context degradation
- Cost per 100 queries: $1.44 (Sonnet 3.7)
+ MCP CONTEXT CONDENSER (AST SKELETON):
+ Lines: 58 lines
+ Token Weight: ~680 tokens (85.9% reduction)
+ Latency / Cost: Instant TTFT, razor-sharp instruction following
+ Cost per 100 queries: $0.20 (Sonnet 3.7)π Quickstart Installation
Option 1: Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"context-condenser": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/mcp-context-condenser/dist/index.js"]
}
}
}Option 2: Cursor
Add to your .cursor/mcp.json:
{
"mcpServers": {
"context-condenser": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/mcp-context-condenser/dist/index.js"]
}
}
}Option 3: Terminal CLI (Zero Configuration)
Run directly from your terminal:
# Outline an entire file into a compact skeleton
node dist/index.js outline src/services/auth.ts
# Surgically extract a single function or class
node dist/index.js symbol src/services/auth.ts validateToken
# Compress voluminous test or build logs
node dist/index.js log test_output.log
# Check token budget of a file
node dist/index.js budget src/large_file.tsπ οΈ 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.
4. token_budget
Inputs:
filePath(string): File path being evaluated.content(string): Raw file content.
Returns: Estimated tokens, oversized flag, and optimization recommendations.
π¦ Zero-Dependency Standalone Build
Unlike standard MCP servers with hundreds of nested node_modules, mcp-context-condenser is pre-bundled with esbuild into a single, self-contained standalone binary (dist/index.js).
Instant Startup: $< 10\text{ms}$ process boot time.
Firecracker & Docker Ready: Zero runtime installation required.
π License & Commercial Distribution
Released under the MIT License. Available on:
Gumroad: Buy or PWYW ($5.00+)
itch.io: Download on itch.io
Available Tools
4 toolscompress_logA
Filters and compresses verbose test runs, build logs, and compiler outputs (Jest, Vitest, tsc, cargo) to extract only the root-cause failures and actionable file locations, discarding passing suites and noise.
Inputs: rawLog, logPath.
condense_sourceA
Extracts an AST-aware structural skeleton of a source file (preserves imports, interfaces, types, and function/method signatures while stripping implementation bodies) to slash token consumption by up to 85%.
Inputs: path (required), preserveDocstrings.
extract_symbolA
Surgically extracts only the exact implementation of a named function, class, method, or interface along with top-level imports, omitting the rest of the file to save tokens.
Inputs: path (required), symbol (required).
token_budget_viewA
Analyzes the line count and estimated LLM token weight of a source file, providing actionable recommendations to avoid context saturation.
Inputs: path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
Most tools target clearly distinct inputs: source files, individual symbols, logs, and token analysis. Condense_source and extract_symbol both reduce source token usage, but their different approaches (structural skeleton vs. exact symbol extraction) are described well enough to distinguish them.
Three tools follow a clean verb_noun snake_case pattern (condense_source, extract_symbol, compress_log). Token_budget_view breaks the pattern by leading with the noun rather than an action verb, creating a minor inconsistency.
Four tools is an ideal size for a focused context-condensing utility. Each tool serves a distinct, practical purpose and none feel redundant or unnecessary.
The set covers source reduction, symbol extraction, log compression, and token-budget analysis, which addresses the main context-overload scenarios. Minor gaps exist, such as no multi-file or project-wide condensation tool, but the core workflows are well covered.
Maintenance
Related MCP Connectors
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
AST context pruner, token budget planner, fuzzy patcher, and code solvers.
Cuts coding agent token burn up to 72% continuously via contradiction-free memory & verification.
Compress coding-agent context ~64%. Hosted Neural Keep MCP for Cursor/Claude/Codex.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to efficiently analyze codebases by extracting AST skeletons, reducing token usage while preserving type contracts and interfaces.2 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to compress terminal output and file context in real time, preserving full error tracebacks while reducing token consumption by 60-85%.43MIT
- AlicenseAqualityBmaintenanceEnables coding agents to reduce prompt token usage by extracting code skeletons and symbols, compressing test and command output, generating compact diffs, and tracking session token health to avoid rate-limit lockouts.6MIT
- AlicenseBqualityBmaintenanceEnables AI coding agents to reduce token usage and context bloat through AST skeletonization, prompt distillation, caching, and token-budget governance while preserving essential code context.76,429 npm4,319 PyPI48MIT