
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 分