iflow-mcp_ooo0ooo-lean-lsp-mcp

v0.20.0
iflow-mcp_ooo0ooo-lean-lsp-mcp Checked 2 days ago Published 9 months ago

Lean Theorem Prover MCP

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

lean_build

Build the Lean project and restart LSP. Use only if needed (e.g. new imports).

ParameterTypeDescription
cleanbooleanRun lake clean first (slow)
lean_project_pathPath to Lean project
output_linesintegerReturn last N lines of build log (0=none)

lean_file_contents

DEPRECATED: Will be removed soon. DEPRECATED. Get file contents with optional line numbers.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
annotate_linesbooleanAdd line numbers

lean_file_outline

Get imports and declarations with type signatures. Token-efficient.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file

lean_diagnostic_messages

Get compiler diagnostics (errors, warnings, infos) for a Lean file.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
declaration_nameFilter to declaration (slow)
end_lineFilter to line
start_lineFilter from line

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. "no goals" = proof complete.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)
columnColumn (1-indexed). Omit for before/after

lean_term_goal

Get the expected type at a position.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)
columnColumn (defaults to end of line)

lean_hover_info

Get type signature and docs for a symbol. Essential for understanding APIs.

ParameterTypeDescription
column *integerColumn at START of identifier
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)

lean_completions

Get IDE autocompletions. Use on INCOMPLETE code (after `.` or partial name).

ParameterTypeDescription
column *integerColumn number (1-indexed)
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)
max_completionsintegerMax completions

lean_declaration_file

Get file where a symbol is declared. Symbol must be present in file first.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
symbol *stringSymbol (case sensitive, must be in file)

lean_multi_attempt

Try multiple tactics without modifying file. Returns goal state for each.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)
snippets *arrayTactics to try (3+ recommended)

lean_run_code

Run a code snippet and return diagnostics. Must include all imports.

ParameterTypeDescription
code *stringSelf-contained Lean code with imports

lean_leansearch

Limit: 3req/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"

ParameterTypeDescription
query *stringNatural language or Lean term query
num_resultsintegerMax results

lean_loogle

Search Mathlib by type signature via loogle.lean-lang.org. Examples: `Real.sin`, `"comm"`, `(?a → ?b) → List ?a → List ?b`, `_ * (_ ^ _)`, `|- _ < _ → _ + 1 < _ + 1`

ParameterTypeDescription
query *stringType pattern, constant, or name substring
num_resultsintegerMax results

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.

ParameterTypeDescription
query *stringMathematical concept or proof state
num_resultsintegerMax results

lean_hammer_premise

Limit: 3req/30s. Get premise suggestions for automation tactics at a goal position. Returns lemma names to try with `simp only [...]`, `aesop`, or as hints.

ParameterTypeDescription
column *integerColumn number (1-indexed)
file_path *stringAbsolute path to Lean file
line *integerLine number (1-indexed)
num_resultsintegerMax results

lean_profile_proof

Run `lean --profile` on a theorem. Returns per-line timing and categories.

ParameterTypeDescription
file_path *stringAbsolute path to Lean file
line *integerLine where theorem starts (1-indexed)
timeoutnumberMax seconds to wait
top_nintegerNumber of slowest lines to return