Skip to main content

Isabelle-MCP

PyPI Python CI License: LGPL-2.1-or-later

MCP server that lets AI agents (Claude Code, Codex, …) drive the Isabelle theorem prover through its LSP/PIDE commands — fully autonomously, with no human in the loop.

Purpose

This MCP server exists so that Claude / Codex can issue Isabelle LSP commands without any human mediation. The entire Isabelle process is encapsulated behind the MCP tools — it exposes no UI to the user. The agent works by editing .thy/.ML files on disk and calling the tools to evaluate them and query proof states; nobody watches or steers the prover interactively.

This server is not designed for human–AI collaboration (there is no jEdit/VSCode front-end in the picture). It implements a single AI ↔ Isabelle, no-human-in-the-loop model.

⚠️ One agent per server instance. This server holds a single Isabelle session with global mutable state — one set of open documents, one perspective, and one evaluation in flight at a time. It is single-threaded and not concurrency-safe: pointing multiple agents at one instance, or interleaving concurrent requests, corrupts the evaluation and document state with catastrophic, hard-to-debug results. The server runs over stdio, so each agent already gets its own dedicated server process (and its own isabelle mcp_server) — just don't share one or drive it concurrently.

[!IMPORTANT] No Isabelle patch is needed. Earlier versions required one: the server drove the stock isabelle vscode_server, which lacks the PIDE requests it needs, so the distribution had to be patched. It no longer does. Isabelle-MCP now ships its own Isabelle Scala component — isabelle mcp_server — and registers it with your Isabelle the first time you launch a session. Nothing is compiled on your machine (the component carries a prebuilt jar and declares no_build = true), so site-packages may even be read-only, and no session heap is invalidated.

Requirements: Isabelle2025-2, with isabelle on PATH (or pinned with isabelle-mcp install --isabelle-bin /path/to/Isabelle/bin/isabelle). Isabelle2024 is no longer supported — see the last-isabelle2024-support tag.

To undo the registration: isabelle-mcp uninstall. If you remove the package without it, Isabelle will print ### Missing Isabelle component: … on every command until you run isabelle components -x <the path it names> — harmless, but noisy.

Quick Start

pip install isabelle-mcp      # or: uv tool install isabelle-mcp

# register into Claude Code / Codex (auto-detects whichever is installed):
isabelle-mcp install

For Claude Desktop, register manually instead (~/.config/claude/claude_desktop_config.json):

{
  "mcpServers": {
    "isabelle": {
      "command": "isabelle-mcp"
    }
  }
}

Tools

Tool Description
isabelle_launch Start (or restart) the prover with the session/logic that fits the work (bare Main is only a minimal fallback); call this first
isabelle_terminate Terminate the running prover (the MCP server stays up; you can relaunch)
isabelle_evaluate_to Evaluate the theory up to a line; returns a per-file snapshot of errors / sorry / running command lines
isabelle_evaluation_status Poll progress of a running evaluation (same snapshot)
isabelle_cancel_evaluation Cancel a running evaluation
isabelle_hover Type info and documentation at position
isabelle_definition Jump to symbol definition
isabelle_local_occurrences In-file occurrences (definition + uses) of a local entity
isabelle_goal Proof goals — omit after_text for before/after diff
isabelle_find_theorems Search the theorem database in the context at a position (Isabelle's find_theorems): by name, pattern, intro/elim/dest, solves, simp
isabelle_command_output Prover output messages
isabelle_command_status What state the command(s) covering each of several lines are in
isabelle_session_info Current session info

With isabelle_launch(session, debug=true) the ML debugger tools come alive (eleven more tools): set/delete/list breakpoints on compiled Isabelle/ML code (isabelle_set_breakpoint, isabelle_del_breakpoints, isabelle_list_breakpoints, isabelle_list_breakable_sites), arm and disarm them in bulk (isabelle_enable_all_breakpoints, isabelle_disable_all_breakpoints), and work with hits — threads stopped at a breakpoint: inspect (isabelle_debug_state), evaluate ML in a stack frame's scope (isabelle_eval_at_breakpoint), print a frame's locals (isabelle_locals_at_breakpoint), resume (isabelle_continue_breakpoint) and single-step (isabelle_step_at_breakpoint). A hit pauses the evaluation: the isabelle_evaluate_to result leads with a hit report (position, call stack, frame-0 locals), and asynchronous events arrive as one-line debugger notices on the next tool result. The full design lives in docs/archive/DEBUGGER_DESIGN.md.

All positions are 1-indexed. File paths must be absolute.

Every query tool names a file and a line, and the prover answers about the command there without moving its caret — so a query can run while an evaluation is in progress, and it may only be refused for the position it asked about, not because the session is busy. A query that cannot produce a result says why ("this command is not a proof operation", "it has not finished evaluating"); nothing is concluded from a timeout.

Development

pip install -e ".[dev]"             # editable install from a checkout
pytest                              # unit tests
pytest -m integration               # requires running Isabelle
python -m mypy src/                 # type checking

Architecture

server.py         FastMCP entry point — tool registration, lifespan
lsp_client.py     JSON-RPC 2.0 client for isabelle mcp_server
tools/            Tool implementations (one file per tool)
utils/            Position conversion, URI handling, HTML parsing
models.py         Pydantic output models

License

Copyright © 2024-2026 Qiyuan Xu.

This project is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version. See LICENSE for the full text.

Release files for isabelle-mcp 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isabelle-mcp 0.6.0
File Size Uploaded
isabelle_mcp-0.6.0.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for isabelle-mcp 0.6.0
File Interpreter ABI Platform
isabelle_mcp-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.0 MB

Release files / isabelle_mcp-0.6.0.tar.gz

Download URL isabelle_mcp-0.6.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
770ae3bc0ec2386aae7c649710311650c685f09bd183f2db6ab5da8d16f16f91
BLAKE2b-256 checksum
How to use checksums
f1480384bda05f0d4ec69262878b73d52ec02294e17ecfeaf1691fbfd876131e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / isabelle_mcp-0.6.0-py3-none-any.whl

Download URL isabelle_mcp-0.6.0-py3-none-any.whl
Size 972.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bd8829536417ff4f12b7bfb527a7b15a3c5f2f771a683046aece7e7cc511966
BLAKE2b-256 checksum
How to use checksums
3f2541ddac76be8ba1da467c5927258549177c39a4295b7d69d5fd180897e23b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page