mcp-context-condenser
Click on "Install 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-condenserCondense 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: mcp-code-context
✨ 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.
| Name | Required | Description | Default |
|---|---|---|---|
| rawLog | No | Raw log string content to compress | |
| logPath | No | Optional path to a log file on disk |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does a solid job: it discloses that the tool filters, compresses, extracts failures, and discards noise. It also defines the output focus ('root-cause failures and actionable file locations'). However, it does not mention input precedence when both rawLog and logPath are supplied, nor the return format, leaving minor gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire description is one sentence that front-loads the core action and resource, then efficiently lists supported log types and the desired outcome. There is no filler or repetition of schema names, and every clause adds useful information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is sufficiently complete for a moderately complex tool with no output schema and no annotations: it covers operation, input domain, output intent, and specific tool ecosystems. The only notable omission is the returned data structure and how the two optional inputs interact, but these are not critical for basic invocation with schema coverage at 100%.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both parameters (rawLog and logPath) are already documented. The description adds no parameter-specific detail beyond what the schema provides. Baseline 3 applies because the schema carries the parameter documentation weight.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with strong verbs ('Filters and compresses') and names a specific resource: verbose test runs, build logs, and compiler outputs. It also states the intended outcome ('extract only the root-cause failures and actionable file locations') and what is discarded ('passing suites and noise'). This distinguishes it from sibling tools like extract_symbol and condense_source, which target different source types and extraction goals.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly implies the use case—compress verbose build/test logs to isolate failures—but it never explicitly says when NOT to use it or names alternative tools. Sibling tools like condense_source could plausibly overlap, and the description does not draw an explicit boundary. Usage guidance is present but only by inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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%.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute or relative path to target source file | |
| preserveDocstrings | No | Whether to preserve docstring comments |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well by disclosing the AST-aware transformation, what is preserved, what is removed, and the token reduction effect. It does not explicitly state whether the operation mutates the original file or returns a new representation, but 'Extracts' implies a non-destructive output.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single well-structured sentence that front-loads the action and resource, uses a parenthetical to efficiently list preserved versus stripped elements, and closes with a concrete benefit. There is no filler or redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The core purpose and behavior are clearly described, and the two parameters are simple enough that an agent can invoke the tool with just a path. However, there is no explicit statement about the return format or output representation, and no sibling differentiation, which is more noticeable because no output schema exists.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and both parameters already have clear descriptions. The tool description adds no additional meaning about how path resolution works or what role preserveDocstrings plays beyond its schema description, so a baseline score is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Extracts') and resource ('structural skeleton of a source file'), and clearly states what is preserved (imports, interfaces, types, signatures) versus stripped (implementation bodies). This makes the tool's function distinct from siblings like extract_symbol or compress_log.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The usage context is implied: use this when you need a condensed, structurally faithful representation of source code to reduce token consumption. However, there is no explicit guidance on when to choose this tool over siblings like extract_symbol or compress_log, and no mention of when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to target source file | |
| symbol | Yes | Name of the function, class, or interface to extract |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses important behavioral traits: only the exact implementation is returned, top-level imports are included, and the rest of the file is omitted. This gives the agent a clear model of the operation's outcome. It does not, however, mention edge cases like missing symbols or multiple definitions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, dense sentence that front-loads the core behavior ('Surgically extracts only the exact implementation') and immediately follows with the key constraints. No filler or redundant phrasing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter tool with no output schema, the description covers what is extracted, what is included, and what is omitted. It is nearly complete, though it does not describe the output format explicitly or what happens when the symbol is not found. Those are minor gaps given the low complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description reinforces that 'symbol' refers to a function, class, method, or interface, and implies 'path' is a source file path, but it does not add meaningful syntax, format, or resolution details beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a precise verb ('extracts'), a specific resource ('implementation of a named function, class, method, or interface'), and a distinctive scope ('top-level imports, omitting the rest'). This clearly separates it from sibling tools like condense_source or compress_log.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the intended use case—pulling a single symbol's implementation while saving tokens—but does not explicitly mention when to use this tool versus the siblings, nor does it state any exclusions or alternative conditions. The usage context is present but only implicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
token_budget_viewA
Analyzes the line count and estimated LLM token weight of a source file, providing actionable recommendations to avoid context saturation.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the target file to analyze |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations present, the description carries the full disclosure burden. It states the tool analyzes rather than mutates and that it returns recommendations, which is meaningful behavioral context. It does not explicitly say 'read-only' or describe failure conditions, but the analytical verbs make the non-destructive nature reasonably clear.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire definition is one front-loaded, information-dense sentence. Every clause earns its place: the verb, the analyzed metrics, and the actionable output are all present without filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a one-parameter analysis tool with no output schema, the description covers what it analyzes, what it returns, and why it matters. The only notable gap is explicit guidance on choosing between this and its siblings, but that is already accounted for in usage guidelines.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already fully documents the single 'path' parameter at 100% coverage. The description adds little beyond reinforcing that the path points to a source file, so the baseline of 3 applies; no parameter-semantic gap exists.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb, 'Analyzes,' and names the resource ('a source file') and the exact metrics (line count, estimated LLM token weight), plus the outcome ('actionable recommendations to avoid context saturation'). This clearly differentiates it from siblings like condense_source and compress_log, which imply modification rather than analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended use is implied by the phrase 'to avoid context saturation,' suggesting it should be run before condensing or compressing a file. However, it never names sibling tools or states when not to use it, so an agent must infer the routing decision from the purpose alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v1.0.0- First observed
compress_log - First observed
condense_source - First observed
extract_symbol - First observed
token_budget_view
TDQS
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.
Reduces AI Agent token usage by 40% via three-stage SOP workflow.
Shared distillation cache for AI agents — every fetch ~73-89% fewer tokens via a shared cache.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation for…
Related MCP Servers
- AlicenseBqualityCmaintenanceMaximizes AI agent context window by enabling compact code reading and editing, reducing tokens by 40% for deeper codebase understanding.19203MIT
- AlicenseBqualityBmaintenanceEnables LLMs to efficiently read, write, and refactor code using precise AST-based operations, reducing token usage and context window waste.25333MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to efficiently query code context via a symbol graph, reducing token usage by up to 20x.1,223469-
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code to reduce token usage by 70-90% using a local LLM for codebase indexing, tool output compression, and turn summarization.243MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rafim-dev/mcp-context-condenser'
If you have feedback or need assistance with the MCP directory API, please join our Discord server