| layout | default |
|---|---|
| title | MCP Integration — Mumei |
| description | Mumei MCP server integration for AI agents, verifier tools, proof certificates, stdlib inspection, and semantic feedback. |
| keywords | mumei MCP, Model Context Protocol, AI agents, formal verification, Devin, Claude Code |
Mumei exposes formal verification capabilities through mcp_server.py, implemented as FastMCP("Mumei-Forge"). Any MCP-compatible AI agent can call the same verifier, builder, effect inference, proof-certificate, and stdlib-inspection tools without agent-specific integration.
For end-to-end workflows that start from natural-language specifications or foreign code before .mm exists, see the mumei-agent Verification Workflow Guide.
| Tool | Description |
|---|---|
forge_blade |
Verify + code generation in one step |
validate_logic |
Z3 verification only; returns counter-example and semantic feedback data |
execute_mm |
General-purpose build / check execution |
get_inferred_effects |
Pre-check: infer required effects before writing code |
get_allowed_effects |
Query current effect boundary for the session |
set_allowed_effects |
Override effect boundary dynamically |
analyze_std_gaps |
Identify gaps in std/ coverage |
list_std_catalog |
List all atoms in the std/ catalog |
visualize_std_graph |
Render std/ dependency graph (Mermaid or DOT) |
visualize_proof_graph |
Export the atom proof graph — contracts, dependencies, trust boundaries, session violations (JSON or DOT) |
measure_std_health |
Measure std/ health metrics |
get_proof_certificate |
Retrieve proof certificate for a module |
generate_doc |
Generate structured documentation (mumei doc --format json) |
analyze_contract_conflicts |
Analyze cross-atom contract conflicts and circular dependencies (Meta-Architect) |
propose_interface_refactoring |
Propose interface-level refactorings for architectural issues (Meta-Architect) |
get_spec_guideline / get_spec_guidelines |
Return agent-facing specification-writing guidelines |
verify_with_orchestration |
Verify with worker-pool orchestration, caching, and task tracking |
get_structured_feedback |
Return P9-E structured feedback JSON for source code |
pip install "mcp[cli]>=1.0"
python mcp_server.pyUse validate_logic for verification-only checks:
{
"tool": "validate_logic",
"arguments": {
"source_code": "atom transfer(balance: i64, amount: i64) requires: balance >= amount && amount > 0; ensures: result >= 0; body: balance - amount;",
"trace_id": "payment-transfer-v1"
}
}Use forge_blade when the agent should verify and emit LLVM IR:
{
"tool": "forge_blade",
"arguments": {
"source_code": "atom safe_div(a: i64, b: i64) requires: b != 0; ensures: true; body: a / b;",
"output_name": "safe_div"
}
}The CLI verification surface used by MCP is:
mumei verify --json file.mm— structured JSON output to stdoutmumei verify --report-dir <dir> file.mm— writereport.jsonto a specified directorymumei verify --cross-spec-verify file.mm— cross-spec consistency check; outputscross_spec.jsonmumei verify --cross-spec-files dep.mm file.mm— multi-file cross-spec verification
See Report Schema and Cross-Spec Verification for output formats.
graph TD
D1["Claude Code"] -->|"MCP"| M["mcp_server.py (Mumei-Forge)"]
D2["Devin"] -->|"MCP"| M
D3["Codex"] -->|"MCP"| M
D4["Qwen (via MCP client)"] -->|"MCP"| M
M -->|"validate_logic"| V["mumei verify"]
M -->|"forge_blade"| B["mumei build"]
M -->|"get_inferred_effects"| I["mumei infer-effects"]
- Machine-readable output:
_build_machine_readable()parsesreport.jsonand returns structured JSON containingfailure_type,actions,counter_example,conflicting_constraints,data_flow,related_locations, and more. - Concurrent-safe verification:
validate_logicusesmumei verify --report-dirwith a unique temporary directory per invocation, enabling multiple agents to run verification in parallel without conflicts. - Zero-configuration usage: Any MCP-compatible agent can start using mumei's verification, build, and effect inference capabilities by connecting to
python mcp_server.py.
MCP Server (mcp_server.py) |
mumei-agent | |
|---|---|---|
| Approach | Generic interface — the agent's own LLM decides how to fix issues | Turnkey solution — LLM call + verification + retry integrated in one loop |
| Integration | Any MCP-compatible agent (Claude Code, Devin, Codex, Qwen, etc.) | Standalone CLI: python -m agent file.mm |
| LLM | Agent brings its own | Configurable via .env (Ollama, OpenAI, DashScope, etc.) |
The two approaches are complementary: the MCP Server enables any agent to access mumei verification without requiring mumei-agent, while mumei-agent provides an out-of-the-box autonomous fix loop for users who want a single-command experience.