Skip to main content
Glama

@zesun33/mcp-formal

Purpose and first steps

Check assertions and run bounded or inductive RTL proofs through an MCP server.

Who it is for: Hardware engineers using an MCP-capable client or coding agent.

First task: Configure the server in your MCP client, then call formal_toolchain_info before running a design.

What to expect: Engine availability, then explicit proof, counterexample, unknown, error, or timeout results.

Current scope: Published MCP server with explicit proof outcomes. A proof applies to the supplied properties, assumptions, engine, and bounds; unknown or timeout is not success. The npx command waits for an MCP client.

Start here: Runtime requirements and configuration.

Related projects: mcp-rtl-review, mcp-verilog.

Choose another project.

Model Context Protocol (MCP) server for SymbiYosys formal verification (BMC/prove) and SVA linting.

License: Apache-2.0 CI Protocol: MCP Runtime: Rootless Podman

mcp-formal lets AI coding agents and IDEs (Cursor, Windsurf, GitHub Copilot / OpenAI Codex, Claude Code, Google Antigravity, OpenCode, Cline) prove SystemVerilog assertions with SymbiYosys (smtbmc+z3) instead of only simulating them. Author properties first with rtl_generate_assertion (mcp-rtl-review), then prove them here: verdicts are PROVEN, FAILED (with counterexample asserts), UNKNOWN, ERROR, or TIMEOUT — never a silent pass.

Engine reality (verified live): the image ships SBY with the smtbmc z3 engine (z3 5.1.0). The ABC/PDR engine is excluded: it crashes parsing witness output against this Yosys build. Sequential/multi-clock properties may report UNKNOWN or exhaust depth instead of proving; treat those as work for deeper bounds or induction, not as passes.

Related MCP server: mcp-cocotb

Install and run

Run this MCP server directly from npm:

npx -y @zesun33/mcp-formal

For the complete hardware-agent setup, use npx -y @zesun33/create-hw-agent my-asic.


⚡ Quick Tour: See It in Action

The examples below illustrate tool requests and result fields. Timings, counts, and scores depend on the input and runtime; they are not guaranteed outcomes or fresh verification results.

Example tool requests and results

1. Probing the Toolchain (Zero-Config Verification)

// Tool Call: formal_toolchain_info
{
  "runtime": "podman",
  "image": "ghcr.io/zesun33/asic",
  "solvers": ["z3 (Z3 version 5.1.0 - 64 bit)"],
  "engines": ["smtbmc_z3"]
}

2. Proving a Holding Assertion (Bounded)

// Tool Call: formal_prove {"verilog_sources": ["counter_assert_ok.sv"], "top_module": "cnt_ok", "mode": "bmc", "depth": 6}
{
  "success": true,
  "verdict": "PROVEN",
  "mode": "bmc",
  "depth": 6,
  "failedAssertions": []
}

3. Refuting a False Assertion (Counterexample Triage)

// Tool Call: formal_prove {"verilog_sources": ["counter_assert_bad.sv"], "top_module": "cnt_bad", "mode": "bmc", "depth": 6}
{
  "success": true,
  "verdict": "FAILED",
  "failedAssertions": [
    { "name": "cnt_bad.$assert$counter_assert_bad.sv:14$1", "location": "counter_assert_bad.sv:14", "step": 1 }
  ]
}

4. Catching Syntax Errors Before Solver Time

// Tool Call: formal_lint_sva {"verilog_sources": ["sva_syntax_bad.sv"], "top_module": "sva_broken"}
{
  "success": false,
  "errors": ["sva_syntax_bad.sv:14: syntax error ..."]
}

Tools Exposed

Tool

Parameters

Engine

Description

formal_prove

verilog_sources: string[], top_module: string, mode?: "bmc" | "prove", depth?: number [1,100], defines?: string[], keep_workdir?: boolean, cwd?: string

SBY smtbmc z3

Proves embedded assertions; honest 5-state verdict with counterexample locations. Pass defines: ["FORMAL"] with `ifdef FORMAL-guarded SVA (iverilog cannot parse assertions).

formal_lint_sva

verilog_sources: string[], top_module: string, cwd?: string

Yosys elaboration

Catches SVA syntax/elaboration errors with file:line diagnostics. Proves nothing.

formal_toolchain_info

none

Probe

SBY version, SMT solvers, and proof engines.


Execution Runtime

mcp-formal runs inside the zesun33/asic rootless Podman image so tools are identical on any Linux host.

Public install (recommended — anyone can pull):

podman pull ghcr.io/zesun33/asic:latest
export MCP_FORMAL_IMAGE=ghcr.io/zesun33/asic

ghcr.io/zesun33/asic is the default (anyone can pull). Local builds still work as localhost/zesun33/asic via MCP_FORMAL_IMAGE.

  • Container mount: -v <workspace>:/workspace:Z -w /workspace

  • Podman storage option: --storage-opt overlay.ignore_chown_errors=true

To force host binaries instead of container execution:

export MCP_FORMAL_RUNTIME=host

Requires SymbiYosys + z3 in the image (shipped in zesun33/asic).


Universal Client & AI IDE Setup

Because mcp-formal implements the standard Model Context Protocol (MCP), it connects seamlessly to any MCP-compliant AI IDE or agent interface:

{
  "mcpServers": {
    "formal": {
      "command": "node",
      "args": ["/path/to/mcp-formal/dist/index.js"]
    }
  }
}
  • Cursor: Configure in .cursor/mcp.json.

  • Windsurf: Configure in ~/.codeium/windsurf/mcp_config.json.

  • GitHub Copilot / OpenAI Codex: Configure via Copilot MCP settings or Codex tool proxy.

  • Claude Code: Configure via claude mcp add formal node /path/to/dist/index.js.

  • Google Antigravity: Load as workspace MCP server in antigravity.json.

  • OpenCode & Cline: Direct stdio JSON-RPC connection.


Verification & Testing

Run the full 6-gate verification suite:

# Full verification (with Podman SBY runs)
./scripts/verify.sh

# Fast / CI verification (headless environments)
./scripts/verify.sh --quick

License

Apache-2.0 © 2026 Md Zesun Ahmed Mia

npm releases

See RELEASING.md for GitHub Actions dry runs and trusted publishing.

Available Tools

3 tools
formal_lint_svaA

Elaborates RTL with embedded SVA in Yosys to catch syntax and elaboration errors before solver time. Reports file:line diagnostics. Does not prove anything; use formal_prove for verdicts.

Inputs: top_module (required), verilog_sources (required), cwd.

formal_proveA

Proves SystemVerilog assertions embedded in RTL with SymbiYosys (smtbmc+z3), bounded (bmc) or inductive (prove). Returns PROVEN, FAILED with counterexample asserts, UNKNOWN, ERROR, or TIMEOUT. Author properties first with rtl_generate_assertion (mcp-rtl-review); a passing lint does not mean properties hold.

Inputs: top_module (required), verilog_sources (required), cwd, mode, +4 more.

formal_toolchain_infoA

Returns active container/host runtime and versions of SymbiYosys, SMT solvers, and proof engines.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: formal_prove runs proofs, formal_lint_sva checks syntax/elaboration, and formal_toolchain_info reports environment details. No overlap or ambiguity exists even without reading full descriptions.

    Naming Consistency4/5

    All tools share the formal_ prefix and use snake_case, but formal_prove and formal_lint_sva are verb-oriented while formal_toolchain_info is noun-oriented. This is a minor inconsistency rather than a serious naming problem.

    Tool Count5/5

    Three tools is a compact, focused set that covers the core formal-verification workflow without redundancy or unnecessary bloat.

    Completeness4/5

    The set covers proving, linting/elaboration, and toolchain introspection, which forms a solid lifecycle. A tool for explicitly listing or managing assertions could be missing, but the current coverage is sufficient for typical formal verification tasks.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding agents and IDEs to lint, compile, syntax-check, and simulate Verilog/SystemVerilog designs through structured, token-efficient MCP tools with isolated containerized toolchains.
      4
      17 npm
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding agents to discover, generate, and run Cocotb co-simulation testbenches against Verilog/SystemVerilog designs, returning structured pass/fail results and tracebacks without manual simulator or Makefile setup.
      4
      9 npm
      1
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents and IDEs to synthesize Verilog/SystemVerilog designs with Yosys, inspect cell hierarchies and gate counts, and detect synthesis hazards like inferred latches and combinational loops before physical design flows.
      4
      10 npm
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents and IDEs to perform AST-backed semantic Verilog/SystemVerilog code reviews, catching race conditions, reset polarity mismatches, and bitwidth truncations while computing a 0–100 RTL quality score.
      4
      10 npm
      1
      Apache 2.0