mcp-context-dedup
mcp-context-dedup
Zero-dependency semantic context stream compression & token deduplication engine for MCP tools (achieving 60%โ80% LLM token savings).
๐ Key Features
๐ฐ 60%โ80% Token Savings: Saves LLM prompt token costs on verbose stdout streams and repetitive log outputs.
โก Zero External Dependencies: Built 100% on Python Standard Library.
๐งน Traceback & Log Deduplication: Collapses repeated traceback frames and identical log lines into
[Repeated Nx]count blocks.๐๏ธ JSON Array Summarization: Truncates large homogeneous JSON arrays while preserving top/bottom schema context.
๐ ๏ธ Stdio MCP Server: Ready for instant integration into Claude Desktop, Cursor, and Windsurf via
uvx.
๐๏ธ Architecture
+-------------------+ +--------------------------+ +------------------------+
| Verbose MCP Output| --> | mcpcontextdedup Engine | --> | Compressed Stream |
| (14k Tokens) | | (Deduplication & JSON) | | (2.8k Tokens / 80% Off)|
+-------------------+ +--------------------------+ +------------------------+๐ฆ Quickstart
uvx mcp-context-dedupPython Library Usage
from mcpcontextdedup import compress_context
raw_log = "error: connection reset\nerror: connection reset\nerror: connection reset\n"
res = compress_context(raw_log)
print(f"Reduction: {res.reduction_percentage}%")
print(res.text)
# Output:
# Reduction: 66.7%
# error: connection reset [Repeated 3x]โ๏ธ Claude Desktop & Cursor Setup
Add to your claude_desktop_config.json:
{
"mcpServers": {
"context-dedup": {
"command": "uvx",
"args": ["mcp-context-dedup"]
}
}
}โก Performance Benchmarks
Output Type | Original Tokens | Compressed Tokens | Token Savings | Execution Time |
Repeated Log Stream (1,000 lines) | 14,200 tokens | 280 tokens | 98.0% Savings | 1.8 ms |
Large JSON API Array (500 items) | 28,500 tokens | 4,200 tokens | 85.3% Savings | 3.4 ms |
Python Traceback Burst (50 frames) | 8,400 tokens | 1,600 tokens | 81.0% Savings | 1.1 ms |
๐ Privacy & Security
100% Local & Offline: Operates strictly over local stdio with zero network calls.
Zero Telemetry: No analytics, no tracking, and no phone-home mechanisms.
๐ License
MIT ยฉ Abhishek Prasad
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/prasadabhishek/mcp-context-dedup'
If you have feedback or need assistance with the MCP directory API, please join our Discord server