MCP 服务器

58 个压缩工具。
零配置。

lean-ctx 实现了 Model Context Protocol(MCP)--AI 工具集成的开放标准。内置工具获得压缩感知的替代品,在噪音到达 LLM 之前将其去除。

58 个工具 10 种读取模式 99% 最大值(缓存重新读取)
协议

这就是 MCP 的工作原理。

Model Context Protocol 允许 AI 工具调用外部服务器获取数据。lean-ctx 拦截这些调用并自动压缩响应。

AI 工具

Cursor、Claude Code、Crush、Copilot……

lean-ctx MCP

自动压缩数据

LLM

只看到信号,没有噪音

58 个工具,4 个类别

你的 AI 所需要的。

文件与代码

高达 99% 节省

文件读取、目录探索、shell 命令和代码搜索的核心替代品。tree-sitter 驱动的 AST 压缩保留结构同时消除噪音。

ctx_read ctx_multi_read ctx_tree ctx_shell ctx_search

自主智能

自配置,零设置

自主运行:自动预加载上下文、文件去重、提供相关文件提示并选择最佳压缩--所有操作无需显式命令。默认启用。

ctx_smart_read ctx_delta ctx_fill ctx_intent ctx_context ctx_graph ctx_dedup ctx_response ctx_discover ctx_impact ctx_architecture

Claude Code Integration

lean-ctx detects Claude Code and automatically adapts its behavior to work within Claude's constraints:

  • Auto-condensed instructions - MCP instructions are compressed to <2048 characters for Claude Code's truncation limit
  • Full rules file - Complete instruction set installed to ~/.claude/rules/lean-ctx.md (no character cap)
  • Agent Skills - Auto-installed to ~/.claude/skills/lean-ctx/ with setup script for zero-config onboarding
  • Self-healing env.sh - Shell environment is re-injected if Docker or container rebuilds remove it
zero-config, self-healing

会话与监控

跨对话记忆

持久化会话状态、上下文检查点和实时分析。追踪 token 节省、管理缓存并生成压缩报告。

ctx_session ctx_compress ctx_analyze ctx_gain ctx_benchmark ctx_metrics ctx_wrapped ctx_cache ctx_heatmap ctx_cost
  • ctx_gain - Query token savings, cost breakdowns, GainScore, task classifications, and per-agent statistics programmatically during a session

记忆与多智能体

持久化项目知识

构建跨会话和智能体持久的知识库。项目级记忆、智能体协调和代码库概览。

ctx_knowledge ctx_agent ctx_overview ctx_preload ctx_task ctx_share
ctx_read

10 read modes, 适应每种场景。

不是每次文件读取都需要完整内容。选择匹配你意图的模式--或让 ctx_smart_read 自动选择。

模式 返回内容 何时使用
auto 最适合上下文的模式 默认:lean-ctx 会根据文件类型、大小与任务选择最优策略
full 完整文件,缓存用于重新读取(约 13 个 token) 你将要编辑的文件
map 依赖图 + 导出 + 关键签名 需要理解的仅上下文文件
signatures 仅 API 接口--函数签名、类型 理解接口和契约
diff 仅与缓存版本的变更行 编辑后--验证你的更改
aggressive 去除语法,最大压缩 需要概要的大文件
entropy Shannon + Jaccard 过滤的独特内容 查找非重复、高信息量的行
task 基于知识图谱的任务感知内容过滤,包含依赖上下文 读取与特定任务相关的文件 - 使用项目图谱 + IB 过滤器
reference 交叉引用上下文 目标符号的相关类型、调用方与依赖关系
lines:N-M 仅读取第 N 到第 M 行(1 为起始,含端点) 大文件--读取特定范围
ctx_read server.rs --mode map
F1=server.rs [342L]
  deps: tokio, serde, tower, axum
  exports: start_server, AppState, Config
  API:
    §  AppState { db: Pool, cache: Cache, config: Config }
    §  Config { port: u16, host: String, max_conn: usize }
    fn async start_server(config: Config) → Result<()>
    fn async handle_request(state: AppState, req: Request) → Response
    fn configure_routes(state: AppState) → Router
  [2,847 tok saved (93%)]
深入了解

详细探索每个 工具。

完整 API 参考,包含所有 58 个 MCP 工具的参数、示例和高级用法。