A previous release had provenance metadata, but this release does not. View details.
LeanProbe
Fast Lean 4 proof feedback for AI agents — an MCP server, CLI, and Python API.
LeanProbe keeps a Lean REPL warm and reuses the elaborated environment, so
repeated checks in a file come back in tens of milliseconds instead of the
seconds a fresh lake build or lake env lean costs. It never edits files —
run lake build as the final whole-project gate. Built on
LeanInteract.
Quickstart
Install (the MCP server is included):
pip install lean-probe # or run with no install: uvx lean-probe mcp
Add it to Claude Code:
claude mcp add lean-probe --env LEAN_PROBE_AUTO_BUILD=0 -- lean-probe mcp
Now ask the agent to check Lean — e.g. "use lean_check on theorem t : 2 + 2 = 4 := by norm_num". Or straight from the terminal:
lean-probe check --cwd /path/to/lake-project --code "example : 2 + 2 = 4 := rfl"
That is the whole regular setup — pip install lean-probe is fully functional on
its own and writes nothing outside its own package.
Optional — install the usage skill. So your agents know the LeanProbe tool
contract without you pasting it, you can additionally install it as a skill. It
ships inside the wheel (no repo clone), and this step is purely opt-in — a plain
pip install never touches ~/.claude or ~/.codex:
lean-probe install-skill # → ~/.claude/skills + ~/.codex/skills (whichever exist)
This drops the LeanProbe skill into each present
client as skills/lean-probe/SKILL.md. Use --client claude|codex to force one,
--skills-dir PATH for a project-local .claude/skills, or --dry-run to preview.
The skill only documents the tools — keep the claude mcp add / Codex config above
so the lean-probe MCP server is actually connected.
Requirements
- Python 3.10+.
- Lean 4 + Lake via elan, with
lakeonPATH(or setLEAN_PROBE_LAKE_PATH). - A built Lake project to check against (with Mathlib if your code imports it).
The first call boots the REPL and elaborates imports (tens of seconds for
Mathlib); after that, checks are sub-second — call lean_status with
warm=true to pay that cost up front. Keep LEAN_PROBE_AUTO_BUILD=0 for MCP
clients: build output on stdout would corrupt the JSON-RPC stream, so build the
project from a terminal first.
Add to other clients
Codex (~/.codex/config.toml):
[mcp_servers.lean-probe]
command = "lean-probe"
args = ["mcp"]
tool_timeout_sec = 600 # the first Mathlib call is slow
[mcp_servers.lean-probe.env]
LEAN_PROBE_AUTO_BUILD = "0"
Any MCP client (generic mcpServers JSON):
{
"mcpServers": {
"lean-probe": { "command": "lean-probe", "args": ["mcp"], "env": { "LEAN_PROBE_AUTO_BUILD": "0" } }
}
}
If the client launches the server outside your environment, use an absolute path
to lean-probe, or "command": "uvx", "args": ["lean-probe", "mcp"].
Tools
On connect the server advertises usage instructions and exposes six tools:
| Tool | Purpose |
|---|---|
lean_check |
Verify any standalone snippet — the default. |
lean_check_target |
Check or replace a declaration in a project file (warm, sub-second). |
lean_status |
Readiness; warm=true pre-boots the REPL. |
lean_proof_state · lean_tactic · lean_close_proof |
Explore a sorry tactic by tactic. |
Read a result with two fields: success = the tool ran; ok = Lean
accepted the code (no errors, no sorry). On failure, error_code + hint say
what to do next. See the LeanProbe skill for the
full contract — parameters, feedback_lean, and every error code.
Without MCP
CLI:
lean-probe status --cwd /path/to/lake-project
lean-probe check-target File.lean my_theorem --cwd /path/to/lake-project --pretty
Python:
from lean_probe import LeanProbe
probe = LeanProbe()
result = probe.check_target("File.lean", theorem_id="my_theorem", cwd="/path/to/lake-project")
print(result["ok"], result["elapsed_s"])
Benchmarks
Warm cached checks run in tens of milliseconds versus roughly 2–4s for a full-file Lake check — about 9–14× faster for sequential same-file work. See BENCHMARKS.md for methodology and full numbers.
More
- SKILL.md — the full MCP contract (using
LeanProbe), installable into agents with
lean-probe install-skill. - AGENTS.md — the contributor guide (working on this repo).
- BENCHMARKS.md — benchmark methodology and results.
- CONTRIBUTING.md — dev setup and checks.
Metadata
Release files for lean-probe 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lean_probe-0.4.0.tar.gz | 54.8 kB | Without provenance | Details for lean_probe-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lean_probe-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for lean_probe-0.4.0-py3-none-any.whl |
Total release size: 102.1 kB
Release files / lean_probe-0.4.0.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | lean_probe-0.4.0.tar.gz |
|---|---|
| Size | 54.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
648159fb24afd3804720dcda3313a496b310827496f81e984d7aad867209198b
|
|
BLAKE2b-256 checksum How to use checksums |
daf258c44b1252d00cbf4f7e363c8466ec8da7ec3e6f79676c1657dfdbf9ac72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / lean_probe-0.4.0-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | lean_probe-0.4.0-py3-none-any.whl |
|---|---|
| Size | 47.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8326049c38ed8d4a737b6536166ed64e5a79b63a3079e490601dc1065a087bc
|
|
BLAKE2b-256 checksum How to use checksums |
091e69a36ed36803c943e8e8ee1b80c57564657ad487b3e04e38d7475f8a0d23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for lean-probe 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.3.1 2 files With provenance
- Added 0.4.0 2 files Without provenance
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.