EDA工具集成服务器

一个综合性的模型上下文协议(MCP)服务器,为AI助手如Claude Desktop和Cursor IDE提供电子设计自动化(EDA)工具集成,支持Verilog综合、仿真、ASIC设计流程和波形分析。

  • by NellyW8
  • JavaScript
  • 本地部署
  • 113 星标
  • 更新于
在 GitHub 查看 NellyW8/mcp-EDA

使用说明

EDA工具MCP服务器

文件的实施: MCP4EDA:LLM驱动的模型上下文协议RTL到GDSII自动化,具有后端感知综合优化

一个全面的模型上下文协议(MCP)服务器,为Claude Desktop和Cursor IDE等AI助手提供电子设计自动化(EDA)工具集成。该服务器使AI能够通过统一的接口执行Verilog合成、仿真、ASIC设计流程和波形分析。

演示

https://github.com/user-attachments/assets/65d8027e-7366-49b5-8f11-0430c1d1d3d6

EDA MCP服务器演示,展示Verilog综合、仿真和ASIC设计流程

特性

  • Verilog综合:使用Yosys为各种FPGA目标(通用、ice40、xilinx)合成Verilog代码
  • VERILOG仿真:使用Icarus Verilog模拟设计,并自动执行测试台
  • 波形查看:启动GTKWave进行VCD文件可视化和信号分析
  • ASIC设计流程:使用OpenLane和Docker集成完成RTL到GDSII流程
  • 布局查看:在KLayout中打开GDSII文件进行物理设计检查
  • 报告分析:阅读和分析OpenLane报告,了解PPA指标和设计质量评估

先决条件

在使用此MCP服务器之前,您需要安装以下EDA工具:

1.Yosys(Verilog综合)

macOS(Homebrew):

brew install yosys

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install yosys

来源:

# Install prerequisites
sudo apt-get install build-essential clang bison flex \
    libreadline-dev gawk tcl-dev libffi-dev git \
    graphviz xdot pkg-config python3 libboost-system-dev \
    libboost-python-dev libboost-filesystem-dev zlib1g-dev

# Clone and build
git clone https://github.com/YosysHQ/yosys.git
cd yosys
make -j$(nproc)
sudo make install

替代方案-OSS CAD套件(推荐): 从以下网址下载完整的工具链:https://github.com/YosysHQ/oss-cad-suite-build/releases

2.伊卡洛斯Verilog(模拟)

macOS(Homebrew):

brew install icarus-verilog

Ubuntu/Debian:

sudo apt-get install iverilog

窗户: 从以下位置下载安装程序:https://bleyer.org/icarus/

3.GTKWave(波形查看器)

直接下载(推荐):

  • 窗户: 下载自 SourceForge
  • macOS: 下载自 SourceForge 或使用Homebrew: brew install --cask gtkwave
  • Linux: 下载自 SourceForge 或使用包管理器: sudo apt-get install gtkwave

替代安装方法:

# macOS (Homebrew)
brew install --cask gtkwave

# Ubuntu/Debian
sudo apt-get install gtkwave

# Build from source (all platforms)
git clone https://github.com/gtkwave/gtkwave.git
cd gtkwave
meson setup build && cd build && meson install

4.Docker桌面(推荐用于OpenLane)

直接下载:

安装:

  1. 从官方网站下载并安装Docker Desktop
  2. 启动Docker桌面并确保其正在运行
  3. 验证安装: docker run hello-world

注: Docker Desktop将Docker引擎、Docker CLI和Docker Compose整合于一个软件包中。

5.OpenLane(ASIC设计流程)

简单安装方法(推荐):

# Install OpenLane via pip
pip install openlane

# Pull the Docker image
docker pull efabless/openlane:latest

# Verify installation
docker run hello-world

使用示例:

# Create project directory
mkdir -p ~/openlane-projects/my-design
cd ~/openlane-projects/my-design

# Create Verilog file (counter example)
cat > counter.v << 'EOF'
module counter (
    input wire clk,
    input wire rst,
    output reg [7:0] count
);
    always @(posedge clk or posedge rst) begin
        if (rst)
            count <= 8'b0;
        else
            count <= count + 1;
    end
endmodule
EOF

# Create configuration file
cat > config.json << 'EOF'
{
    "DESIGN_NAME": "counter",
    "VERILOG_FILES": ["counter.v"],
    "CLOCK_PORT": "clk",
    "CLOCK_PERIOD": 10.0
}
EOF

# Run the RTL-to-GDSII flow
python3 -m openlane --dockerized config.json

主要优势:

  • 这 --dockerized flag通过Docker自动处理所有工具依赖关系

6.KLayout(布局查看器)

直接下载(推荐):

替代安装:

# macOS (Homebrew)
brew install --cask klayout

# Ubuntu/Debian
sudo apt install klayout

安装

1.克隆并构建MCP服务器

git clone https://github.com/NellyW8/mcp-EDA
cd mcp-EDA
npm install
npm run build
npx tsc   

2.项目结构

mcp-EDA/
├── src/
│   └── index.ts          # Main server code
├── build/
│   └── index.js          # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md

配置

Docker桌面MCP集成

此方法使用Docker Desktop的内置MCP扩展,以获得最简单的设置体验。

先决条件

  • Docker桌面4.39.0+已安装并正在运行
  • 已安装Claude Desktop

设置步骤

  1. 安装Docker桌面扩展:

    • 启动Docker桌面
    • 从左侧菜单转到“扩展”
    • 搜索“AI工具”或“Docker MCP工具包”
    • 安装“实验室:面向开发者的人工智能工具”扩展
  2. 配置Docker MCP连接:

    • 打开已安装的“实验室:面向开发人员的AI工具”扩展
    • 点击右上角的齿轮图标
    • 选择“MCP客户端”选项卡
    • 点击“连接”进入“克劳德桌面”或“光标IDE”

    这会自动配置Claude Desktop和Cursor IDE:

    {
      "mcpServers": {
        "MCP_DOCKER": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "alpine/socat",
            "STDIO",
            "TCP:host.docker.internal:8811"
          ]
        }
      }
    }
    

光标IDE设置

  1. 添加您的EDA MCP服务器:

    • 找到您的Claude Desktop配置文件,设置>开发人员>编辑配置:
      • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
      • 窗户: %APPDATA%\Claude\claude_desktop_config.json
    • 将您的EDA服务器添加到现有配置中:
    {
      "mcpServers": {
        "MCP_DOCKER": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "alpine/socat",
            "STDIO",
            "TCP:host.docker.internal:8811"
          ]
        },
        "eda-mcp": {
          "command": "node",
          "args": [
            "/absolute/path/to/your/eda-mcp-server/build/index.js"
          ],
          "env": {
            "PATH": "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
            "HOME": "/your/home/directory"
          }
        }
      }
    }
    
  2. 重新启动克劳德桌面 并在“设置”>“开发人员”中验证两台服务器是否都在运行。

光标IDE设置

  1. 打开光标设置:

    • 按 Ctrl + Shift + P (Windows/Linux)或 Cmd + Shift + P (macOS)
    • 搜索“光标设置”
    • 导航到侧栏中的“MCP”
  2. 添加MCP服务器: 点击“添加新的MCP服务器”并配置:

     {
      "mcpServers": {
        "MCP_DOCKER": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "alpine/socat",
            "STDIO",
            "TCP:host.docker.internal:8811"
          ]
        },
        "eda-mcp": {
          "command": "node",
          "args": [
            "/absolute/path/to/your/eda-mcp-server/build/index.js"
          ],
          "env": {
            "PATH": "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
            "HOME": "/your/home/directory"
          }
        }
      }
    }
    
  3. 启用MCP工具:

    • 转到光标设置→ MCP
    • 启用“eda-mcp”服务器
    • 您应该看到服务器状态更改为“已连接”

使用示例

Verilog综合

Ask Claude: "Can you synthesize this counter module for an ice40 FPGA?"

module counter(
    input clk,
    input rst,
    output [7:0] count
);
    reg [7:0] count_reg;
    assign count = count_reg;
    
    always @(posedge clk or posedge rst) begin
        if (rst)
            count_reg <= 8'b0;
        else
            count_reg <= count_reg + 1;
    end
endmodule

2.Verilog仿真

Ask Claude: "Please simulate this adder with a testbench"

// Design
module adder(
    input [3:0] a,
    input [3:0] b,
    output [4:0] sum
);
    assign sum = a + b;
endmodule

// Testbench will be generated automatically or you can provide one

3.ASIC设计流程

Ask Claude: "Run the complete ASIC flow for this design with a 10ns clock period"

module simple_cpu(
    input clk,
    input rst,
    input [7:0] data_in,
    output [7:0] data_out
);
    // Your RTL design here
endmodule

完成后你会得到什么:

  • runs/RUN_*/final/gds/design.gds -最终GDSII布局
  • runs/RUN_*/openlane.log -完整的执行日志
  • runs/RUN_*/reports/ -时间、面积、功率分析报告
  • 所有中间结果(DEF文件、网表等)

4.波形分析

Ask Claude: "View the waveforms from the simulation with project ID: abc123"

故障排除

常见问题

  1. 未检测到MCP服务器:

    • 验证配置中的绝对路径
    • 检查Node.js是否已安装且可访问
    • 配置更改后重新启动Claude Desktop/Cursor
  2. Docker权限错误:

    sudo groupadd docker
    sudo usermod -aG docker $USER
    sudo reboot
    
  3. 未找到工具错误:

    • 验证工具是否已安装: yosys --version, iverilog -V, gtkwave --version
    • 检查MCP配置中的PATH环境变量
    • 在macOS上,确保包含Homebrew路径: /opt/homebrew/bin
  4. OpenLane超时:

    • 服务器对OpenLane流有10分钟的超时时间
    • 对于复杂的设计,考虑简化或运行多次迭代
  5. GTKWave/KLayout图形用户界面问题:

    • 在macOS上:GTKSave/KLayout可能需要在安全和隐私设置中手动批准
    • 在Linux上:如果使用远程系统,请确保X11转发正常工作
    • 在Windows上:确保GUI应用程序可以从命令行启动

调试

  1. 检查MCP服务器日志:

    • 克劳德桌面: ~/Library/Logs/Claude/mcp*.log (macOS)
    • 光标: 检查MCP设置面板是否有错误消息
  2. 手动测试工具:

    yosys -help
    iverilog -help
    docker run hello-world
    gtkwave --version
    klayout -v
    
  3. 验证Node.js环境:

    node --version
    npm --version
    

支持

对于问题和疑问:

  • 检查上面的故障排除部分
  • 查看MCP服务器日志
  • 手动测试单个工具
  • 打开一个包含详细错误消息和环境信息的问题

注: 此MCP服务器需要本地安装EDA工具。该服务器充当AI助手和本地EDA工具链之间的桥梁,通过自然语言交互实现复杂的硬件设计工作流程。

引用

@misc{wang2025mcp4edallmpoweredmodelcontext,
      title={MCP4EDA: LLM-Powered Model Context Protocol RTL-to-GDSII Automation with Backend Aware Synthesis Optimization}, 
      author={Yiting Wang and Wanghao Ye and Yexiao He and Yiran Chen and Gang Qu and Ang Li},
      year={2025},
      eprint={2507.19570},
      archivePrefix={arXiv},
      primaryClass={cs.AR},
      url={https://arxiv.org/abs/2507.19570}, 
}