Lean Lsp MCP Server

MCP server that allows agentic interaction with the [Lean theorem prover](https://lean-lang.org/) via the [Language Server

Remote serverstreamable-httpPython

What is the Lean Lsp MCP MCP server?

Lean Lsp MCP becomes available to MCP clients through the lean lsp mcp mcp server. MCP server that allows agentic interaction with the Lean theorem prover via the Language Server Protocol using leanclient. This server.

What Lean Lsp MCP does

MCP server that allows agentic interaction with the Lean theorem prover via the Language Server Protocol using leanclient. This server provides a range of tools for LLM agents to understand, analyze and interact with Lean projects.

  1. Install uv, a Python package manager. 2. Make sure your Lean project builds quickly by running lake build manually. 3. Configure your IDE/Setup 4. (Optional, highly recommended) Install ripgrep (rg) for local search and source scanning (lean_verify warnings).

Key capabilities

  • Rich Lean Interaction — Access diagnostics, goal states, term information, hover documentation and more
  • External Search Tools — Use LeanSearch, Loogle, Lean Finder, Lean Hammer and Lean State Search to find relevant theorems and definitions
  • Easy Setup — Simple configuration for various clients, including VSCode, Cursor and Claude Code

Tools it exposes

Once connected, the assistant can call these 4 tools directly:

  • LEAN_MCP_DISABLED_TOOLS — Comma-separated tool names (for example lean_run_code,lean_build)
  • LEAN_MCP_INSTRUCTIONS — Replacement server instructions string
  • LEAN_MCP_TOOL_DESCRIPTIONS — JSON object to override tool descriptions
  • Overview — 1. Install uv, a Python package manager. 2. Make sure your Lean project builds quickly by running

Installing the lean lsp mcp mcp server

The server is distributed via npm as @modelcontextprotocol/inspector, so most clients can run it without a manual build step. Add it to your MCP client's configuration and restart the client to pick it up — the copy-paste configs for Claude Desktop, Claude Code and Cursor are on this page.

Configuration

Before the server will start you need to supply 8 environment variables: LEAN_PROJECT_PATH, LEAN_LOG_LEVEL, LEAN_MCP_DISABLED_TOOLS, LEAN_MCP_INSTRUCTIONS, LEAN_MCP_TOOL_DESCRIPTIONS, CONTROL_PLANE_API_KEY, LEAN_LSP_MCP_TOKEN, LEAN_REPL. Keep credentials in your client's env block or a secrets manager rather than committing them.

Where it fits

Developer-tool servers are usually the first ones people connect, because they turn "help me with this code" into an assistant that can actually read the repo and act on it. Lean Lsp MCP sits in that group, and the shape of its toolset — LEAN_MCP_DISABLED_TOOLS, LEAN_MCP_INSTRUCTIONS, LEAN_MCP_TOOL_DESCRIPTIONS among others — tells you what it is really for. Worth comparing against the other developer tools servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This is a hosted server — you point your client at an endpoint rather than running a local process, so there is nothing to keep updated on your machine.
  • It will not start until its required credentials are present, so set those before wondering why the tools never appear.
  • Maintained by oOo0oOo, written in Python.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the lean lsp mcp mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
LEAN_MCP_DISABLED_TOOLSComma-separated tool names (for example lean_run_code,lean_build).
LEAN_MCP_INSTRUCTIONSReplacement server instructions string.
LEAN_MCP_TOOL_DESCRIPTIONSJSON object to override tool descriptions.
Overview1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/), a Python package manager. 2. Make sure your Lean project builds quickly by running lake build manually. 3. Configure your IDE/Setup 4. (Optional,

How to install the Lean Lsp MCP MCP server

{
  "mcpServers": {
    "lean-lsp": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/inspector"],
      "env": {
        "LEAN_PROJECT_PATH": "your-value",
        "LEAN_LOG_LEVEL": "your-value",
        "LEAN_MCP_DISABLED_TOOLS": "your-value",
        "LEAN_MCP_INSTRUCTIONS": "your-value",
        "LEAN_MCP_TOOL_DESCRIPTIONS": "your-value",
        "CONTROL_PLANE_API_KEY": "your-value",
        "LEAN_LSP_MCP_TOKEN": "your-value",
        "LEAN_REPL": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
LEAN_PROJECT_PATHFilesystem location the server is allowed to use.Optional
LEAN_LOG_LEVELConfiguration value read at startup.Optional
LEAN_MCP_DISABLED_TOOLSConfiguration value read at startup.Optional
LEAN_MCP_INSTRUCTIONSConfiguration value read at startup.Optional
LEAN_MCP_TOOL_DESCRIPTIONSConfiguration value read at startup.Optional
CONTROL_PLANE_API_KEYCredential the server authenticates with.Yes
LEAN_LSP_MCP_TOKENCredential the server authenticates with.Yes
LEAN_REPLConfiguration value read at startup.Optional

Example prompts to try

  • Use Lean Lsp MCP to LEAN MCP DISABLED TOOLS.
  • Use Lean Lsp MCP to LEAN MCP INSTRUCTIONS.
  • Use Lean Lsp MCP to LEAN MCP TOOL DESCRIPTIONS.

Frequently asked questions

It connects Lean Lsp MCP to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (LEAN_MCP_DISABLED_TOOLS, LEAN_MCP_INSTRUCTIONS, LEAN_MCP_TOOL_DESCRIPTIONS, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Lean Lsp MCP directly.