
Leanforge Mcp
io.github.sandraschiPublished by GitHub account sandraschiv0.1.1Updated Oct 24, 2026
Lean 4 theorem prover MCP: automated proof search, mathlib integration, job management
Overview
Local MCP server that runs AI-driven formal proof search in Lean 4, turning theorems with sorry placeholders into machine-verified proofs.
- What you can do
- Submit theorems or full Lean files with sorry placeholders and receive job IDs for asynchronous proof search
- Poll job status, list jobs, inspect per-agent attempt trajectories, and cancel running jobs
- Compile Lean 4 code directly and re-check proven files with verified kernels
- Search Mathlib theorems using natural language
- Shut the server down gracefully, cancelling live jobs
- When to use it
- Useful when you want an assistant to attempt formal proofs in Lean 4 and have results judged by the compiler, or to check whether a tactic proof compiles. Also suited to inspecting why a proof search is stuck and to finding relevant Mathlib lemmas.
- Requirements
- Runs locally over stdio as a Python package (Python 3.11+ or 3.12+ per the docs) with Lean 4 installed via elan and a Mathlib workspace with cached oleans (about 4GB, one-time setup). Tier-1 uses a local Ollama model; higher tiers need DEEPSEEK_API_KEY or ANTHROPIC_API_KEY. Configuration lives in config.toml; optional web backend and frontend run on local ports.
Installation
In SourceWeft
- Open Leanforge Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: README.md at commit f3fece6
Tools
0Version history
2- v0.1.1LatestOct 19, 2026
- v0.1.0Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts