easyeda-standard-mcp
by Alfa16bravo
README.md
# easyeda-standard-mcp
An [MCP](https://modelcontextprotocol.io) server that lets an AI assistant (Claude Code, Claude Desktop, …) drive
**EasyEDA Standard**: read, draw, wire and check schematics and PCBs, search the LCSC/EasyEDA part library, and
export BOM / pick-and-place files.
68 tools. Developed and tested against the EasyEDA Standard desktop client **6.5.61** on Windows, Node.js ≥ 20.
EasyEDA **Pro** is not supported (different API).
## How it works
```
AI assistant ──MCP (stdio)──> this server ──WebSocket 127.0.0.1:3579──> "MCP Bridge" script inside EasyEDA
└── fallback: the desktop client's local debugging port
```
A small script (`extension/main.js`) runs inside the EasyEDA window and executes requests through EasyEDA's own
extension API. The server gets it there in one of two ways:
- **Automatic (recommended)** – the `easyeda_connect` tool starts the EasyEDA desktop client with a local
debugging port and injects the script. Nothing to install in EasyEDA. If EasyEDA is already running, close it
first so it can be restarted with that port.
- **Extension** – in EasyEDA: *Advanced → Extensions → Extensions Setting… → Load Extension…*, select all files
of the `extension/` folder, name it `mcpbridge`, *Load*. An **MCP ○/●** button appears in the toolbar
(● = connected).
> Port 3579 is not a free choice: easyeda.com's Content-Security-Policy only allows local connections to
> `ws://127.0.0.1:3579` (the port of EasyEDA's local auto-router). Do not run the local auto-router at the same time.
## Install
```bash
git clone https://github.com/Alfa16bravo/easyeda-standard-mcp.git
cd easyeda-standard-mcp
npm install
npm test
```
**Claude Code**
```bash
claude mcp add easyeda -- node /absolute/path/to/easyeda-standard-mcp/src/index.js
```
**Claude Desktop** (`claude_desktop_config.json`) or any other MCP client:
```json
{
"mcpServers": {
"easyeda": { "command": "node", "args": ["/absolute/path/to/easyeda-standard-mcp/src/index.js"] }
}
}
```
Then ask the assistant to *connect to EasyEDA*.
Optional environment variables:
| Variable | Default | Purpose |
|---|---|---|
| `EASYEDA_EXE` | auto-detected | Path to the EasyEDA desktop executable |
| `EASYEDA_DEBUG_PORT` | `9333` | Debugging port used to start/attach the desktop client |
| `EASYEDA_MCP_PORT` | `3579` | Bridge WebSocket port (only 3579 passes easyeda.com's CSP) |
| `EASYEDA_AUTOCONNECT` | – | `1` = start/attach EasyEDA as soon as the server starts |
## Tools
| Group | Tools |
|---|---|
| **System** | `easyeda_connect` `easyeda_status` `easyeda_eval` `easyeda_api_call` `easyeda_editor_call` `easyeda_ui_command` `easyeda_dialog` `easyeda_list_commands` |
| **Document** | `doc_get_info` `doc_get_source` `doc_apply_source` `doc_new` `doc_save` `doc_list_tabs` `doc_switch_tab` `doc_close_tab` `doc_screenshot` |
| **Editing** | `list_objects` `get_object` `update_object` `delete_objects` `selection` `move_objects` `transform_objects` `clone_objects` `edit_history` `view_control` `canvas_config` `convert_units` |
| **Schematic** | `sch_list_components` `sch_get_component` `sch_place_component` `sch_set_component` `sch_annotate` `sch_draw_wire` `sch_connect` `sch_place_netlabel` `sch_place_power` `sch_place_marker` `sch_add_text` `sch_draw_shape` `sch_get_netlist` `sch_check` `sch_get_bom` `sch_to_pcb` |
| **PCB** | `pcb_get_board_info` `pcb_list_components` `pcb_get_component` `pcb_list_nets` `pcb_place_footprint` `pcb_draw_track` `pcb_place_via` `pcb_place_pad` `pcb_place_hole` `pcb_add_text` `pcb_draw_shape` `pcb_set_board_outline` `pcb_add_copper_area` `pcb_add_solid_region` `pcb_layers` `pcb_unroute` `pcb_get_pick_and_place` `pcb_get_bom` `pcb_drc` `pcb_fabrication` |
| **Library** | `lib_search` `lib_get_component` (LCSC/EasyEDA parts: pinout, footprint, price, stock – no EasyEDA needed) |
| **Files** | `file_analyze` (offline analysis of an exported EasyEDA `.json`) |
Highlights:
- `sch_place_component` places a part by LCSC number and returns its pin coordinates; `sch_get_netlist` and
`sch_check` compute the real connectivity so the assistant can verify its own wiring.
- `sch_to_pcb` creates a PCB from the active schematic (footprints, designators and pad nets), even for an
unsaved schematic, and can update an existing PCB after a schematic change.
- `doc_screenshot` returns a PNG of the schematic or board so the assistant can look at the result.
- `easyeda_eval`, `easyeda_api_call`, `easyeda_editor_call` and `easyeda_ui_command` give raw access to
everything else (`easyeda_list_commands` lists about 480 EasyEDA commands).
Units: schematics use canvas pixels (10 px grid); PCB tools take millimetres by default, relative to the canvas
origin, Y axis pointing down. Every change can be undone with `edit_history`.
## Limitations
- Saving a new document, Gerber generation, 3D view and the auto-router end in EasyEDA dialogs; the server
triggers them and `easyeda_dialog` can read and click the dialogs, but these paths are lightly tested.
- There is no automatic routing: tracks are drawn from coordinates chosen by the assistant.
- `sch_get_netlist` covers the active sheet only, not a whole multi-sheet project.
- A PCB created by `sch_to_pcb` is not linked to the schematic for EasyEDA's own *Update PCB* button; re-run
`sch_to_pcb` with `target: "update"` instead.
- Only the automatic connection to the desktop client has been tested end to end; loading the extension by
hand and using EasyEDA in a browser rely on the same script but are untested.
- The server relies on EasyEDA internals observed in version 6.5.61 and may need changes for other versions.
## Development
```bash
node scripts/mcp-call.js --list # list the tools
node scripts/mcp-call.js easyeda_status # call a tool like an MCP client would
node scripts/run.js "return H.tabs()" # run JavaScript inside EasyEDA
npm run inject # (re)inject extension/main.js into EasyEDA
```
`src/index.js` (server) · `src/bridge.js` (WebSocket + debugging-port fallback) · `src/cdp.js` (launch/inject) ·
`src/page.js` (helpers run in the page) · `src/analysis.js` (netlist, BOM, PCB analysis – unit tested) ·
`src/tools/` (tools by domain) · `extension/` (the bridge script).
## Notes
- Component data returned by the library tools comes from the **JLCEDA/EasyEDA Official Library**
(<https://easyeda.com>, <https://lceda.cn/>); its licence requires this attribution, which the tools include in
their output.
- This project is not affiliated with or endorsed by EasyEDA, JLCPCB or LCSC.
## License
[MIT](LICENSE)