Best for
- Developers and researchers working with Lean 4 and Lake projects.
- Users who want an MCP client to inspect proof states, diagnostics, and Lean project contents.
The README describes the main interaction features, client configuration, transports, and optional settings, and calls out risks from local file access, code execution, and external search. The full tool list is linked in the README, but the supplied material does not include specific tool identifiers.
Strongest · Documentation 15/20 Weakest · Reliability 10/20
Static review · not runReviewed 2026-11-29
Read the FMRS scoring method →Runtime:Python
LEAN_LSP_MCP_TOKEN
Bearer authentication secret for streamable-http or sse; provide a secret of your own.
LEAN_LOG_LEVEL
Sets the server log level; choose INFO, WARNING, ERROR, or NONE.
LEAN_LOG_FILE_CONFIG
Sets the path to a logging configuration file.
LEAN_PROJECT_PATH
Sets the Lean project root; required for streamable-http and sse, and must contain lean-toolchain plus lakefile.lean or lakefile.toml.
LEAN_MCP_DISABLED_TOOLS
Comma-separated tool names to remove from the MCP tool listing.
LEAN_MCP_INSTRUCTIONS
Replaces the server instructions string.
LEAN_MCP_TOOL_DESCRIPTIONS
JSON object for overriding tool descriptions.
LEAN_MCP_SCRATCH_SLOTS
Sets the number of parallel scratch documents; defaults to 1.
LEAN_MCP_MAX_OUTPUT_CHARS
Sets the per-field character budget for goal states and diagnostics; defaults to 6000, or 0 for no truncation.
LEAN_REPL
Set to true, 1, or yes to enable REPL-based fast code runs and multi-attempts.
LEAN_REPL_PATH
Sets the REPL binary path; auto-detected if unset.
LEAN_REPL_TIMEOUT
Sets the timeout per REPL command in seconds; defaults to 60.
LEAN_REPL_MEM_MB
Sets the memory budget per REPL in MiB; defaults to 16384.
LEAN_BUILD_CONCURRENCY
Sets lean_build concurrency mode: allow, cancel, or share; defaults to allow.
LEAN_HAMMER_URL
Sets the URL of a self-hosted Lean Hammer Premise Search instance.
LEAN_LOOGLE_LOCAL
Set to true, 1, or yes to enable local Loogle.
LEAN_LOOGLE_MODULE
Sets the root module for local Loogle searches; defaults to Mathlib.
LEAN_LOOGLE_LOCAL_ONLY
Set to true, 1, or yes to disable remote Loogle fallback when local search is unavailable.
LEAN_LOOGLE_CACHE_DIR
Sets the local Loogle cache directory; defaults to ~/.cache/lean-lsp-mcp/loogle.
LOOGLE_URL
Sets the Loogle instance URL; defaults to https://loogle.lean-lang.org.
LOOGLE_HEADERS
Sets extra Loogle request headers as a JSON object.
Install uv, then run lake build manually in the Lean project to reduce startup delays. A client can launch the server over stdio with uvx lean-lsp-mcp; the README provides configuration examples for VS Code, Cursor, Claude Code, and Mistral Vibe. By default, the server attempts to run lake serve in the project root. ripgrep is optional and is used by the local search tool.
{"mcpServers":{"lean-lsp":{"command":"uvx","args":["lean-lsp-mcp"]}}}
Shown for Cursor. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.
{
"servers": {
"lean-lsp": {
"command": "uvx",
"args": [
"lean-lsp-mcp"
]
}
}
}
Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).
[mcp_servers.lean-lsp] command = "uvx" args = ["lean-lsp-mcp"]
Append to ~/.codex/config.toml (OpenAI Codex CLI uses TOML).
claude mcp add lean-lsp -- uvx lean-lsp-mcp
Run it in a terminal; replace any <…> placeholders with your own values first.
Confirm that Lean tools appear in your client's MCP tool list. Then ask to inspect the current proof goals; the server should return the Lean project's goal state.
Once connected, you can ask your AI assistant things like:
Listed from the project's documentation, not tested by this site.
Lean Theorem Prover MCP is an MCP server that uses the Language Server Protocol and leanclient to help agents understand, analyze, and interact with Lean projects. It provides access to diagnostics, goal states, term information, and hover documentation, and can use LeanSearch, Loogle, Lean Finder, and Lean Hammer to search for theorems and definitions.
Connect code, docs, and infrastructure in a local knowledge graph.
Docker's official MCP gateway CLI plugin for managing and running MCP servers.
Fast, low-cost structured judgments for agents.
Local call graphs and structural analysis for Go repositories.
Source revision 7932203d79db Data synced 2026-12-05 Read the FMRS scoring method Markdown