Deterministic Model Context Protocol (MCP) server for Lean 4 proof analysis, automation probing, proof validation, and theorem context extraction.
- Package/server version:
0.4.0 - Tool API version in response envelopes:
1.1.0
| Tool | Purpose | Status values |
|---|---|---|
scan_file |
Static theorem-level analysis for one Lean file | success, fail |
scan_theorem |
Deep analysis for one theorem target | success, fail |
rank_targets |
Objective-based ranking and tiering | success, fail |
verify |
Lean validation for file/theorem scope | success, fail, timeout, error |
probe |
Single-theorem automation probe (aesop, aesop?, grind) |
success, fail, timeout, error |
probe_file |
Batch probe across theorem set | success, partial, error |
search_automated_proof |
Hint-set search for automated proofs | success, partial, fail, error |
try_automated_proof |
Validate a concrete proof attempt | success, rejected, incomplete, timeout, error |
get_proof_context |
Extract statement/proof/scope/similar-proof context | success, fail, error |
- Python
>=3.10 uv- Lean 4 project/toolchain for runtime tools (
verify,probe,search_automated_proof,try_automated_proof)
uv sync --dev
uv run pre-commit install
uv run pytest
uv run mypy .
uv run ruff check .
uv run ruff format .uv run lean-proof-auto-mcpOptional environment variables:
LPAMCP_SERVER_NAMELPAMCP_API_VERSIONLPAMCP_WORKING_DIR
- Discover and triage with
scan_fileandrank_targets. - Inspect one target with
scan_theorem. - Measure baseline automation with
probeorprobe_file. - Pull theorem context with
get_proof_context. - Search candidate automation with
search_automated_proof. - Validate candidate scripts with
try_automated_proof. - Run final check with
verify.
scan_file:
{
"tool": "scan_file",
"arguments": {
"file": "Mathlib/Data/List/Basic.lean"
}
}rank_targets:
{
"tool": "rank_targets",
"arguments": {
"file": "Mathlib/Data/List/Basic.lean",
"objective": "balanced",
"limit": 30
}
}try_automated_proof:
{
"tool": "try_automated_proof",
"arguments": {
"file": "Mathlib/Data/List/Basic.lean",
"theorem_id": "List.append_nil",
"proof_attempt": "by aesop",
"timeout_s": 10.0
}
}- Tool responses are normalized and deterministic, with
statusandapi_version. - Lean server instances are reused by project root.
- Harness-based tools use range-based source splicing (
RangeBasedHarnessConstructor).
- Provider modes supported by adapters:
none,worktree,temp. - Current auto-detection resolves to
nonein runtime adapters. - In current composition roots, workflows run against project root unless wiring is changed to explicitly pass
temp/worktree. verifyaccepts aworkspace_modeargument at the tool boundary, but current composition-root wiring still uses auto-detected mode.
Heuristics configuration source priority:
config_pathrequest parameterLEAN_PROOF_AUTO_MCP_CONFIGenvironment variable- Built-in defaults
See docs/docs/configuration.md for full schema and parameter ranges.
- Overview:
docs/docs/overview.md - Tool runtime hub:
docs/docs/mcp/README.md - Tool contract:
docs/docs/mcp/tool_contract.md - Tool pages:
docs/docs/mcp/tools/ - Architecture:
docs/docs/architecture/system_overview.md - Workspace modes:
docs/docs/workspace_modes.md - Workflow:
docs/docs/workflows/interactive_user_flow.md - Requirements:
docs/docs/requirements/functional.md
If you use this project in academic work, cite CITATION.cff.
MIT. See LICENSE.