servers / lean-lsp-mcp

lean-lsp-mcp

communitystdiolocalwrite capablehealthy

Lean Theorem Prover MCP


01Tools · 23

How to read this: tool names here are observed from a live tools/list handshake. The Risk label is a heuristic inferred from the tool name (write/destructive verbs), not from executing the tool — a conservative guess, not a verified capability. We never escalate risk from a description. Found one that's wrong? Tell us — we fix on report.

ToolRiskSide effectsApproval
lean_file_outline
Get imports and declarations with type signatures. Token-efficient.
readfalseunknown
lean_term_goal
Get the expected type at a position.
readfalseunknown
lean_references
Find all references to a symbol (including the declaration). Position cursor at the symbol.
readfalseunknown
lean_build
Build the Lean project and restart LSP. Use only if needed (e.g. new imports).
unknownunknownunknown
lean_code_actions
Get LSP code actions for a line. Returns resolved edits for TryThis suggestions (simp?, exact?, apply?) and other quick fixes.
readfalseunknown
lean_declaration_file
Get the source of a symbol's declaration (declaration slice + context). Set full_file=True for the whole file (can be very large).
readfalseunknown
lean_hover_info
Get type signature and docs for a symbol. Essential for understanding APIs.
readfalseunknown
lean_local_search
Fast local search to verify declarations exist. Use BEFORE trying a lemma name.
readfalseunknown
lean_leansearch
Limit: 90req/30s. Search Mathlib via leansearch.net using natural language. Examples: "sum of two even numbers is even", "Cauchy-Schwarz inequality", "{f : A → B} (hf : Injective f) : ∃ g, LeftInverse g f"
readfalseunknown
lean_loogle
Search Mathlib by type signature via loogle.lean-lang.org. Examples: `Real.sin`, `"comm"`, `(?a → ?b) → List ?a → List ?b`, `_ * (_ ^ _)`, `|- _ < _ → _ + 1 < _ + 1`
readfalseunknown
lean_multi_attempt
Try multiple tactics without modifying file. Returns goal state for each.
readfalseunknown
lean_profile_proof
Run `lean --profile` on a theorem. Returns per-line timing and categories. SLOW - avoid on theorems that already hit heartbeat limits.
readfalseunknown
lean_leanfinder
Limit: 10req/30s. Semantic search by mathematical meaning via Lean Finder. Examples: "commutativity of addition on natural numbers", "I have h : n < m and need n + 1 < m + 1", proof state text. The `version` argument selects which mathlib snapshot to query (v4.19.0, v4.24.0, or v4.28.0). Default: v4.28.0.
readfalseunknown
lean_run_code
Run a code snippet and return diagnostics. Must include all imports.
writetrueunknown
lean_state_search
Limit: 6req/30s. Find lemmas to close the goal at a position. Searches premise-search.com.
readfalseunknown
lean_verify
Check theorem axioms + optional source scan. Only scans the given file, not imports.
unknownunknownunknown
lean_get_widget_source
Get JavaScript source of a widget by hash. Useful for understanding custom widget rendering logic. Returns full JS module - may be large.
readfalseunknown
lean_get_widgets
Get panel widgets at a position (proof visualizations, #html, custom widgets). Returns raw widget data - may be large.
readfalseunknown
lean_goal
Get proof goals at a position. MOST IMPORTANT tool - use often! Omit column to see goals_before (line start) and goals_after (line end), showing how the tactic transforms the state. status='complete' means the proof is finished at this point; status='no_goal_at_position' means the position carries no proof state (e.g. outside a proof).
readfalseunknown
lean_diagnostic_messages
Get compiler diagnostics (errors, warnings, infos) for a Lean file.
readfalseunknown
lean_completions
Get IDE autocompletions. Use on INCOMPLETE code (after `.` or partial name).
readfalseunknown
lean_hammer_premise
Limit: 6req/30s. Get premise suggestions for automation tactics at a goal position. Returns lemma names to try with `simp only [...]`, `aesop`, or as hints.
readfalseunknown
lean_minimal_hypotheses
For each explicit `(h : T)` hypothesis of a theorem, drop it and re-elaborate a scratch copy of the file. Reports which hypotheses are load-bearing and which are actually unused. Skips implicit `{x : α}` and instance `[inst : C]` binders (those are usually inferable / always load-bearing). Does not rewrite the proof body — a body that names `h` will fail to elaborate without the binder, which is the truthful answer (load-bearing). Variants are checked in parallel on scratch documents; the file is never edited.
unknownunknownunknown

02Install & source
uvx lean-lsp-mcp
uvx

03Access granted
Execute code · write

The access this server can exercise, inferred from its verified tools — not a declared OAuth scope.


05Provenance & freshness
sourcesGitHub repo search [p4]
last_checked2026-08-16 14:22Z
next_check2026-08-17 07:37Z
cadenceevery 17h
verifiedtools_list:passed handshake:passed metadata:passed tools_list:passed handshake:passed metadata:passed
index_statusindex9 unique facts >= 5

06Badge

Add the “as seen on MCPExplorer” badge to your README. lean-lsp-mcp MCP — as seen on mcpexplorer.com

[![lean-lsp-mcp MCP — as seen on mcpexplorer.com](https://mcpexplorer.com/badge/lean-lsp-mcp.svg)](https://mcpexplorer.com/servers/lean-lsp-mcp)

Next step

This is one server. A loadout combines the right servers, governance, and proven plays for a whole job — assembled deliberately, not tool-dumped.

Explore loadouts →
lean-lsp-mcp — MCPExplorer