ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที รีวิวและบัญชีผู้ใช้จะมาในขั้นถัดไป
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · อธิบายเป็นภาษาคน

distil

โดย munhqรุ่น 0.3.4i★ –iรันบนเครื่อง
ชื่อใน registryio.github.munhq/distil

ติดตั้ง

ภาพรวม

คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)

Context optimization for LLM agents: tool registry, result masking, budgeting, compaction.

สามเสาของ PopNx MCP

สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน

ใช้ทำอะไรได้

ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: ค้นข้อมูลและความจำของ AI

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ก่อนติดตั้ง

ต้องเตรียมก่อน

  • npmติดตั้ง Node.js (มีคำสั่ง npx) ในเครื่อง

คุณใช้แอปไหน

เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”

เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json

{
  "mcpServers": {
    "distil": {
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}

พิมพ์คำสั่งนี้ใน Terminal

claude mcp add distil -- npx -y @munhq/distil

เปิดใน Cursor

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json

{
  "mcpServers": {
    "distil": {
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

เปิดใน VS Code

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .vscode/mcp.json ของโปรเจกต์

{
  "servers": {
    "distil": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@munhq/distil"
      ]
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น

ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 6 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub munhq ซึ่งเป็นเจ้าของ repo

  • … ยังไม่ตรวจ

    ยังมีคนดูแล

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • … ยังไม่ตรวจ

    มีสัญญาอนุญาต (license)

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

เทียบกับตัวอื่นในหมวด ค้นข้อมูลและความจำของ AIi

  • ดาวมากกว่า 0% ของอีก 7249 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 35% ของอีก 7249 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 7249 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

distil ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.3.4) เข้า registry 2 เดือนที่ผ่านมา

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี Context7, Codebase Memory, Exa

ตัวที่ใช้แทนได้

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

Context7

โดย upstash

ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว

บนเครื่องหรือคลาวด์★ 64,224MITอัปเดต วันนี้
ติดตั้ง

Codebase Memory

โดย DeusData

Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.

รันบนเครื่อง★ 48,148MITอัปเดต 20 วันที่ผ่านมา
ติดตั้ง

Exa

โดย exa-labs

Connect AI agents to Exa for web search, content fetching, and multi-step research.

รันบนคลาวด์★ 5,213MITอัปเดต เดือนที่แล้ว
ติดตั้ง

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ

claude mcp add distil -- npx -y @munhq/distil

No account, no API key, nothing to configure. The package is a small wrapper that fetches the binary for your platform and verifies it against the published checksums; install.sh and a prebuilt binary remain for anyone without Node.


Cache writes are 2% of your tokens and 28% of your bill

That is not a claim, it is a measurement: 13,814 real agent sessions, 410,742 assistant turns, re-run on 2026-08-29. Every unique token in them was billed 550 times, because a request resends the whole history.

Which means the obvious move — compress the history — is usually the wrong one. Editing history invalidates the cached prefix from the edit onwards and converts reads at 0.1x into writes at 1.25x or 2.0x. You cannot compress your way out of context cost. You can only decline to admit tokens.

Every tool in this space publishes a savings percentage measured on its own fixtures. What none publishes is the denominator: what share of a real session it is allowed to touch, and what that share costs once prompt-cache pricing is applied. distil measures both on transcripts an agent actually wrote.

What is prior art, and what is not. The cache arithmetic below is not a discovery. Anthropic's context editing docs state that clearing tool results invalidates the cached prefix, and ship clear_at_least so a clear only fires when it is large enough to pay for that. The break-even rule is published too: on a 5-minute cache, cleared tokens times requests-before-the-next-clear must exceed 11.5 times the tokens you keep. The table in this README reproduces that rule exactly — it was derived independently, which is a check on the arithmetic, not a contribution.

The gap is empirical. Every source says to calibrate against your own workload, and none ships a way to do it or publishes what the values turn out to be. That is what this crate is for: measuring the numbers you need in order to choose clear_at_least, or to decide not to clear at all.

The full measurement

Measured 2026-08-29 over 13,814 local Claude Code transcripts — 410,742 assistant turns, 212.7M tokens of unique text. Reproduce it on your own corpus with distil-bench ~/.claude/projects; a corpus grows, so the date matters more than the decimals.

tokensshare
tool results127,371,43059.9%
tool calls38,065,12117.9%
user text29,818,53614.0%
assistant text15,402,0777.2%
thinking2,076,7161.0%

Those 212.7M unique tokens were billed as 116.9 billion input tokens — every token paid for 550 times, because a request resends the whole history.

Price that at real cache multipliers (read 0.1x, write 1.25x for the 5-minute TTL and 2.0x for the 1-hour):

share of tokensshare of cost
cache read97.9%71.8%
cache writes2.0%27.6%

Cache writes are 2% of the tokens and 28% of the bill. Editing history invalidates the cached prefix from the edit onwards, converting reads at 0.1x into writes at 1.25x or 2.0x. So a rewrite must shrink what it invalidates below:

turns remaining5m TTL1h TTL
18.0%5.0%
1046.5%34.5%
2063.5%51.3%
10089.7%84.0%

That table is the published break-even rule in another form: at every row, cleared x turns / kept equals 11.5 for the 5-minute tier. Use it to pick a clear_at_least value, and use distil-bench to find the turn count and tail size to put into it — those are workload properties, and they are the part nobody publishes.

Per unit of history, at 10 remaining turns: keeping it costs 1.00, compressing it costs 2.15, and never admitting it costs 0. You cannot compress your way out of context cost. You can only decline to admit tokens.

What that means for using this crate

Layers that do not touch history are on the right side of that arithmetic: CacheAlignLayer (orders content so the stable prefix stays cacheable) and ScratchpadLayer (keeps working state outside the window).

Layers that rewrite history — MaskingLayer, SummarizationLayer, CompactionLayer — cost more than they save in the common case. Reach for them at one boundary only: context overflow, where the alternative is a failed request and cache price stops being the comparison. BudgetLayer exists for exactly that moment.

RegistryLayer and CodeModeLayer predate Anthropic's Tool Search Tool and Programmatic Tool Calling, which do the same jobs natively and better. Prefer the native features.

For clearing old tool results, prefer the provider's clear_tool_uses context editing over MaskingLayer: it runs server-side, it takes clear_at_least, and it is one API parameter against a dependency. Reach for a layer here only when you need behaviour the API does not offer.

Measuring

cargo build --features bench --release

Where tokens are, what they cost, and the break-even table

./target/release/distil-bench ~/.claude/projects --json baseline.json

Sessions that called a given tool, against those that did not

./target/release/distil-bench ~/.claude/projects --split-by-tool mcpcodeindex

Export real traffic so other compressors run on the same input

./target/release/distil-bench ~/.claude/projects --export-sessions ./sessions --min-turns 40

See bench/README.md for the external-tool comparison, the fairness rules, and the two harness mistakes that produced wrong numbers first.

Retention

A saving is only a saving if the model can still answer what the original context could answer.

# No LLM judge: file paths checked against ground truth from the transcript

python bench/artifact_retention.py ./sessions 12

LLM-graded probes (recall / artifact / continuation / decision)

cargo build --features probe --release ./target/release/distil-probe --probes 6 --model qwen2.5:3b

The probe taxonomy is Factory.ai's; their write-up defines it and ships no harness. The judge is a Completer, never a Summarizer — a summarizer may impose summarization framing, which rewrites both the probe format and the grading instruction.

Using it as a library

use distil::{CacheAlignLayer, Ctx, EstimateCounter, Pipeline};

let pipeline = Pipeline::builder() .counter(EstimateCounter) .layer(CacheAlignLayer::generic()) .build();

let mut ctx = Ctx::new(messages, tools, turn); let result = pipeline.optimize(&mut ctx); println!("{result}");

This example is kept compilable as examples/readme_quickstart.rs — run it with cargo run --example readme_quickstart.

Every layer implements Layer and reports tokens_before, tokens_after and a detail line, so each one can be measured on its own.

Features

featurewhat it adds
corpustranscript loader (no extra dependencies)
benchdistil-bench, needs tiktoken
probedistil-probe, needs proxy for the HTTP judge
tiktokenaccurate BPE counts instead of the chars/3.5 estimate
proxydistil-proxy HTTP server
mcpdistil-mcp MCP server
metricsPrometheus /metrics

Install

./install.sh                       # binaries, the skill, and the MCP server

/plugin marketplace add munhq/distil /plugin install distil # Claude Code: skill and server in one step

install.sh installs both binaries, drops the skill into every Claude home it finds, and registers the MCP server at user scope. When the plugin is already installed it installs the binary only, since the plugin declares the server and ships the skill itself.

The plugin launches the server with npx -y @munhq/distil, so it needs Node. It cannot use a plugin-relative path: Claude Code expands ${CLAUDE_PLUGIN_ROOT} and nothing else does, so a plugin declaring one hands every other client a literal path that does not exist. install.sh and the prebuilt binaries remain for anyone without Node.

Platform support
platformbinariesscripts
Linux x86_64 / arm64released, testedyes
macOS x86_64 / arm64released, built in CIyes
Windows x86_64 / arm64released, built in CIneeds a shell: Git Bash, MSYS2 or WSL

The release publishes six targets and plugin/test_platform.sh holds both the installer and the plugin launcher to that matrix, so an asset name and the name asked for cannot drift apart. install.sh and the launcher are bash scripts, so on Windows they need a shell — cmd and PowerShell cannot run them. Linux binaries are static musl builds, so they do not need a matching glibc.

Caveats

The corpus is one developer's machine. The ratios are the finding; the absolute totals are personal. Counts use cl100k_base, which approximates Claude's tokenizer within a few percent. The break-even model assumes a single cache breakpoint, so a rewrite confined to the tail costs less than the table shows — that refines it, it does not reverse it.

Contributing

Build and test instructions, the rules a benchmark change has to follow, and what a pull request needs before review: CONTRIBUTING.md. Report a vulnerability privately — SECURITY.md.

License

MIT. See LICENSE.

ถาม PopNx