
Leanforge Mcp
io.github.sandraschi由 GitHub 账号 sandraschi 发布v0.1.1更新于 Oct 24, 2026
Lean 4 theorem prover MCP: automated proof search, mathlib integration, job management
概览
本地 MCP 服务器,在 Lean 4 中进行 AI 驱动的形式化证明搜索,把带 sorry 占位符的定理变成机器验证的证明。
- 可以做什么
- 提交定理或含 sorry 占位符的完整 Lean 文件,获得异步证明搜索的任务 ID
- 轮询任务状态、列出任务、查看各智能体的尝试轨迹并取消运行中的任务
- 直接编译 Lean 4 代码,并用已验证内核复查已完成的证明文件
- 用自然语言检索 Mathlib 定理
- 优雅关闭服务器,同时取消正在运行的任务
- 适用场景
- 适合让助手尝试 Lean 4 形式化证明并由编译器判定结果,或检查某段策略证明能否编译。也适合排查证明搜索卡住的原因、查找相关的 Mathlib 引理。
- 运行要求
- 以 Python 包形式通过 stdio 在本地运行(文档中要求 Python 3.11+ 或 3.12+),需通过 elan 安装 Lean 4,并准备带缓存 oleans 的 Mathlib 工作区(约 4GB,一次性配置)。第一层使用本地 Ollama 模型,更高层需要 DEEPSEEK_API_KEY 或 ANTHROPIC_API_KEY。配置位于 config.toml;可选的 Web 后端与前端运行在本机端口。
安装
在 SourceWeft 中
- 打开 控制台中的 Leanforge Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
leanforge-mcp
[Python] [FastMCP] [Lean 4] [Mathlib] [License: MIT] [Status: Phase B complete] [AlphaProof Nexus]
MCP server for AI-driven formal proof search in Lean 4. Submit a theorem with sorry; get back a machine-verified proof. Implements Agent A from AlphaProof Nexus (DeepMind, May 2026).
Stack: Python 3.12+ . FastMCP 3.4+ . FastAPI . React/Vite . Tailwind . Zustand . Biome . Lean 4 / Mathlib
Table of Contents
What it does
Feed it a Lean 4 theorem with a sorry placeholder. It runs N parallel agents in a loop: the LLM proposes a proof edit, the Lean compiler judges it, errors feed back to the LLM. First agent to produce a sorry-free compile wins.
The compiler is the only oracle -- if it compiles without sorry, the proof is correct.
Quick Install
Then add to claude_desktop_config.json:
See INSTALL.md for the Lean + Mathlib workspace setup (~4GB, one-time -- already provisioned and verified on Goliath as of 2026-07-09).
What You Can Do
Tools
Requirements
- Python 3.11+
- Lean 4 via elan (
winget install leanprover.elan) - Mathlib workspace with cached oleans (~4GB, one-time setup -- see INSTALL.md)
- Ollama with
deepseek-prover-v2:7bfor tier-1 (local, free) - DeepSeek or Anthropic API key for tier-2/3 (optional)
Ports & configuration
Documentation
Roadmap
What each phase enables
A + B let you submit a theorem and get a proof back on the other end. It works, it's useful, but it's single-threaded, pays a full compile per turn, and has no spend controls -- Phase C closes those gaps.
D changes the game: N parallel agents means wall-clock time drops from "however long one LLM takes" to "however long the fastest of N LLMs takes." For hard theorems where the LLM wanders into dead ends, this is the difference between 5 minutes and 30 seconds.
E prevents the LLM from wasting compiles on obviously wrong tactics. Cheap to add (one extra LLM call per attempt) and the paper shows it improves solve rate by ~15 percentage points on Agent A alone.
F is the user-facing payoff: instead of staring at "status: running" and polling, you watch the LLM try tactics in real time, see which paths it abandoned, and understand why it eventually succeeded or failed.
G addresses the most common failure mode: the LLM writes a correct tactic for a lemma that doesn't exist in the current context. Premise selection (a small retrieval step before tactic generation) cuts this dramatically.
H is invisible but critical: as the LLM accumulates 10+ failed attempts, the error context grows past the model's window. Smart summarization keeps relevant signal without drowning the LLM in noise.
Full gap analysis: docs/ASSESSMENT_2026-06-24.md
License
MIT
来源:README.md,提交 f3fece6
工具
0版本历史
2- v0.1.1最新Oct 19, 2026
- v0.1.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分