LeanWarp — Claude Code MCP server: proof checking
The LeanWarp MCP server for Claude Code checks Lean 4 proofs and reports errors, warnings, and proof goals. An agent can call it while working on formal proofs in a Lean project.
MIT ★ 7 updated 2026-11-16
claude mcp add --env LEANWARP_API_KEY=<LEANWARP_API_KEY> --transport stdio leanwarp -- uvx leanwarpWhat LeanWarp does
LeanWarp checks Lean files and uses Lean's kernel to test whether a declaration proves a supplied statement. It can also show goals and local context at a proof position, test tactics, and locate sorry and ?_ holes. Batch operations cover files and inline proofs.
Lean and Mathlib run on hosted workers, so a local Lean installation is not required. Only .lean files are uploaded; libraries come from an environment with pinned versions. The service requires a LeanWarp API key and uvx. Create the key through the dashboard, and keep it out of agent conversations.
What it helps with
- check a Lean file for errors and warnings
- inspect proof goals and local context
- verify a declaration against a target statement
- locate
sorryand?_holes - test several tactics against one captured goal
Example prompts for the agent
- Check
Proofs.leanand report Lean errors. - Show the goals and local context at line 12 in
Proofs.lean. - Verify that
add_zero_exampleproves∀ n : Nat, n + 0 = n.
How to install LeanWarp
Platform CLI
claude mcp add --env LEANWARP_API_KEY=<LEANWARP_API_KEY> --transport stdio leanwarp -- uvx leanwarpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from leanwarp <command>
Platform CLI
codex mcp add leanwarp --env LEANWARP_API_KEY=<LEANWARP_API_KEY> -- uvx leanwarpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from leanwarp <command>
Config file
{
"mcpServers": {
"leanwarp": {
"command": "uvx",
"args": [
"leanwarp"
],
"env": {
"LEANWARP_API_KEY": "<LEANWARP_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from leanwarp <command>
Config file
{
"servers": {
"leanwarp": {
"type": "stdio",
"command": "uvx",
"args": [
"leanwarp"
],
"env": {
"LEANWARP_API_KEY": "<LEANWARP_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from leanwarp <command>
Platform CLI
gemini mcp add -e LEANWARP_API_KEY=<LEANWARP_API_KEY> leanwarp uvx leanwarpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from leanwarp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about LeanWarp
How do I install LeanWarp in Claude Code?
Run claude mcp add --env LEANWARP_API_KEY=<LEANWARP_API_KEY> --transport stdio leanwarp -- uvx leanwarp in a terminal. The LEANWARP_API_KEY environment variable is required.
What does LeanWarp do?
It checks Lean proofs, reports errors and goals, and uses Lean's kernel to verify declarations against target statements.
What does LeanWarp need to run?
It needs a LeanWarp API key and uvx. Lean and Mathlib run on LeanWarp's hosted workers, so Lean does not need to be installed locally.