npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

compendium-mcp

v0.7.0

Published

MCP server that compresses, summarizes, and filters context to minimize LLM token usage

Readme

Compendium

MCP server that shrinks noisy context before it reaches the model: filter logs, compress bulky text/JSON, redact secrets, chunk huge files, and keep only what a question needs.

One tool (compendium), one action field, deterministic heuristics that need no model. An optional local Ollama model improves the two "smart" actions.

Install (Cursor / Claude Desktop)

Requires Node.js 18+. No Rust toolchain needed — the launcher downloads a prebuilt binary once.

Add to ~/.cursor/mcp.json (or the project's .cursor/mcp.json, or Claude Desktop's MCP config):

{
  "mcpServers": {
    "compendium": {
      "command": "npx",
      "args": ["-y", "compendium-mcp"]
    }
  }
}

Reload MCP. You should see a single tool named compendium. That's it.

Prebuilt binaries: macOS (arm64, x64), Linux (x64, arm64), Windows (x64). Other platforms: cargo build --release and set COMPENDIUM_BINARY=/path/to/compendium in the server env.

Optional: smarter summaries with Ollama

summarize_smart and filter_relevant use a small local model when one is configured; otherwise they fall back to heuristics. One command sets it up:

npx -y compendium-mcp setup-ollama --write-mcp

It detects (or --installs) Ollama, pulls qwen2.5:3b, probes http://127.0.0.1:11434/v1, and writes COMPENDIUM_LOCAL_LLM_URL / COMPENDIUM_LOCAL_LLM_MODEL into ~/.cursor/mcp.json (--project for .cursor/mcp.json). Reload MCP and call {"action":"llm_status"} — reachable: true means smart actions will report backend: "local_llm".

Any OpenAI-compatible loopback server works (llama.cpp, Lemonade, …): set the two env vars yourself. Remote hosts are rejected on purpose.

Actions

| action | Use it for | Main fields | |----------|------------|-------------| | filter | Strip ANSI/boilerplate, collapse whitespace, keep/drop regex lines | text, filter?, query? | | compress_output | Domain-aware scrub of cargo / npm / docker / git / kubectl output | text, output? | | compress | Dense rewrite of bulky text, code, or JSON | text, compress? | | summarize | Outline / conversation / file-tree summary | text, summarize? | | summarize_smart | Local-model summary (heuristic fallback) | text, smart? | | filter_relevant | Keep only lines relevant to a question (local model or BM25) | text, query | | sanitize | Redact secrets, neutralize prompt-injection phrases | text, sanitize? | | rerank | BM25-rank candidates for a query | query, items / text / chunk map | | chunk / resolve | Split a huge corpus into cmp:// chunks; fetch one by id | text, chunk? / id | | cache_store / cache_get / cache_invalidate | Park a blob outside the prompt under a short key | text, cache? / key | | count_tokens | Measure size | text | | stats | Session savings per action | reset? | | llm_status | Is the local model configured and reachable? | force? | | help | List actions, or fields + example for one action | id? |

Every response is { "ok": true, "action": "filter", "result_json": "{…}" } — parse result_json for the action payload. Add "sanitize_input": true to any text action to scrub secrets first. compress / summarize leave inputs under 1000 characters untouched unless force: true.

Example:

{
  "action": "filter",
  "text": "…noisy log…",
  "filter": { "strip_ansi": true, "keep_patterns": ["ERROR|WARN"] }
}

More samples in examples/. Unsure which action fits? Call {"action":"help"}.

Environment

All optional.

| Variable | Default | Meaning | |----------|---------|---------| | COMPENDIUM_LOCAL_LLM_URL | (unset) | OpenAI-compatible loopback base URL; enables smart actions | | COMPENDIUM_LOCAL_LLM_MODEL | qwen2.5:3b | Model id on that server | | COMPENDIUM_LOCAL_LLM_API_KEY | (unset) | Bearer token for locked loopback servers | | COMPENDIUM_LOCAL_LLM_TIMEOUT_SECS | 120 | HTTP timeout (first model load can be slow) | | COMPENDIUM_LOCAL_LLM_REASONING_EFFORT | low | low/medium/high/off; omit drops the field for strict servers | | COMPENDIUM_DEFAULT_MAX_TOKENS | 2048 | Soft output cap for compress/summarize | | COMPENDIUM_SIGNAL_MIN_CHARS | 1000 | Bypass compress/summarize below this length (0 disables) | | COMPENDIUM_CHARS_PER_TOKEN | 4.0 | Heuristic token estimate | | COMPENDIUM_TOKENIZER | cl100k_base | BPE encoding when built with --features real-tokens | | COMPENDIUM_BINARY | (unset) | npm launcher: use this binary instead of downloading | | RUST_LOG | compendium=info | Logs go to stderr only |

Build from source

cargo build --release                        # heuristic token counts
cargo build --release --features real-tokens # exact BPE counts via tiktoken
cargo test

Point your MCP config at target/release/compendium directly, or keep npx and set COMPENDIUM_BINARY.

Design

  • Deterministic by default. Heuristic paths need no network and produce byte-identical output, which keeps prompt prefix caches warm.
  • Local-first. Smart actions only ever call a loopback URL; there is no cloud path.
  • stdout is JSON-RPC. All logging goes to stderr.

Community

Contributing · Changelog · Architecture · Security · Support · Code of Conduct

License

MIT