distill-mcp-v2
distill-mcp-v2 is a high-performance, network-dependency-free Python FastMCP server designed to aggressively optimize Large Language Model (LLM) context windows. It provides specialized tools for compressing and analyzing massive AI-agent payloads without losing critical semantic information.
README
<div align="center"> <h1>Distill v2</h1> <p><strong>Model Context Protocol (MCP) Server for Massive Context Engineering & Compression</strong></p>
⚡ Overview
distill-mcp-v2 is a high-performance, network-dependency-free Python FastMCP server designed to aggressively optimize Large Language Model (LLM) context windows. It provides specialized tools for compressing and analyzing massive AI‑agent payloads without losing critical semantic information.
By filtering noise, stabilizing cache prefixes, and running multi-model token cost estimations locally, Distill v2 dramatically reduces API costs and preserves LLM reasoning abilities when dealing with heavy payloads like infinite logs, monolithic API schemas, and multi-agent war room transcripts.
🚀 Performance & Token Compression
Our rigorous, independent stress-testing benchmarks (audited via pytest and chaos blueprints) prove that distill-mcp-v2 achieves up to 99.7% token compression while retaining 100% of the crucial context.
| Scenario | Payload Profile | Raw Tokens | Distilled Tokens | Savings % |
|---|---|---|---|---|
| Trace Avalanche | Heavy Java Stacktraces | 150,027 | 546 | 99.6% |
| Schema Monolith | Massive Microservice JSON | 56,588 | 1,355 | 97.6% |
| Incident War Room | Multi-Agent Chat Logs | 117,952 | 371 | 99.7% |
(Tested against Claude-3-Opus budgets. Scenario 1 reduced costs from $2.25/call to $0.008/call.)
Read the full Benchmark & Execution Report for deeper insights.
🛠 Features & Toolset
Distill v2 exposes 8 precise tools to agents via the Model Context Protocol:
distill_json— Compresses raw JSON payloads, retaining anomalies, exceptions, and errors.distill_logs— Compresses raw.logfiles, preserving head/tail contexts and stack traces.distill_schema— Compacts massive MCP tool catalogs and JSON schemas to structural parameters.distill_response— Progressively prunes, minifies, and truncates outputs to fit strict token budgets.distill_conversation— Extracts goals, decisions, blockers, and actions from multi-agent transcripts without leaking raw ISO timestamps.stabilize_for_cache— Maps chaotic raw identifiers (UUIDs, hex IDs) to sequential placeholders to stabilize LLM prompt caching.analyze_tokens— Accurately estimates token counts usingtiktoken(cl100k_base).compare— Computes detailed diffs and cost-savings analyses between raw and distilled payloads.
📦 Quick Start
Installation
Distill v2 requires Python 3.10+. We recommend using uv or pip in an isolated virtual environment.
# Clone the repository
git clone https://github.com/yatinkoul/distill.git
cd distill
# Create a virtual environment and activate it
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -e .
Running the Server
Run the FastMCP server, which natively binds to a stateless HTTP endpoint.
# Run the FastMCP server (default host: 0.0.0.0, port: 8000)
distill --host 0.0.0.0 --port 8000
# Or using uvicorn directly:
.venv/bin/uvicorn src.main:app --host 0.0.0.0 --port 8000
The server exposes a JSON‑RPC endpoint at http://localhost:8000/mcp.
🧪 Stress Testing & Development
The repository ships with an exhaustive stress-test runner that dynamically allocates ports, executes deterministic payload scenarios, and validates the integrity of the distilled outputs.
To run the complete test suite (118/118 passing):
# Install development dependencies
pip install -e ".[dev]"
# Run the test suite
pytest
To manually execute the stress-testing blueprints and regenerate the benchmark report:
python stress_tests_blueprints/run_blueprints.py
📖 Documentation
- Project Goals & Strategy – High-level strategy and milestones.
- Benchmark Report – Exhaustive stress-test results.
- Testing Infrastructure – Notes on the testing architecture and CI/CD readiness.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
Please read our CONTRIBUTING.md (coming soon) for guidelines on how to propose improvements. Ensure all tests and linting (ruff) pass before submitting pull requests.
📜 License
This project is licensed under the MIT License – see the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。