Ports the evolved Rocq MCP server to Lean (lean-mcp-evolve) and evaluates it against lean-lsp-mcp and a lake-build baseline on PutnamBench.
Abstract
Recent achievements in AI-assisted mathematics require intensive interaction of agents with proof assistants to generate machine-checked proof certificates. Agents interact with proof assistants such as Rocq or Lean through an interface that controls what the agent receives from the prover and the cost of these interactions. Today, these interfaces are adapted from tools designed for humans and not optimized for agents. We propose an evolutionary method where a frontier model incrementally proposes new features and only keeps the ones that improve the overall performance of smaller models. We demonstrate the effectiveness of our method by growing, on a curated set of mathematical problems, ROCQ-MCP-EVOLVE, a new MCP server for the Rocq prover. On the held-out test split of miniF2F-Rocq, an agent equipped with ROCQ-MCP-EVOLVE outperforms both the baseline that only exposes the Rocq compiler and an established MCP server, across four models from two families, in success rate, cost per solve, and time per solve. Although evolved for Rocq, the resulting server transfers to Lean, improving cost and time per solve on a subset of PutnamBench. We release ROCQ-MCP-EVOLVE and its port to Lean.
Problem
Agents interact with proof assistants through interfaces adapted from human-oriented tools. These interfaces are not optimized for the cost, time, or accuracy of agent interactions.
Approach
A frontier orchestrator model (Claude Fable 5) starts from a compile-only MCP server and incrementally proposes mutations, such as new tools or refined outputs. Each mutation is evaluated with smaller tester models (Claude Haiku 4.5, Claude Sonnet 5) on curated problem sets and kept only if it improves accuracy, with cost and wall time as secondary objectives. This process produced rocq-mcp-evolve, an OCaml server built on the Rocq runtime. The server was then ported to Lean as lean-mcp-evolve with the same tool set.
Figure 2: A step of the evolutionary process. The mutation designed by the orchestrator is denoted by the dark red color. The purple dotted box represents rocq-mcp-evolve , the blue dotted box represents the evaluation of the mutation. The light gray circle shows the process is iterative: a new step starts at the end of the previous one.
Results
On the miniF2F-Rocq test split, rocq-mcp-evolve beats both the compiler-only baseline and rocq-mcp in accuracy, cost, and wall time across four models. On a PutnamBench subset in Lean, lean-mcp-evolve lowers cost and time per solve, but its solve rate remains below lean-lsp-mcp.
MCP server
Accuracy
Cost ($)
Wall time (s)
control
.33 (.93/.05/.00)
.12
82
lean-lsp-mcp
.42 (.95/.30/.00)
.14
86
lean-mcp-evolve
.33 (.83/.18/.00)
.11
64
Lean port on a PutnamBench subset (overall, with per-bucket values in parentheses)