Registry / ai-ml / lean-lsp-mcp

lean-lsp-mcp

JSON →
library0.26.2pypypiunverified

A Python library implementing the Model Context Protocol (MCP) for integration with the Lean Theorem Prover's language server (LSP). It enables AI agents to inspect Lean environments, check proofs, get goals, and run commands via the Lean LSP. Version 0.26.2 (current) supports Python >=3.10. Release cadence is active, with frequent updates.

pip install lean-lsp-mcp
INSTALL
IMPORT
SIG · LEAN-LSP-MCP
L
lean-lsp-mcp
ai-mlpythonv0.26.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LeanLspClient
from lean_lsp_mcp.client_utils import LeanLspClient
from lean_lsp_mcp import LeanLspClient

Initialize a Lean LSP client, execute a command (checking a simple equality), and print the resulting goals.

import os from lean_lsp_mcp import LeanLspClient async with LeanLspClient(lean_path=os.environ.get('LEAN_PATH', '')) as client: result = await client.execute_command('example ⊢ 2+2=4') print(result.goals)
Debug
Known issues
breakingThe import path changed from `lean_lsp` to `lean_lsp_mcp` in version 0.20.0. All existing code using `from lean_lsp import ...` will break.
fix
Update imports to `from lean_lsp_mcp import ...`.
affects: >=0.20.0
deprecatedThe `LeanClient` class was renamed to `LeanLspClient` in version 0.25.0. `LeanClient` still works but emits a deprecation warning.
fix
Replace `LeanClient` with `LeanLspClient` in your code.
affects: >=0.25.0
gotchaThe `lean_path` parameter must point to the Lean executable (e.g., `lean` or full path). Passing the workspace folder path will not work.
fix
Set `lean_path` to the path of the `lean` binary, often found at `/path/to/.elan/bin/lean`.
affects: all
Upgrade
Version history
0.26.2latest on PyPI · released May 4, 2026
Audit
Dependencies
pydanticrequiredUsed for data validation and settings management
httpxrequiredHTTP client for communicating with Lean LSP server
Agent activity
20 hits · last 30 days
node
18
Resources
lean-lsp-mcp — pip install lean-lsp-mcp · libregistry