compendium-mcp 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +52 -10
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Compendium
2
2
 
3
+ <p align="center">
4
+ <img src="assets/logo.svg" alt="Compendium" width="420" />
5
+ </p>
6
+
3
7
  MCP server that **minimizes LLM token usage** by compressing, summarizing, filtering, and chunk-referencing large context before it reaches the model.
4
8
 
5
9
  Built in Rust with the official [`rmcp`](https://crates.io/crates/rmcp) SDK.
@@ -76,6 +80,8 @@ Binary packaging details for maintainers: [npm/DISTRIBUTION.md](npm/DISTRIBUTION
76
80
  ## Community
77
81
 
78
82
  - [Contributing](CONTRIBUTING.md)
83
+ - [Changelog](CHANGELOG.md)
84
+ - [Architecture](docs/architecture.md)
79
85
  - [Code of Conduct](CODE_OF_CONDUCT.md)
80
86
  - [Security policy](SECURITY.md)
81
87
  - [Support](SUPPORT.md)
@@ -110,14 +116,33 @@ Single MCP tool: **`compendium`**. Choose the operation with `action`:
110
116
  | `cache_get` | Retrieve by key | `key` |
111
117
  | `cache_invalidate` | Drop one key or clear cache | `key?` |
112
118
  | `sanitize` | Redact secrets + neutralize IPI phrases | `text`, `sanitize?` |
113
- | `rerank` | BM25-rank candidates / chunks for a query | `query`, `items` or `text` or chunk `map`, `rerank?` |
114
- | `brief` | Scan a workspace for task-relevant slices; pack a starter briefing + cache key | `query`, `brief?` (`root`, caps), optional `text` hint |
119
+ | `rerank` | BM25 (+ optional loopback embeddings) rank candidates / chunks | `query`, `items` or `text` or chunk `map`, `rerank?` |
120
+ | `brief` | Scan a workspace; pack a structured starter briefing + cache key | `query`, `brief?` (`root`, caps), optional `text` hint |
121
+ | `catalog` | Short action (+ playbook) ads; prefer before guessing | _(none)_ |
122
+ | `help` | Usage notes for one action (default **compressed**; `force: true` → full) | `id`, `force?` |
123
+ | `playbooks` | List playbook ads | _(none)_ |
124
+ | `playbook` | Load one playbook body | `id` |
125
+ | `pack` | Zip text/files into a bounded archive | `text` or `items`, `pack?` |
126
+ | `unpack` | Unpack zip with size caps into chunks (never runs scripts) | `text` or `key`, `pack?` |
127
+ | `llm_status` | Probe configured local LLM (models; `force` = chat ping) | `force?` |
128
+
129
+ ### Progressive disclosure (skills)
130
+
131
+ Tool description/instructions stay thin. Discover details on demand:
132
+
133
+ - **Tool bridge:** `action=catalog` → `action=help` with `id`, or `playbooks` → `playbook`
134
+ - **MCP resources:** `resources/list` / `resources/read` on:
135
+ - `cmp://skill/index` — JSON index of actions + playbooks
136
+ - `cmp://skill/action/{name}` — full action help (markdown)
137
+ - `cmp://skill/playbook/{id}` — playbook body
138
+
139
+ Bundled playbooks live under [`playbooks/`](playbooks/). Override/extend with `COMPENDIUM_PLAYBOOKS_DIR` (same `id` wins). Archives honor `COMPENDIUM_ARCHIVE_MAX_BYTES` / `_UNCOMPRESSED` / `_FILES` (defaults 2 MiB / 4 MiB / 50).
115
140
 
116
141
  Optional on most text actions: `sanitize_input: true` scrubs before processing. Soft payloads under `COMPENDIUM_SIGNAL_MIN_CHARS` (default 1000) bypass `compress` / `summarize` / `summarize_smart` unless `force: true`.
117
142
 
118
143
  `filter` accepts optional `query` (top-level or `filter.query`) for BM25 line keep. `prune_history` supports `prune.strategy: "afm"` (Critical / Thematic / Distant tiers; distant blob cached for `cache_get`).
119
144
 
120
- `brief` walks `brief.root` (default: process cwd) with `.gitignore` / `.ignore` via the `ignore` crate, BM25-ranks paths and chunks for `query`, then returns a compact `briefing` plus `cache_key` (`cache://brief/…`, also stored in the session cache). Use that briefing to start a fresh agent turn without pasting the whole repo. Optional `COMPENDIUM_BRIEF_ROOT` restricts allowed roots (useful for HTTP). Briefings are sanitized by default.
145
+ `brief` walks `brief.root` (default: process cwd) with `.gitignore` / `.ignore`, BM25-ranks paths/chunks, window-reads oversized files (not head-truncate), and returns a structured `briefing`: **Task / Status / Evidence / Caveats / Sources / Read next**, plus `cache_key`. Status uses a local SLM when `COMPENDIUM_LOCAL_LLM_URL` is set (`backend: local_llm`); otherwise heuristic bullets. Caveats flag truncated files and docs older than selected code. **Read next** includes source paths plus suggested `cmp://skill/playbook/…` / action URIs. Optional `COMPENDIUM_BRIEF_ROOT` restricts allowed roots. Briefings are sanitized by default.
121
146
 
122
147
  Example:
123
148
 
@@ -134,14 +159,15 @@ Response envelope: `{ "ok": true, "action": "filter", "result_json": "{...}" }`.
134
159
  ## Project layout
135
160
 
136
161
  ```
137
- package.json / bin/run.js # npm wrapper for npx compendium-mcp
138
- npm/ # platform packages + distribution docs
139
- .github/workflows/ # release cross-compile + npm publish
162
+ assets/ # brand mark (SVG/PNG); baked into MCP icons via data URI
163
+ docs/ # architecture notes
164
+ examples/ # sample MCP tool-call JSON payloads
140
165
  src/
141
166
  main.rs # CLI: stdio | http
142
167
  lib.rs
168
+ brand.rs # SEP-973 icons for serverInfo + tool
143
169
  config.rs # COMPENDIUM_* env config
144
- server.rs # MCP tool handlers (rmcp macros)
170
+ server.rs # MCP tool + resources handlers (rmcp)
145
171
  http.rs # Streamable HTTP/SSE (feature = "http")
146
172
  pipeline/
147
173
  tokens.rs # heuristic or tiktoken BPE (feature = "real-tokens")
@@ -151,13 +177,19 @@ src/
151
177
  smart.rs # summarize_smart + filter_relevant
152
178
  local_llm.rs # OpenAI-compatible local SLM client
153
179
  chunk.rs # chunk + resolve
154
- cache.rs # session key/value cache
180
+ cache.rs # session key/value cache (+ optional disk)
181
+ catalog.rs # action ads + help (progressive disclosure)
182
+ playbook.rs # bundled / dir playbooks
183
+ pack.rs # zip pack/unpack with size caps
155
184
  stats.rs # session savings counters
156
185
  prune.rs # conversation history pruning
157
186
  output.rs # domain-aware compress_output
187
+ playbooks/ # embedded skill-md playbooks
158
188
  tests/
159
189
  integration.rs
160
- e2e_smoke.rs # spawns binary, MCP handshake, all tools
190
+ e2e_smoke.rs # spawns binary, MCP handshake, tools + resources
191
+ CHANGELOG.md
192
+ REPORT.md # design essay + Shipped/Next/Deferred roadmap
161
193
  ```
162
194
 
163
195
  ## Build
@@ -235,10 +267,20 @@ Point an MCP streamable-HTTP client at that URL (e.g. `StreamableHttpClientTrans
235
267
  | `COMPENDIUM_HTTP_BIND` | `127.0.0.1:8788` | Default HTTP listen address |
236
268
  | `COMPENDIUM_LOCAL_LLM_URL` | _(unset)_ | OpenAI-compatible base URL (e.g. `http://127.0.0.1:11434/v1` or `http://127.0.0.1:13305/api/v1`). Enables smart actions. |
237
269
  | `COMPENDIUM_LOCAL_LLM_MODEL` | `Qwen3-4B-GGUF` | Model id on that server (Ollama: e.g. `qwen:latest`) |
270
+ | `COMPENDIUM_LOCAL_EMBED_MODEL` | _(same as chat)_ | Embeddings model for hybrid `rerank` / `brief` (e.g. `nomic-embed-text`) |
271
+ | `COMPENDIUM_HYBRID_ALPHA` | `0.55` | BM25 weight in hybrid score (0–1); remainder is embedding cosine |
272
+ | `COMPENDIUM_AUDIT_PATH` | _(unset)_ | Append-only JSONL audit log (action metadata only; no payloads) |
238
273
  | `COMPENDIUM_LOCAL_LLM_API_KEY` | _(unset)_ | Optional bearer token for locked loopback servers |
239
274
  | `COMPENDIUM_LOCAL_LLM_TIMEOUT_SECS` | `120` | HTTP timeout (first model load can be slow) |
240
275
  | `COMPENDIUM_SIGNAL_MIN_CHARS` | `1000` | Bypass compress/summarize below this length (`0` disables) |
241
276
  | `COMPENDIUM_BRIEF_ROOT` | _(unset)_ | When set, `action=brief` may only scan roots under this canonical path |
277
+ | `COMPENDIUM_PLAYBOOKS_DIR` | _(unset)_ | Extra/override playbook `*.md` directory (same `id` replaces embedded) |
278
+ | `COMPENDIUM_ARCHIVE_MAX_BYTES` | `2097152` | Max compressed archive size for pack/unpack |
279
+ | `COMPENDIUM_ARCHIVE_MAX_UNCOMPRESSED` | `4194304` | Max total uncompressed bytes for pack/unpack |
280
+ | `COMPENDIUM_ARCHIVE_MAX_FILES` | `50` | Max files per archive |
281
+ | `COMPENDIUM_SKILL_TTL_MS` | `300000` | Soft TTL (ms) on skill `resources/read` responses |
282
+ | `COMPENDIUM_CACHE_DIR` | _(unset)_ | Persist session cache (chunks/cache keys) across restarts; default size cap 64 MiB |
283
+ | `COMPENDIUM_CACHE_MAX_BYTES` | _(unset / 64MiB with dir)_ | Soft cap on total cached payload bytes |
242
284
  | `RUST_LOG` | `compendium=info` | Logs on **stderr** only |
243
285
 
244
286
  ## Example tool calls
@@ -319,7 +361,7 @@ Without `COMPENDIUM_LOCAL_LLM_URL`, `summarize_smart` / `filter_relevant` automa
319
361
  }
320
362
  ```
321
363
 
322
- Start the new turn with the returned `briefing` (or `cache_get` the `cache_key`). The host should not paste the whole tree into the prompt first.
364
+ Start the new turn with the returned `briefing` (or `cache_get` the `cache_key`). The host should not paste the whole tree into the prompt first. Treat Status as a starter synthesis — verify Caveats and Read next before large edits.
323
365
 
324
366
  ## Local small language model
325
367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compendium-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server that compresses, summarizes, and filters context to minimize LLM token usage",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -38,11 +38,11 @@
38
38
  "prepare": "node npm/scripts/link-bins.js"
39
39
  },
40
40
  "optionalDependencies": {
41
- "compendium-mcp-darwin-arm64": "0.1.2",
42
- "compendium-mcp-darwin-x64": "0.1.2",
43
- "compendium-mcp-linux-x64": "0.1.2",
44
- "compendium-mcp-linux-arm64": "0.1.2",
45
- "compendium-mcp-win32-x64": "0.1.2"
41
+ "compendium-mcp-darwin-arm64": "0.2.0",
42
+ "compendium-mcp-darwin-x64": "0.2.0",
43
+ "compendium-mcp-linux-x64": "0.2.0",
44
+ "compendium-mcp-linux-arm64": "0.2.0",
45
+ "compendium-mcp-win32-x64": "0.2.0"
46
46
  },
47
47
  "preferUnplugged": true
48
48
  }