经 AI Skill Hub 精选评估,精简上下文工具 获评「强烈推荐」。已获得 1.7k 颗 GitHub Star,这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
MCP开源工具,专为AI编程优化token使用效率。通过智能上下文管理,减少Cursor、Claude Code等AI编码工具的token浪费。适合追求成本效益的AI开发者和编程爱好者。
精简上下文工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
MCP开源工具,专为AI编程优化token使用效率。通过智能上下文管理,减少Cursor、Claude Code等AI编码工具的token浪费。适合追求成本效益的AI开发者和编程爱好者。
精简上下文工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/yvgude/lean-ctx
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"-------": {
"command": "npx",
"args": ["-y", "lean-ctx"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 精简上下文工具 执行以下任务... Claude: [自动调用 精简上下文工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"_______": {
"command": "npx",
"args": ["-y", "lean-ctx"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
██╗ ███████╗ █████╗ ███╗ ██╗ ██████╗████████╗██╗ ██╗ ██║ ██╔════╝██╔══██╗████╗ ██║ ██╔════╝╚══██╔══╝╚██╗██╔╝ ██║ █████╗ ███████║██╔██╗ ██║ ██║ ██║ ╚███╔╝ ██║ ██╔══╝ ██╔══██║██║╚██╗██║ ██║ ██║ ██╔██╗ ███████╗███████╗██║ ██║██║ ╚████║ ╚██████╗ ██║ ██╔╝ ██╗ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
curl -fsSL https://leanctx.com/install.sh | sh # universal (no Rust needed) brew tap yvgude/lean-ctx && brew install lean-ctx # macOS / Linux npm install -g lean-ctx-bin # Node.js cargo install lean-ctx # Rust pi install npm:pi-lean-ctx # Pi Coding Agent
from lean_ctx import compress messages = compress(messages, model="claude-sonnet-4")
ts // npm install lean-ctx-sdk import { compress } from "lean-ctx-sdk"; messages = await compress(messages, { model: "gpt-4o" });
Framework adapters included (LiteLLM, LangChain, Vercel AI SDK). → **[compress() cookbook](docs/guides/compress-sdk.md)**
**Thin `/v1` contract clients — [`lean-ctx-client`](https://pypi.org/project/lean-ctx-client/) ([npm](https://www.npmjs.com/package/lean-ctx-client) · [crates.io](https://crates.io/crates/lean-ctx-client)).** Wrap the full `/v1` tool, event and session API over the process boundary — never links the engine, so it stays stable as lean-ctx evolves.
bash pip install lean-ctx-client # Python (imports as leanctx) npm install lean-ctx-client # TypeScript / Node cargo add lean-ctx-client # Rust ```
Start the server with lean-ctx serve, then point a client at it. → API reference
One command removes everything — it stops all processes, then deletes hooks, editor configs, rules, autostart (LaunchAgent/systemd), the data dir, and the binary itself:
lean-ctx uninstall # full clean removal
lean-ctx uninstall --dry-run # preview every change, write nothing
lean-ctx uninstall --keep-config # keep MCP configs + rules (for reinstall)
lean-ctx-off # or just disable for the current shell session
No binary on PATH (or you used the curl installer)? Run the same removal from the installer:
curl -fsSL https://leanctx.com/install.sh | sh -s -- --uninstall
If you installed via a package manager, uninstall removes everything it wrote and tells you the one command to finish removing the binary:
brew uninstall lean-ctx # Homebrew
cargo uninstall lean-ctx # cargo install
npm uninstall -g lean-ctx-bin # npm
pi uninstall npm:pi-lean-ctx # Pi Coding Agent
Try these in any repo:
lean-ctx read rust/src/server/mod.rs -m map
lean-ctx -c "git log -n 5 --oneline"
lean-ctx gain --live
lean-ctx dashboard # Context Manager (browser)
lean-ctx watch # TUI monitor
lean-ctx benchmark report .
demo/vhs demo/leanctx.tape
vhs demo/gain.tape
vhs demo/benchmark.tape
<a id="benchmarks"></a>
Beyond the CLI, lean-ctx ships published libraries so you can call it directly from your app.
Drop-in prompt compression — lean-ctx-sdk (npm). Compress a chat-style messages array before it reaches any model — deterministic and prompt-cache friendly; images, tool-calls and ids pass through untouched.
```python
"I want to read everything."
Every command and all 80 MCP tools, organized as user journeys, plus appendices for the CLI map, MCP tools, and paths & config. → Reference index
</td> </tr> </table>
精品MCP工具,解决AI编程实际痛点。Rust实现性能可靠,活跃维护,1.7k星说明认可度高,实用价值突出。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
AI Skill Hub 点评:精简上下文工具 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | lean-ctx |
| 原始描述 | 开源MCP工具:The Context OS for AI Development. Reduce token waste in Cursor, Claude Code, Co。⭐1.7k · Rust |
| Topics | MCP协议Token优化AI编程上下文管理Cursor插件 |
| GitHub | https://github.com/yvgude/lean-ctx |
| License | Apache-2.0 |
| 语言 | Rust |
收录时间:2026-05-16 · 更新时间:2026-05-19 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端