Axle MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/Vilin97/axle-mcp
cd axle-mcp
pip install mcp
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add axle-mcp -- python "<FULL_PATH_TO_AXLE_MCP>/dist/index.js"

Replace <FULL_PATH_TO_AXLE_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Integrates the AXLE CLI with AI assistants for Lean 4 proof engineering.

axle-mcp

An MCP server that exposes the AXLE (Axiom Lean Engine) CLI as tools for AI assistants like Claude.

AXLE is a remote API for Lean 4 proof engineering — it can check, repair, simplify, extract, and transform Lean theorems without requiring a local Lean installation.

Tools

Tool Description
axle_environments List available Lean environments (versions + Mathlib)
axle_check Validate Lean code and report errors/warnings/info
axle_verify_proof Check that a candidate proof matches a formal statement
axle_extract_theorems Split a file into one-theorem-per-unit with rich metadata
axle_repair_proofs Auto-repair broken proofs (replaces sorry with working tactics)
axle_simplify_theorems Remove redundant tactics and clean up proof steps
axle_disprove Find counterexamples to false theorems via property-based testing
axle_theorem2sorry Replace proof bodies with sorry (create problem templates)
axle_have2sorry Replace have proofs with sorry (targeted exercises)
axle_sorry2lemma Lift sorry placeholders into standalone top-level lemmas
axle_have2lemma Lift have statements into standalone top-level lemmas
axle_theorem2lemma Convert between theorem and lemma keywords
axle_rename Rename declarations and update all references
axle_merge Combine multiple Lean snippets into one file
axle_normalize Standardize Lean file formatting

Requirements

  • Python 3.11+
  • `mcp` Python package (pip install mcp)
  • The axle CLI installed and accessible

Installation

1. Install dependencies

pip install mcp

2. Clone this repo

git clone https://github.com/Vilin97/axle-mcp
cd axle-mcp

3. Register with Claude Code

claude mcp add axle -s user \
  -e AXLE_BIN=/path/to/axle \
  -e AXLE_DEFAULT_ENVIRONMENT=lean-4.28.0 \
  -- python /path/to/axle-mcp/server.py

4. Register with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "axle": {
      "command": "python",
      "args": ["/path/to/axle-mcp/server.py"],
      "env": {
        "AXLE_BIN": "/path/to/axle",
        "AXLE_DEFAULT_ENVIRONMENT": "lean-4.28.0"
      }
    }
  }
}

Configuration

Environment variable Default Description
AXLE_BIN axle Path to the axle binary
AXLE_DEFAULT_ENVIRONMENT lean-4.28.0 Default Lean environment for all tools

Usage examples

Once registered, Claude can use these tools directly. Some examples of what you can ask:

  • "Check if this Lean theorem compiles"axle_check
  • "Repair the sorry'd proofs in this file"axle_repair_proofs
  • "Turn this proof into a problem set by replacing proofs with sorry"axle_theorem2sorry
  • "Does this theorem have a counterexample?"axle_disprove
  • "Extract each theorem into its own self-contained snippet"axle_extract_theorems
  • "Merge these two Lean files into one"axle_merge

Common parameters

Most tools accept these optional parameters:

  • environment — Lean environment to use (run axle_environments to list available ones)
  • names — comma-separated declaration names to process (default: all)
  • indices — comma-separated 0-based indices to process
  • timeout — max execution time in seconds (default: 120)
  • ignore_imports — ignore import mismatches between the code and the environment

How it works

Each MCP tool wraps the corresponding axle CLI command, passing Lean source code via stdin and returning the structured JSON response from the AXLE API. Tools that require multiple file arguments (verify-proof, merge) write temporary files automatically and clean them up after the call.

Tools (15)

axle_environmentsList available Lean environments (versions + Mathlib)
axle_checkValidate Lean code and report errors/warnings/info
axle_verify_proofCheck that a candidate proof matches a formal statement
axle_extract_theoremsSplit a file into one-theorem-per-unit with rich metadata
axle_repair_proofsAuto-repair broken proofs (replaces sorry with working tactics)
axle_simplify_theoremsRemove redundant tactics and clean up proof steps
axle_disproveFind counterexamples to false theorems via property-based testing
axle_theorem2sorryReplace proof bodies with sorry (create problem templates)
axle_have2sorryReplace have proofs with sorry (targeted exercises)
axle_sorry2lemmaLift sorry placeholders into standalone top-level lemmas
axle_have2lemmaLift have statements into standalone top-level lemmas
axle_theorem2lemmaConvert between theorem and lemma keywords
axle_renameRename declarations and update all references
axle_mergeCombine multiple Lean snippets into one file
axle_normalizeStandardize Lean file formatting

Environment Variables

AXLE_BINPath to the axle binary
AXLE_DEFAULT_ENVIRONMENTDefault Lean environment for all tools

Configuration

claude_desktop_config.json
{"mcpServers": {"axle": {"command": "python", "args": ["/path/to/axle-mcp/server.py"], "env": {"AXLE_BIN": "/path/to/axle", "AXLE_DEFAULT_ENVIRONMENT": "lean-4.28.0"}}}}

Try it

Check if this Lean theorem compiles.
Repair the sorry'd proofs in this file.
Turn this proof into a problem set by replacing proofs with sorry.
Does this theorem have a counterexample?
Extract each theorem into its own self-contained snippet.

Frequently Asked Questions

What are the key features of Axle MCP?

Validate Lean code and report errors without a local Lean installation. Auto-repair broken proofs by replacing sorry with working tactics. Find counterexamples to false theorems using property-based testing. Convert between theorem and lemma declarations. Standardize Lean file formatting and merge multiple snippets.

What can I use Axle MCP for?

Automating the repair of broken Lean proofs in large projects. Creating educational problem sets from existing formal proofs. Verifying theorem correctness during rapid prototyping. Refactoring Lean codebases by renaming declarations and updating references. Standardizing formatting across collaborative Lean repositories.

How do I install Axle MCP?

Install Axle MCP by running: git clone https://github.com/Vilin97/axle-mcp && cd axle-mcp && pip install mcp

What MCP clients work with Axle MCP?

Axle MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Axle MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare