ContextCrumb

ContextCrumb

ContextCrumb compresses long text, local files, and MCP catalog descriptions into denser context for LLM agents. It helps agents load more useful information into the context window and reduce token usage without turning the input into a summary.

Category
访问服务器

README

<h1 align="center">ContextCrumb</h1> <p align="center"> <strong>Shake the crumbs out of bloated context.</strong> </p> <p align="center"> <img src="docs/assets/contextcrumb-banner.png" alt="ContextCrumb banner" width="100%" /> </p>

<p align="center"> <!-- <a href="https://huggingface.co/ymao20/contextcrumb-32m"><img src="https://img.shields.io/badge/model-contextcrumb--32m-ffcc4d?style=flat" alt="Hugging Face model"></a> --> <a href="https://huggingface.co/ymao20/contextcrumb-32m"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fmodels%2Fymao20%2Fcontextcrumb-32m&query=%24.downloads&label=model%20downloads&color=ffcc4d&style=flat" alt="Hugging Face model downloads"></a> <!-- <a href="https://huggingface.co/ymao20/contextcrumb-32m"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fhuggingface.co%2Fapi%2Fmodels%2Fymao20%2Fcontextcrumb-32m&query=%24.likes&label=model%20likes&color=ffcc4d&style=flat" alt="Hugging Face model likes"></a> --> <a href="https://github.com/Yuchen20/Context-Crumb/stargazers"><img src="https://img.shields.io/github/stars/Yuchen20/Context-Crumb?style=flat&color=yellow" alt="GitHub stars"></a> <a href="https://github.com/Yuchen20/Context-Crumb/commits/main"><img src="https://img.shields.io/github/last-commit/Yuchen20/Context-Crumb?style=flat" alt="Last commit"></a> <!-- <a href="LICENSE"><img src="https://img.shields.io/github/license/Yuchen20/Context-Crumb?style=flat" alt="License"></a> --> <img src="https://visitor-badge.laobi.icu/badge?page_id=Yuchen20.Context-Crumb" alt="Visitors"> <img src="https://img.shields.io/badge/python-%3E%3D3.10-blue?style=flat" alt="Python >=3.10"> </p>

<p align="center"> <a href="#before-after">Before / After</a> - <a href="https://huggingface.co/spaces/ymao20/contextcrumb-32m-demo">Playground</a> - <a href="#install">Install</a> - <a href="#quick-start">Quick Start</a> - <a href="#cli">CLI</a> - <a href="#agent-mcp">Agent + MCP</a> - <a href="#model">Model</a> </p>


LLM context gets messy fast: meeting notes, logs, issue threads, docs, transcripts, and tool descriptions all pile up until the useful signal is buried under filler.

ContextCrumb is a token-level compressor for LLM and agent workflows. It looks at text word by word and removes low-signal tokens while keeping the surviving text in the original order.

That is the idea behind the name: the context is still there, but the loose crumbs are shaken off before they reach your model. Less bloat in the prompt. More room for the parts that matter.

<p align="center"> <a href="https://huggingface.co/spaces/ymao20/contextcrumb-32m-demo"> <img src="https://img.shields.io/badge/Try%20the%20playground-ContextCrumb--32M%20Demo-ffcc4d?style=for-the-badge" alt="Try the ContextCrumb-32M Demo"> </a> <br /> <sub>No install needed. Paste text, compare the kept context, and see what gets shaken off.</sub> </p>

<h2 id="before-after">Before / After</h2>

ContextCrumb is not a summarizer. It does not rewrite your document into a new explanation. It keeps the source sequence and deletes expendable words.

Original

ContextCrumb is designed for coding agents, MCP tools, and prompt pipelines that need to read a large local text file before sending it to an LLM. It prints only the compressed text by default, so an agent can capture stdout and use it as shortened context.

Compressed

ContextCrumb designed coding agents, MCP tools, prompt pipelines need read large local text file before sending LLM. Prints compressed text default, agent capture stdout use shortened context.

Same order. Less padding. More room for the next file.

Why ContextCrumb?

Use case What changes
Agent file loading Read long notes, docs, transcripts, and logs before they hit the context window.
Prompt pipelines Shrink natural-language inputs without hand-writing summarizers.
MCP catalogs Compress verbose tool/resource descriptions while preserving names and schemas.
Local workflows Run ONNX inference by default, with cached model files after first download.
Trust-building Use diff and inspect to see what was kept, deleted, and saved.

Best fit: docs, notes, transcripts, issue threads, logs, research context, and other natural-language files. For source code where exact syntax matters, prefer raw file loading or use a conservative keep ratio.

<h2 id="install">Install</h2>

pip install contextcrumb

Optional extras:

pip install "contextcrumb[mcp]"
pip install "contextcrumb[serve]"
pip install "contextcrumb[torch]"

ContextCrumb uses the ONNX backend by default, so normal users do not need PyTorch or Transformers installed. Model files are cached locally after the first download.

<h2 id="quick-start">Quick Start</h2>

from contextcrumb import ContextCompressor

compressor = ContextCompressor()

result = compressor.compress(
    "ContextCrumb deletes low-value words while preserving useful context.",
)

print(result.text)
print(result.stats)

Read and compress a file:

from contextcrumb import ContextCompressor

compressor = ContextCompressor()
result = compressor.compress_file("notes.txt")

print(result.text)
print(result.stats["token_keep_ratio"])

<h2 id="cli">CLI</h2>

The main agent-friendly command is load:

contextcrumb load notes.txt

It prints only compressed text by default, which makes it easy for agents, hooks, shell scripts, and prompt pipelines to capture stdout and move on.

Useful commands:

contextcrumb load notes.txt --json
contextcrumb diff notes.txt
contextcrumb inspect notes.txt
contextcrumb stats

diff marks deleted tokens like this:

kept words [-deleted words-] kept words

<h2 id="agent-mcp">Agent + MCP</h2>

ContextCrumb includes an optional MCP stdio adapter for agent clients that can run Python tools through uvx.

pip install "contextcrumb[mcp]"

Published-package MCP config:

{
  "mcpServers": {
    "contextcrumb": {
      "command": "uvx",
      "args": [
        "--from",
        "contextcrumb[mcp]",
        "contextcrumb-mcp"
      ]
    }
  }
}

The MCP server exposes:

compress_text
compress_file

ContextCrumb also ships contextcrumb-shrink, an MCP proxy that compresses verbose catalog descriptions before an agent sees them while forwarding tool names, schemas, calls, results, and resource contents unchanged.

<h2 id="model">Model</h2>

Model weights and a hosted demo are public on Hugging Face:

Roadmap

Planned for later:

  • Public docs for advanced compression modes and service deployment.
  • JavaScript or TypeScript client.
  • Hosted API experiments.
  • npm publishing.

Development

uv pip install --python .\.venv\Scripts\python.exe -e ".[dev,mcp]"
.\.venv\Scripts\python.exe -m pytest
.\.venv\Scripts\python.exe -m build

Release notes are tracked in CHANGELOG.md.

License

Apache-2.0. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选