Skip to main content
Glama

jlceda-mcp-server

本项目上传的文件完全由opus4.6完成,有问题请问agent

嘉立创 EDA MCP Server — 让 AI 编程助手直接操控嘉立创 EDA 的 PCB 自动化工具集。

通过 Model Context Protocol 暴露 39 个 PCB/原理图工具,在 Claude Code / Cursor / Windsurf 等 AI IDE 中直接执行元件移动、走线、铺铜、DRC 等操作。内置 PCB Agent 可自主编排多步操作完成复杂任务。

架构

AI IDE ──stdio──> mcp-server ──WebSocket──> gateway ──> jlc-bridge 插件 ──> 嘉立创 EDA

MCP server 通过 stdio 与 AI IDE 通信,内部维护 WebSocket 连接到 gateway 的 /ws/bridge 端点,转发命令给 jlc-bridge 插件控制 EDA 编辑器。

本仓库包含两个组件:

  • src/ — MCP Server(Node.js,39 个 PCB/原理图工具 + Agent)

  • jlc-bridge/ — 嘉立创 EDA 扩展插件(运行在 EDA 内部,执行实际操作)

Related MCP server: KiCad MCP Server

前置条件

  • Node.js >= 18

  • gateway 运行中(默认端口 18800)

  • jlc-bridge 插件已连接嘉立创 EDA

安装 & 构建

npm install
npm run build

配置

在你的项目目录下创建 .mcp.json:

{
  "mcpServers": {
    "jlceda": {
      "command": "node",
      "args": ["<path-to>/jlceda-mcp-server/dist/index.js"],
      "env": {
        "GATEWAY_WS_URL": "ws://127.0.0.1:18800/ws/bridge",
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

配置完成后重启 AI IDE,即可在对话中使用所有工具。

环境变量

变量

默认值

说明

GATEWAY_WS_URL

ws://127.0.0.1:18800/ws/bridge

Gateway WebSocket 地址

ANTHROPIC_API_KEY

—

Anthropic API Key(设置后启用 pcb_agent 工具)

AGENT_MODEL

claude-sonnet-4-20250514

Agent 使用的模型

工具清单 (39 个)

状态查询 (9)

工具

说明

pcb_get_state

获取 PCB 完整状态(元件、网络、板框)

pcb_screenshot

截取编辑器截图(base64 PNG)

pcb_run_drc

运行 PCB 设计规则检查

pcb_get_tracks

查询走线段,可按网络/层过滤

pcb_get_pads

查询焊盘信息,可按位号过滤

pcb_get_net_primitives

查询指定网络的所有图元

pcb_get_board_info

获取工程信息

pcb_get_feature_support

查询 bridge 支持的功能列表

pcb_ping

检查 bridge 连接状态

元件操作 (6)

工具

说明

pcb_move_component

移动元件到指定坐标

pcb_relocate_component

安全搬迁元件(自动断开走线)

pcb_batch_move

批量移动多个元件

pcb_select_component

在编辑器中选中元件

pcb_delete_selected

删除当前选中的对象

pcb_create_component

从库中放置元件到 PCB

走线 / 过孔 (4)

工具

说明

pcb_route_track

画走线(指定网络、路径点、层、线宽)

pcb_create_via

创建过孔

pcb_delete_tracks

删除走线

pcb_delete_via

删除过孔

铺铜 / 禁布区 (4)

工具

说明

pcb_create_copper_pour

创建矩形铺铜区域

pcb_delete_pour

删除铺铜

pcb_create_keepout

创建矩形禁布区

pcb_delete_keepout

删除禁布区

丝印 (3)

工具

说明

pcb_get_silkscreens

查询所有丝印文字

pcb_move_silkscreen

移动丝印

pcb_auto_silkscreen

自动排列丝印(避免重叠)

高级约束 (6)

工具

说明

pcb_create_diff_pair

创建差分对

pcb_list_diff_pairs

列出所有差分对

pcb_delete_diff_pair

删除差分对

pcb_create_equal_length

创建等长组

pcb_list_equal_lengths

列出所有等长组

pcb_delete_equal_length

删除等长组

原理图 / 文档 (4)

工具

说明

sch_get_state

读取原理图状态

sch_get_netlist

导出网表

sch_run_drc

运行原理图 DRC

pcb_open_document

切换到指定文档(原理图或 PCB)

PCB Agent (1)

工具

说明

pcb_agent

智能 Agent — 给出高层任务,自主编排多步操作完成(需 ANTHROPIC_API_KEY)

计算工具 (2)

工具

说明

calc_impedance

计算走线阻抗,或根据目标阻抗反算线宽(微带线/带状线/差分)

calc_trace_width

根据载流要求计算最小走线宽度 (IPC-2221)

所有坐标参数单位为 mil(密耳),与嘉立创 EDA bridge 一致。

项目结构

├── src/                          # MCP Server 源码
│   ├── index.ts                  # MCP 入口(stdio transport)
│   ├── bridge-client.ts          # WebSocket 客户端,连接 gateway bridge
│   ├── calculators.ts            # 阻抗/线宽纯计算函数
│   ├── agent.ts                  # PCB Agent 核心(工具注册表 + tool-use 循环)
│   └── tools/
│       ├── state.ts              # 状态查询 (7)
│       ├── components.ts         # 元件操作 (3)
│       ├── routing.ts            # 走线/过孔 (4)
│       ├── copper-keepout.ts     # 铺铜/禁布区 (4)
│       ├── silkscreen.ts         # 丝印 (3)
│       ├── advanced.ts           # 差分对/等长组 (4)
│       ├── schematic.ts          # 原理图 (3)
│       ├── calculators.ts        # 阻抗/线宽计算工具 (2)
│       └── agent.ts              # PCB Agent 工具注册 (1)
├── jlc-bridge/                   # 嘉立创 EDA 扩展插件
│   ├── src/index.ts              # 插件主入口(2700+ 行)
│   ├── extension.json            # 插件清单
│   ├── build/pack.js             # 打包脚本(生成 .eext/.lcex)
│   ├── package.json
│   └── tsconfig.json
├── dist/                         # MCP Server 编译输出
├── package.json
└── tsconfig.json

核心模块

bridge-client.ts

WebSocket 客户端,连接 gateway /ws/bridge。

  • 协议:发送 {type:'command', id, timestamp, payload:{action, params}},接收 {type:'result', payload:{commandId, success, data, error}}

  • 命令超时 60 秒

  • 断线自动重连(3 秒间隔)

  • 懒连接:首次调用 command() 时才建立 WebSocket

agent.ts

PCB 智能 Agent 核心,基于 Anthropic Claude API 的 tool-use 循环。

  • 工具注册表:将 28 个 bridge 动作映射为 Anthropic tool-use 格式

  • Agent 循环:system prompt → messages.create → 执行 tool_use → 追加 tool_result → 继续循环

  • 最大轮次限制(默认 20),防止无限循环

  • 收集每步执行日志,最终一起返回

  • 零额外基础设施,纯 @anthropic-ai/sdk 实现

jlc-bridge 插件

运行在嘉立创 EDA 内部的扩展插件,负责执行实际的 PCB/原理图操作。

  • 通过 WebSocket 连接 gateway,接收并执行命令

  • 支持文件轮询回退(当 WebSocket 不可用时)

  • 50+ 个底层操作函数(元件移动、走线、铺铜、DRC 等)

  • 打包为 .eext / .lcex 格式,在嘉立创 EDA 扩展管理器中安装

构建插件:

cd jlc-bridge
npm install
npm run build    # 编译 + 打包为 .eext

使用示例

在 AI IDE 中直接用自然语言:

> 获取当前 PCB 状态
  → 调用 pcb_get_state

> 把 U1 移到 (1000, 2000)
  → 调用 pcb_move_component {designator:"U1", x:1000, y:2000}

> 运行 DRC 检查
  → 调用 pcb_run_drc

> 在 GND 网络顶层铺铜,范围 (0,0) 到 (2000,4000)
  → 调用 pcb_create_copper_pour {net:"GND", layer:1, x1:0, y1:0, x2:2000, y2:4000}

> 创建 USB 差分对
  → 调用 pcb_create_diff_pair {name:"USB", posNet:"USB_DP", negNet:"USB_DN"}

> 分析当前布局并给出优化建议
  → 调用 pcb_agent {task:"分析当前布局并给出优化建议"}
  → Agent 自主调用 get_state → 分析 → 给出建议

验证

# 编译
npm run build

# 测试 MCP 协议(不需要 gateway)
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":0}
{"jsonrpc":"2.0","method":"tools/list","id":1}' | node dist/index.js

# 端到端测试(需要 gateway + jlc-bridge 运行)
# 在 AI IDE 中说 "获取当前 PCB 状态" 即可验证

技术栈

License

MIT

Available Tools

43 tools
calc_impedanceB

计算 PCB 走线阻抗,或根据目标阻抗反算线宽。支持微带线/带状线/差分模式

Inputs: type (required), height (required), er, width, +3 more.

calc_trace_widthA

根据载流要求计算最小走线宽度 (IPC-2221)

Inputs: current (required), layer, tempRise, thickness.

pcb_auto_silkscreenA

自动排列所有丝印(避免重叠)

Inputs: no named parameters.

pcb_batch_moveB

批量移动多个元件

Inputs: moves (required).

pcb_create_componentB

从库中放置元件到 PCB

Inputs: x (required), y (required), layer (required), libraryUuid (required), +2 more.

pcb_create_copper_pourC

创建矩形铺铜区域

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +2 more.

pcb_create_diff_pairC

创建差分对

Inputs: name (required), negNet (required), posNet (required).

pcb_create_equal_lengthC

创建等长组

Inputs: name (required), nets (required).

pcb_create_keepoutC

创建矩形禁布区

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +1 more.

pcb_create_viaC

创建过孔

Inputs: x (required), y (required), net (required), drill (required), +1 more.

pcb_delete_diff_pairB

删除差分对

Inputs: name (required).

pcb_delete_equal_lengthC

删除等长组

Inputs: name (required).

pcb_delete_keepoutB

删除禁布区

Inputs: primitiveId (required).

pcb_delete_pourC

删除铺铜

Inputs: primitiveId (required).

pcb_delete_selectedB

删除当前选中的对象

Inputs: no named parameters.

pcb_delete_tracksC

删除走线

Inputs: primitiveIds (required).

pcb_delete_viaC

删除过孔

Inputs: primitiveIds (required).

pcb_get_board_infoB

获取工程信息(板名、层数等)

Inputs: no named parameters.

pcb_get_feature_supportA

查询 bridge 支持的功能列表

Inputs: no named parameters.

pcb_get_net_primitivesB

查询指定网络的所有图元

Inputs: net (required).

pcb_get_padsB

查询焊盘信息

Inputs: designator.

pcb_get_silkscreensB

查询所有丝印文字

Inputs: no named parameters.

pcb_get_stateB

获取 PCB 完整状态(元件、网络、板框等)

Inputs: no named parameters.

pcb_get_tracksC

查询走线段

Inputs: net, layer.

pcb_list_diff_pairsA

列出所有差分对

Inputs: no named parameters.

pcb_list_equal_lengthsA

列出所有等长组

Inputs: no named parameters.

pcb_move_componentB

移动元件到指定坐标 (mil)

Inputs: x (required), y (required), designator (required), rotation.

pcb_move_silkscreenC

移动丝印文字

Inputs: x (required), y (required), primitiveId (required), rotation.

pcb_open_documentC

切换到指定文档(原理图或 PCB)

Inputs: uuid (required).

pcb_pingB

检查 bridge 连接状态

Inputs: no named parameters.

pcb_relocate_componentB

安全搬迁元件(自动断开走线)

Inputs: x (required), y (required), designator (required), rotation.

pcb_route_trackC

画走线

Inputs: net (required), layer (required), width (required), points (required).

pcb_run_drcA

运行 PCB 设计规则检查 (DRC)

Inputs: no named parameters.

pcb_screenshotA

截取当前 PCB 编辑器截图

Inputs: no named parameters.

pcb_select_componentB

在编辑器中选中元件

Inputs: designator (required).

sch_clear_schematicA

清空当前原理图的所有元件/导线/网络标号/连接点(重绘前清理)

Inputs: no named parameters.

sch_create_componentA

在原理图放置元件。可直接传 libraryUuid+uuid,或传 lcsc/query 由 easyeda-agent 自动解析 device identity(路线1:LCSC 取件解析器)。先试 JLCMCP 原生创建,失败降级委派 easyeda-agent。

Inputs: x (required), y (required), lcsc, uuid, +5 more.

sch_create_junctionB

在原理图放置连接点(junction)

Inputs: x (required), y (required).

sch_create_netlabelA

在原理图放置网络标号(绑定到导线上)

Inputs: x (required), y (required), net (required), orientation.

sch_create_wireA

在原理图绘制正交导线(points 为 "x1 y1 x2 y2 ..." 空格分隔的点串)

Inputs: points (required), color, lineWidth.

sch_get_netlistC

导出网表

Inputs: type.

sch_get_stateB

读取原理图状态

Inputs: no named parameters.

sch_run_drcB

运行原理图 DRC

Inputs: strict.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 43 tools

    Disambiguation3/5

    Most tools are separated by domain prefixes and resource types, but pcb_relocate_component, pcb_move_component, and pcb_batch_move are easily confused; read operations also mix get/list/query with overlapping scopes. Descriptions are often terse, so an agent may pick the wrong movement or query tool.

    Naming Consistency4/5

    Tool names consistently use snake_case and domain prefixes (pcb_, sch_, calc_), with mostly verb_noun structure. Minor inconsistencies exist: delete_tracks is plural while delete_via is singular, and read operations alternate between get_, list_, and query_.

    Tool Count2/5

    43 tools is a large surface for an agent to navigate; while EDA automation is broad, many operations overlap in purpose and the count exceeds what is needed for a coherent tool set. It feels more like a full API dump than a curated MCP surface.

    Completeness4/5

    The set covers the main PCB workflow: components, routing, vias, pours, keepouts, silkscreen, diff pairs, equal-length tuning, DRC, schematic entry, netlist export, and calculators. Gaps include no dedicated schematic object deletion (only clear-all) and no component editing beyond placement/movement, but these are workable.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server for AI-assisted PCB design with EasyEDA Pro, enabling inspection, review, and automation of schematics, PCBs, and manufacturing export.
      1
      4
      Apache 2.0
    • A
      license
      B
      quality
      B
      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
      184
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Enables AI coding assistants to control JLCPCB EDA for PCB automation, exposing 39 tools for component manipulation, routing, copper pour, DRC, and more. Includes a built-in PCB agent for orchestrating multi-step tasks.
      59
      276
      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