mcp-context-dedup

mcp-context-dedup

Compresses verbose MCP output by deduplicating repeated lines and summarizing JSON arrays, achieving 60-80% token savings for LLM prompts.

Category
Visit Server

README

mcp-context-dedup

PyPI Version Python 3.10+ License: MIT Dependencies

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-dedup

Python 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured