lean-plugin
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@lean-plugin Check Lean diagnostics for Mathlib/Basic.lean in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Lean plugin
Run Lean file diagnostics and verify a Lake package through MCP stdio. The npm package provides the MCP adapter. It does not ship or download Lean, Mathlib, or project dependencies.
Configure the server
On Linux, install Bubblewrap at
/usr/bin/bwrapand provision the official Lean 4.36.0 Linux release. Use the unpacked release directory, not an elan shim.Prepare one approved Lake workspace and its manifest before allowing the adapter to run. Keep tokens, environment files, sockets, and unrelated source out of this workspace.
Install the package with Node.js 24 or later. Configure your MCP client to start the installed
lean-pluginexecutable with the following environment variables:LEAN_PLUGIN_PROJECT: Absolute path to the approved Lake workspace root.LEAN_PLUGIN_TOOLCHAIN: Absolute path to the unpacked Lean Linux release.
Lean core and Std are the verified default.
Mathlib support through the offline MCP is unverified.
The server runs Lake without network access and excludes .git metadata from
its workspace copy.
A prepopulated .lake/packages directory or build cache alone leaves dependency
resolution unverified.
The lake check phase defaults to 240 seconds.
To increase it, set LEAN_PLUGIN_LAKE_CHECK_TIMEOUT_SECONDS in the server's
startup environment to whole seconds from 240 to 600.
An invalid setting prevents the server from starting.
This setting does not change diagnostics or sandbox probe limits.
Configure the MCP client to wait longer than the selected limit plus 25 seconds
for the sandbox probes.
A server-side timeout returns unavailable.
For local editing, use elan and the official Lean 4 extension for VS Code. The server reports verification as unavailable when Linux isolation or the exact toolchain is missing; it does not run Lean directly as a fallback.
Related MCP server: mcp-bridge
Tools
lean_diagnostics: Pass a project-relative.leanpath asfile. Get Lake elaboration diagnostics, not a proof certificate.lean_verify: Pass an empty object. Get Lake's kernel replay and standard-axiom check for the default targets.
Both tools return status and output.
A failed result means Lean or Lake ran and rejected the input.
An unavailable result is not a proof failure and must not count as a pass.
An invalid_input result means the requested file is not eligible for
diagnostics.
Use the Lean skill already available in your agent environment for guidance on when to use each check and how to relate a proof to implementation behavior.
Available Tools
2 toolslean_diagnosticsC
Elaborate a project-relative Lean source file in the approved Lake workspace.
Inputs: file (required).
lean_verifyB
Run sandboxed Lake proof verification on the approved package's default targets.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: lean_diagnostics elaborates a specific source file, while lean_verify runs package-level proof verification. An agent can easily choose between them based on whether it needs file diagnostics or target verification.
Both tools use the same lean_ prefix and snake_case style, which is predictable. The only minor inconsistency is grammatical form: diagnostics is a noun while verify is a verb, but the pattern remains readable.
Two tools is thin for a Lean plugin, even a narrowly scoped one. It covers the two core operations but leaves little room for related workflows, making the count borderline.
The surface covers file elaboration and package verification, but notable gaps remain: no build/clean, no listing or reading files, and no way to verify a specific non-default target. Agents may be able to work around some of these, but the lifecycle is incomplete.
Maintenance
Related MCP Connectors
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
MCP server (stdio): lint OpenAPI specs with Spectral via the AgentForge API
MCP server (stdio): validate JSON against JSON Schema (draft-07 / 2020-12) via the AgentForge API
Scan AI agent skills, MCP server packages and MCP configs before you install them. Static analysis.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables verification of Lean 4 mathematical proofs via MCP tools, allowing AI clients to compile and check theorems with Mathlib.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to perform sandboxed file reads, writes, and listing, inspect credential-masked environment variables, check git status, and execute commands with strict timeouts over a clean stdio JSON-RPC channel.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to query locally installed language servers over stdio MCP for read-only code intelligence, including definitions, references, implementations, hover types, symbols, and diagnostics.9 npm1Apache 2.0

LeanWarpofficial
AlicenseNot gradedqualityBmaintenanceEnables MCP clients such as Claude Code, Codex and Cursor to check and verify Lean 4 proofs, inspect goals at a position, try tactics, list holes, and extract declarations against hosted Lean releases with pinned libraries. Edits are checked on warm remote workers that reuse Lean's work between calls, so agents can iterate on proofs against their intended statements.289 PyPI7MIT