Note: This project was 100% vibe-coded with Claude Code.
An MCP (Model Context Protocol) server that wraps Aristotle, Harmonic's automated theorem prover for Lean 4. This enables AI assistants to strategically invoke theorem proving during Lean development—filling in sorry statements, verifying lemmas, or formalizing natural language into Lean code.
Aristotle is a cloud-based theorem proving service by Harmonic that can automatically fill in proofs in Lean 4. Given Lean code with sorry placeholders, Aristotle attempts to find valid proofs using advanced search techniques.
To use this MCP server, you'll need an API key from aristotle.harmonic.fun.
| Tool | Description |
|---|---|
prove |
Fill in sorry statements in Lean code snippets |
prove_file |
Prove all sorries in a Lean file with automatic import resolution |
formalize |
Convert natural language math to Lean 4 code |
check_proof |
Poll async proof jobs for completion |
check_prove_file |
Poll async file proof jobs for completion |
check_formalize |
Poll async formalization jobs for completion |
Install uv (the fast Python package manager):
# macOS
brew install uv
# Or via shell script (macOS/Linux)
curl -LsSf https://astral.sh/uv/install.sh | sh- Sign up at aristotle.harmonic.fun
- Copy your API key
- Add it to your shell configuration (
~/.zshrcor~/.bashrc):
export ARISTOTLE_API_KEY="your-api-key-here"Then restart your terminal or run source ~/.zshrc.
claude mcp add aristotle -e ARISTOTLE_API_KEY=$ARISTOTLE_API_KEY -- uvx --from git+https://github.com/septract/lean-aristotle-mcp aristotle-mcpThis registers the server with your API key from the environment. Use --scope user to make it available across all projects:
claude mcp add aristotle --scope user -e ARISTOTLE_API_KEY=$ARISTOTLE_API_KEY -- uvx --from git+https://github.com/septract/lean-aristotle-mcp aristotle-mcpAdd to your ~/.claude.json:
{
"mcpServers": {
"aristotle": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "git+https://github.com/septract/lean-aristotle-mcp", "aristotle-mcp"],
"env": {
"ARISTOTLE_API_KEY": "${ARISTOTLE_API_KEY}"
}
}
}
}The ${ARISTOTLE_API_KEY} syntax expands to your shell environment variable.
claude mcp list # Check server is registered
claude mcp get aristotle # Test the connectionOr inside Claude Code, run /mcp to see connection status.
Add to your claude_desktop_config.json:
{
"mcpServers": {
"aristotle": {
"command": "uvx",
"args": ["--from", "git+https://github.com/septract/lean-aristotle-mcp", "aristotle-mcp"],
"env": {
"ARISTOTLE_API_KEY": "your-api-key-here"
}
}
}
}Note: Claude Desktop doesn't expand environment variables, so you must include your actual API key.
To test the MCP server without making real API calls:
claude mcp add aristotle-mock -e ARISTOTLE_MOCK=true -- uvx --from git+https://github.com/septract/lean-aristotle-mcp aristotle-mcpOr set in your configuration:
{
"env": {
"ARISTOTLE_MOCK": "true"
}
}- Proofs take time: Aristotle proofs can take anywhere from a few minutes to several hours depending on complexity. Simple proofs may complete in 1-5 minutes, but complex proofs can take significantly longer. The tools support async mode (
wait=False) for non-blocking operation—this is strongly recommended for anything non-trivial. - Lean 4 only: Aristotle works with Lean 4, not Lean 3 or earlier versions.
- Mathlib support: File-based proving automatically resolves Lake dependencies including Mathlib.
All proving tools support synchronous (wait=True, default) and asynchronous (wait=False) modes.
prove(code, wait=True) → Returns filled proof when complete
prove_file(file, wait=True) → Writes solution file when complete
formalize(desc, wait=True) → Returns Lean code when complete
Use async mode for long-running proofs to avoid blocking:
1. Submit: prove_file(file, wait=False) → Returns project_id
2. Poll: check_prove_file(project_id) → Returns status (save=False by default)
3. Save: check_prove_file(project_id, output_path="out.lean", save=True)
Key points:
check_prove_filedefaults tosave=False— it only checks status without writing files- To save the result, call with
save=True - If
output_pathis omitted, uses the path from the originalprove_filecall (stored for 30 days) - You can override
output_pathto save to a different location check_proofandcheck_formalizereturn the code directly in the response (nosaveparameter needed)
proveacceptscontext_files(a list) — multiple Lean files can provide importsformalizeacceptscontext_file(singular) — only one context file supported
This difference reflects the underlying aristotlelib API.
Clone the repository and install in editable mode:
git clone https://github.com/septract/lean-aristotle-mcp.git
cd lean-aristotle-mcp
make venv
source .venv/bin/activate
make install-dev # Includes dev dependenciesRun the development server:
make run # Uses real API
make run-mock # Uses mock responsesThe project uses a Makefile for common tasks. Run make help for all options.
make check # Run lint + type-check
make test # Run mock tests (no API key needed)
make test-api # Run live API tests (requires ARISTOTLE_API_KEY)
make verify # Full verification suiteThis means uv isn't in Claude's PATH. On macOS, GUI applications don't always inherit your shell PATH. Solutions:
- Restart Claude after installing uv
- Use full path: Replace
uvxwith the full path (e.g.,/opt/homebrew/bin/uvx) - Check installation: Run
which uvxin terminal to verify uv is installed
Make sure you've:
- Added
export ARISTOTLE_API_KEY="..."to your shell config - Restarted your terminal
- Included
-e ARISTOTLE_API_KEY=$ARISTOTLE_API_KEYwhen adding the server
MIT - see LICENSE for details.
- Aristotle API - Get your API key
- Harmonic - Company behind Aristotle
- aristotlelib on PyPI - Python client library
- Model Context Protocol - MCP specification