Skip to main content
Glama

hardware-formal-mcp

Python 3.10+ License: MIT MCP 2024-11-05 Code Style: Ruff

Deterministic Model Context Protocol (MCP) Server bridging AI Coding Agents (Claude Code, Claude Desktop, Cursor) with Physical Hardware EDA (KiCad 8/9/10), RF/IPC-2221 Signal Integrity, Embedded C Formal Verification (CBMC), and ISO-14229 UDS / CAN-Bus Diagnostics.


Why This Exists

While the Model Context Protocol ecosystem has rich coverage for web APIs, databases, and SaaS workflows, hardware electronics, PCB layout verification, and safety-critical embedded C/C++ firmware remain largely disconnected from agentic coding loops. When an LLM modifies a KiCad board, a bare-metal microcontroller driver, or an automotive CAN/UDS diagnostic stack without deterministic physical and mathematical gates, subtle failures slip through:

  • PCB Copper & Signal Integrity: Uncaught DRC/ERC violations, excessive USB/CAN/Ethernet differential pair skew, under-sized power traces violating IPC-2221 thermal rise limits, or 2.4 GHz RF microstrip impedance mismatches.

  • Safety-Critical Embedded C: Integer overflows, out-of-bounds LUT indexing, division-by-zero in fixed-point sensor math, or violated actuator safety interlocks that unit tests miss on edge cases.

  • Automotive & Industrial Protocols: Multi-frame ISO 15765-2 (ISO-TP) segmentation bugs, ISO 14229 (UDS) negative response handling (NRC 0x31), and unbalanced ASAM MCD-2 MC (.A2L) calibration definitions.

hardware-formal-mcp exposes 12 zero-hallucination, deterministic verification tools over stdio JSON-RPC 2.0 with zero required core runtime dependencies (pure Python standard library core, with modular extras for kiutils, scikit-rf, wireviz, python-can/udsoncan, and diffblue/cbmc).


Related MCP server: KiCad Context MCP

Architecture

flowchart LR
    Agent["Claude Code / MCP Client"] <-->|"JSON-RPC 2.0 (stdio)"| Server["hardware-formal-mcp"]
    Server --> EDA["KiCad 10 CLI & pcbnew API"]
    Server --> RF["Hammerstad-Jensen & scikit-rf 2.4GHz"]
    Server --> CBMC["CBMC SAT/SMT Bounded Model Checker"]
    Server --> SAST["Flawfinder CWE & Lizard CCN"]
    Server --> UDS["Virtual CAN + ISO-TP + UDS + ASAM .A2L"]

Quickstart with Claude Code

Install from source or PyPI-compatible Git URL and register directly with Claude Code:

pip install "git+https://github.com/DjohnHK/hardware-formal-mcp.git#egg=hardware-formal-mcp[eda,automotive,sast]"

# Register with Claude Code CLI:
claude mcp add hardware-formal -- hardware-formal-mcp

Or add to claude_desktop_config.json:

{
  "mcpServers": {
    "hardware-formal": {
      "command": "python",
      "args": ["-m", "hardware_formal_mcp"]
    }
  }
}

Exposed MCP Tools (12 Tools)

Tool Name

Domain

Underlying Engine / Math

What It Verifies

embedded_toolchain_doctor

Diagnostics

Cross-platform discovery

Detects installed KiCad CLI, CBMC, Cppcheck, ARM/RISC-V GCC, Graphviz & Python stacks

kicad_discover_boards

KiCad EDA

Filesystem AST scan

Locates .kicad_pcb & .kicad_sch hardware designs

kicad_run_erc_and_drc

KiCad EDA

kicad-cli pcb drc & sch erc

Runs zone-refilled DRC & schematic ERC returning structured JSON violations

kicad_pcbnew_net_trace

High-Speed PCB

KiCad C++ pcbnew SWIG

Exact copper net lengths (mm), USB/CAN/ETH differential skew, min trace width, vias

kicad_ipc2221_ampacity_audit

Power Electronics

IPC-2221 + pcbnew

Trace current capacity $I_{\max}$, DC resistance ($m\Omega$), copper pours & neckdowns

kicad_rf_and_pdn_audit

RF / PDN

Hammerstad-Jensen + scikit-rf

Microstrip $Z_0$, $\varepsilon_{eff}$, $S_{11}$, $S_{21}$, VSWR & 10 MHz decoupling PDN impedance

kicad_dfm_bom_audit

PCBA / DFM

kiutils S-Expr AST

SMD/THT breakdown, IC-to-decoupling capacitor distance (mm), 3D model & LCSC BOM coverage

wireviz_harness_audit

Cable Harnesses

WireViz + Graphviz

Connector pinout continuity, wire gauge validation & SVG/TSV BOM generation

cbmc_formal_model_check

Formal Methods

diffblue/cbmc SAT/SMT

Proves zero buffer overflow, div-by-zero, signed overflow & __CPROVER_assert invariants in C

c_flawfinder_and_lizard_gate

Embedded SAST

flawfinder + lizard

C/C++/.ino CWE memory-safety scan & cyclomatic complexity hotspots

uds_isotp_virtual_can_verifier

Automotive HIL

python-can + can-isotp + udsoncan

Live multi-frame ISO-TP (0x22 0xF190 17-byte VIN) & UDS session/NRC 0x31 loopback

asam_a2l_validator

Calibration

ASAM MCD-2 MC parser

Validates .A2L block balance, CHARACTERISTIC, MEASUREMENT & COMPU_METHOD nodes


Running Tests Locally

pip install -e ".[automotive,sast,dev]"
ruff check src tests
pytest -v

License

Released under the MIT License.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      An MCP server that enables AI assistants to analyze schematics, inspect PCBs, trace connections, validate designs, and generate embedded code for KiCad projects.
      39
      195
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      A read-only MCP server for AI agents to understand KiCad projects through progressive disclosure, providing compact summaries and drill-down tools for components, nets, traces, and ERC/DRC checks without blowing context budgets.
      7
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives AI agents end-to-end control of KiCad 9+ for rule checks, manufacturing exports, production-readiness certification, and live PCB editor control.
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      AI-powered PCB design review MCP server with 93 tools for EMC, signal integrity, power integrity, thermal, and DFM analysis, supporting KiCad, ODB++, Gerber, and more, and generating audit-grade DOCX/HTML reports.
      100
      3
      AGPL 3.0