Skip to main content
Glama
agent-eda-flow MCP Server

agent-eda-flow MCP Server

by linxi27667
README.md
# agent-eda-flow

[![CI](https://github.com/linxi27667/agent-eda-flow/actions/workflows/ci.yml/badge.svg)](https://github.com/linxi27667/agent-eda-flow/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-3776AB.svg)](pyproject.toml)

**AI-native EasyEDA Pro (嘉立创 EDA 专业版) schematic & 4-layer industrial PCB workflow engine** — zero runtime pip dependencies, Phase-0 5-table hardware Datasheet freeze gate, **13 EMC-verified industrial & IoT circuit blocks**, deterministic netlist stealth-short / surge-derating auditor, zero-typo schematic-to-firmware & PCB handoff exporter (natively compatible with [`agent-mcu-flow`](https://github.com/linxi27667/agent-mcu-flow)), and an 8-tool stdio MCP server (`agent-eda mcp`).

Part of the `agent-*` cross-surface & hardware-to-firmware automation suite:
- **`agent-eda-flow`** — Hardware schematic design, EMC circuit blocks & 4-layer PCB/MCU handoff automation
- [`agent-mcu-flow`](https://github.com/linxi27667/agent-mcu-flow) — Multi-MCU firmware, CubeMX/CMSIS-SVD/ELF gates & declarative HIL closed-loop automation
- [`agent-browser-bridge`](https://github.com/linxi27667/agent-browser-bridge) — Browser CDP & semantic snapshot automation
- [`agent-desktop`](https://github.com/linxi27667/agent-desktop) — Windows UIA/vision desktop automation
- [`agent-mobile-auto`](https://github.com/linxi27667/agent-mobile-auto) — Android/iOS mobile automation

---

## Why `agent-eda-flow`?

EasyEDA Pro's native `DRC = 0` only verifies that wires have two endpoints — it **cannot** catch burnt chips caused by:
- 40V `SS34` freewheeling diodes breaking down before a 53.3V `SMBJ33CA` surge TVS clamps on a 24V solenoid rail;
- Internal LDO output pins (`STM32 VCAP`, `LAN8720A VDDCR`, `PN532 DVDD`, `USIM_VDD`) accidentally tied to external `3.3V`;
- Unterminated dual OpAmp (`LM358`) second channels oscillating into ADC channels;
- Cross-sheet Off-Page-Connector typos leaving critical signals floating on a single pin, or differential pairs (`CANH/L`, `RS485_A/B`, `ETH_TX/RX`) stealth-merged into `GND`;
- Manual pin transcription errors between hardware schematics, 4-layer PCB layout rules, and C firmware headers.

`agent-eda-flow` shifts all of those checks into deterministic CLI & MCP gates before a single board goes to fabrication.

---

## Architecture

```text
agent-eda-flow/
├── src/agent_eda_flow/
│   ├── cli.py                   # Unified `agent-eda` CLI (detect / init / spec-check / blocks / audit / handoff / mcp)
│   ├── spec_gate.py             # Phase-0 5-table hardware Datasheet & thermal/surge freeze gate
│   ├── blocks.py                # Declarative circuit-block loader & multi-channel isolated instantiator
│   ├── data/industrial_blocks.json  # 13 production-verified EMC industrial & IoT circuit blocks (LCSC SYS_LIB)
│   ├── sch_kit.py               # 5-mil grid, Off-Page-Connector rotation truth, 4-pin crystal & zero-overflow Bento frames
│   ├── audit.py                 # Netlist truth auditor (single-pin, stealth shorts, surge derating, OpAmp & BOM LCSC gates)
│   ├── handoff.py               # Exports `hardware_spec.json` (for agent-mcu-flow), `board_pins.h` (C11) & `pcb_constraints.json`
│   └── mcp_server.py            # Zero-dependency 8-tool JSON-RPC stdio MCP server
├── legacy_bridge/               # Official EasyEDA Pro Extension API helper scripts
├── examples/stm32f407-industrial-4g/
├── skills/agent-eda-flow/SKILL.md
└── tests/test_agent_eda_flow.py
```

---

## Built-in Verified Industrial & IoT Circuit Blocks (13 Blocks)

| Block ID | Category | Verified Circuit Topology & EMC Highlights |
| :--- | :---: | :--- |
| `ind.power.24v_surge_entry` | `power` | 24V industrial entry: `36V PPTC -> 10D390K MOV // SMCJ33CA (VC=53.3V) // 1nF -> 100V SS510C` + isolated sensor branch |
| `ind.power.buck_24v_5v_tps54360` | `power` | `TPS54360DDAR` 60V/3.5A Buck (`8.2uH` shielded inductor, `SS56`, `523k/84.5k` UVLO, `39pF C0G` Type-II compensation) |
| `ind.power.ldo_5v_3v3_cmos` | `power` | `ME6217C33M5G` pure low-ESR MLCC 3.3V rail (`Pin 4 = NC`, `Pin 2` thermal ground vias) |
| `ind.power.ldo_5v_3v8_4g_mic29302` | `power` | `MIC29302WU-HX` 3A MCU-gated `3.80V` cellular rail (`330Ω` min preload preventing >4.3V float + `100uF` MnO2 + RF `33pF/10pF C0G`) |
| `ind.analog.adc_24v_lm358_buffer` | `analog` | `100k/10k 1%` divider + `LM358` follower + `1kΩ + 100nF` SAR charge bucket + unused Ch2 anti-oscillation tie |
| `ind.io.di_24v_opto_el357n` | `io` | 24V isolated input: `1206 5.1kΩ 1/4W` + `680Ω` anti-ghosting shunt + `1N4148WS` reverse clamp + `EL357N` + `SMAJ33CA` |
| `ind.io.do_24v_highside_pmos` | `io` | Fail-safe 24V high-side solenoid switch: `MMBT5551` (160V) + `IRFR5305` + `BZT52C15` gate clamp + `33V PPTC` + `100V SS310SMA` + `SMBJ33CA` |
| `ind.io.relay_220vac_uln2003` | `io` | `ULN2003` (`COM` flyback tied) + `HF32F` 250VAC relay (`>=2.6mm` 4-layer copper keepout + physical anti-creepage slot) |
| `ind.bus.rs485_thvd1410` | `bus` | `THVD1410DR` + `2.2Ω 1206` pulse decoupling + jumper-selectable `120Ω` + fail-safe bias + asymmetric `-7V/+12V PSM712` |
| `ind.bus.can_sn65hvd230` | `bus` | `SN65HVD230DR` 3.3V CAN + `10kΩ RS` slope control + `60.4Ω + 60.4Ω + 4.7nF` split termination + `PESD1CAN,215` |
| `ind.eth.lan8720a_rmii_50m` | `eth` | `LAN8720A` + `50MHz` active oscillator (dual `33Ω`) + `nINTSEL=1 / REGOFF=0` + RMII RX `3×33Ω` + `HR911105A` (`1nF/2kV`) |
| `ind.rf.pn532_nfc_an144520` | `rf` | `PN532` (`P35=NC`, internal `DVDD` loopback, `560nH 400mA` wirewound inductors, NXP `AN144520` pre-balun RX tap, IPEX/SMA) |
| `ind.rf.eg800ak_cat1_gnss` | `rf` | `EG800AK` 4G Cat.1+GNSS (`1.8V` IO notes, `TPD4E001` SIM ESD, `USB_BOOT` guard, zero-stub `50Ω` `π` DNP matching) |

---

## Quick Start

```bash
# Install with uv (zero runtime pip dependencies)
uv sync --extra dev

# 1. List & instantiate a verified industrial circuit block (multi-channel safe)
uv run agent-eda blocks list
uv run agent-eda blocks instantiate ind.io.do_24v_highside_pmos --instance 0 --bind MCU_DO=MCU_OUTPUT0

# 2. Enforce Phase-0 5-table hardware Datasheet freeze gate & .enet electrical audit
uv run agent-eda spec-check examples/stm32f407-industrial-4g/design-spec.md
uv run agent-eda audit --enet examples/stm32f407-industrial-4g/sample_clean.enet --spec examples/stm32f407-industrial-4g/design-spec.md

# 3. Export downstream firmware (`hardware_spec.json` + `board_pins.h`) & 4-layer PCB constraints
uv run agent-eda handoff --enet examples/stm32f407-industrial-4g/sample_clean.enet --out-dir ./handoff --project lift_ctrl

# 4. Start 8-tool zero-dependency stdio MCP server
uv run agent-eda mcp
```

## MCP Server Tools (`agent-eda mcp`, 8 Tools)

`eda_detect_env` · `eda_init_workspace` · `eda_spec_check` · `eda_blocks_list` · `eda_block_show` · `eda_block_instantiate` · `eda_audit_netlist` · `eda_export_handoff`