EDA-MCP-Server

dukeceicenter/EDA-MCP-Server

3.2

If you are the rightful owner of EDA-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is designed to facilitate intelligent automation in electronic design automation (EDA) by integrating multiple tools through a unified interface.

Tools
  1. Synopsys Design Compiler

    Used for synthesis in the design flow.

  2. Cadence Innovus

    Used for physical implementation in the design flow.

MCP EDA - Model Context Protocol for Electronic Design Automation

Python 3.9+ FastAPI

A comprehensive Model Context Protocol (MCP) based Electronic Design Automation (EDA) system that provides intelligent automation for digital design implementation flows. This system integrates multiple EDA tools through a unified MCP interface, enabling natural language-driven design automation with experimental evaluation framework.

Features

  • AI-Powered Automation: Natural language interface for EDA operations using GPT-4
  • Multi-Tool Integration: Seamless integration of Synopsys Design Compiler and Cadence Innovus
  • Complete Design Flow: End-to-end digital design implementation from RTL to GDSII
  • RESTful API: Standardized HTTP API for all EDA operations
  • Real-time Monitoring: Live status tracking and detailed logging
  • Modular Architecture: Independent microservices for each design stage
  • Configuration Management: CSV-based parameter management for design optimization
  • Experimental Framework: Comprehensive TCL accuracy evaluation system
  • Multiple Design Support: Support for various benchmark designs (des, b14, leon2, etc.)

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User Query    │───▢│  MCP Agent      │───▢│  MCP Servers    β”‚
β”‚  (Natural Lang) β”‚    β”‚  Client (8000)  β”‚    β”‚  (13333-13440)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚                       β”‚
                                β–Ό                       β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚   OpenAI GPT-4  β”‚    β”‚   EDA Tools     β”‚
                       β”‚   (Tool Select) β”‚    β”‚  (DC/Innovus)   β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

MCP Server Architecture

ServicePortEndpointDescription
MCP Agent Client8000/agentMain interface for natural language processing
Synthesis Setup13333/setup/runRTL synthesis setup and configuration
Synthesis Compile13334/compile/runRTL-to-gate synthesis compilation
Floorplan13335/floorplan/runChip floorplanning and I/O placement
Power Planning13336/power/runPower distribution network generation
Placement13337/place/runStandard cell placement optimization
Clock Tree Synthesis13338/cts/runClock distribution network synthesis
Routing13339/route/runSignal routing and optimization
Save Design13440/save/runFinal design saving and output generation

Experimental Framework

The project includes a comprehensive experimental framework for evaluating TCL generation accuracy across different methods:

Experiment Methods

  1. Baseline1: Pure LLM-based TCL generation
  2. Baseline2: LLM + template-based generation
  3. Ours: MCP agent with real EDA tool execution

Experiment Structure

experiment/
β”œβ”€β”€ generate/                    # TCL generation scripts
β”‚   β”œβ”€β”€ baseline1_generate.py   # Pure LLM generation
β”‚   β”œβ”€β”€ baseline2_generate.py   # LLM + template generation
β”‚   β”œβ”€β”€ ours_generate.py        # MCP agent generation
β”‚   └── common_config.py        # Shared configuration
β”œβ”€β”€ evaluate/                    # Evaluation scripts
β”‚   β”œβ”€β”€ tcl_evaluator.py        # Main evaluator
β”‚   └── evaluation_metrics.py   # Quality metrics
β”œβ”€β”€ results/                     # Generation results
β”œβ”€β”€ evaluation_results/          # Evaluation reports
└── run_experiment.py           # Main experiment runner

Running Experiments

# Run complete experiment (generate + evaluate)
cd experiment
python run_experiment.py --full

# Run only generation for specific methods
python run_experiment.py --generate baseline1 ours

# Run only evaluation on existing results
python run_experiment.py --evaluate

# Clean previous results
python run_experiment.py --clean --full

Prerequisites

Software Requirements

  • Python 3.9+
  • Synopsys Design Compiler (for synthesis)
  • Cadence Innovus (for physical implementation)
  • FreePDK45 technology library
  • OpenAI API Key (for GPT-4 integration)

System Requirements

  • OS: Linux (tested on Ubuntu 20.04+)
  • Memory: 8GB RAM minimum (16GB+ recommended)
  • Storage: 10GB free space for design files and logs
  • Network: Local network access for inter-service communication

Installation

Option 1: Docker Deployment (Recommended)

Due to licensing restrictions of commercial EDA tools, we use a hybrid Docker approach:

# Clone the repository
git clone https://github.com/AndyLu666/MCP-EDA-Server.git
cd MCP-EDA-Server

# Copy environment template
cp docker/env.example .env

# Edit .env file with your configuration
# - Set your OpenAI API key
# - Configure EDA tools host
# - Set license file paths

# Deploy using Docker
chmod +x docker/deploy.sh
./docker/deploy.sh deploy

Note: EDA tools (Design Compiler, Innovus) must be installed on the host system with valid licenses. The Docker containers communicate with these tools via network.

Option 2: Local Installation

1. Clone the Repository
git clone https://github.com/AndyLu666/MCP-EDA-Server.git
cd MCP-EDA-Server
2. Set Up Python Environment
# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
3. Configure Environment Variables

Create a .env file in the project root:

# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# MCP Server Configuration
MCP_SERVER_HOST=http://localhost

# Optional: Custom ports (defaults shown)
SETUP_PORT=13333
COMPILE_PORT=13334
FLOORPLAN_PORT=13335
POWER_PORT=13336
PLACE_PORT=13337
CTS_PORT=13338
ROUTE_PORT=13339
SAVE_PORT=13440
4. Verify EDA Tools Installation
# Check Design Compiler
which dc_shell

# Check Innovus
which innovus

# Verify FreePDK45 library
ls libraries/FreePDK45/

Quick Start

1. Start MCP Agent Client

# Terminal 1: Start the main agent
conda activate eda310  # or your conda environment
uvicorn mcp_agent_client:app --reload --host 0.0.0.0 --port 8000

2. Start MCP Servers

# Terminal 2: Start all MCP servers
./restart_servers.sh

# Or start individually:
cd server
python3 synth_setup_server.py --port 13333 &
python3 synth_compile_server.py --port 13334 &
python3 floorplan_server.py --port 13335 &
python3 powerplan_server.py --port 13336 &
python3 placement_server.py --port 13337 &
python3 cts_server.py --port 13338 &
python3 route_server.py --port 13339 &
python3 save_server.py --port 13440 &

3. Run Your First Design

# Test with the example design
curl -X POST http://localhost:8000/agent \
  -H "Content-Type: application/json" \
  -d '{"user_query":"Run synth_setup for design=\"des\" and return the log path."}'

Usage Guide

Natural Language Interface

The MCP Agent Client understands natural language queries and automatically selects the appropriate EDA tool:

# Synthesis
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_setup for design=\"my_design\" and return the log path."}'

curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_compile for design=\"my_design\" and return the log path."}'

# Physical Implementation
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run floorplan for design=\"my_design\", top_module=\"my_module\" and return the path to floorplan.enc.dat."}'

curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run placement for design=\"my_design\", top_module=\"my_module\" and return the path to placement.enc.dat."}'

curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run routing for design=\"my_design\", top_module=\"my_module\" and return the path to route_opt.enc.dat."}'

curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run save for design=\"my_design\", top_module=\"my_module\" and return the archive path."}'

Complete Design Flow Example

# 1. Synthesis Setup
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_setup for design=\"des\" and return the log path."}'

# 2. Synthesis Compile
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_compile for design=\"des\" and return the log path."}'

# 3. Floorplan
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run floorplan for design=\"des\", top_module=\"des3\" and return the syn_ver and the path to floorplan.enc.dat."}'

# 4. Power Planning
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run powerplan for design=\"des\", top_module=\"des3\", impl_ver=\"cpV1_clkP1_drcV1__g0_p0\" and return the path to powerplan.enc.dat."}'

# 5. Placement
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run placement for design=\"des\", top_module=\"des3\", impl_ver=\"cpV1_clkP1_drcV1__g0_p0\" and return the path to placement.enc.dat."}'

# 6. Clock Tree Synthesis
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run CTS for design=\"des\", top_module=\"des3\", impl_ver=\"cpV1_clkP1_drcV1__g0_p0\" and return the path to cts.enc.dat."}'

# 7. Routing
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run routing for design=\"des\", top_module=\"des3\", impl_ver=\"cpV1_clkP1_drcV1__g0_p0\" and return the path to route_opt.enc.dat."}'

# 8. Save Design
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run save for design=\"des\", top_module=\"des3\", impl_ver=\"cpV1_clkP1_drcV1__g0_p0\" and return the archive path."}'

Project Structure

mcp-eda-example/
β”œβ”€β”€ designs/                    # Design source files and results
β”‚   β”œβ”€β”€ des/                   # DES encryption design
β”‚   β”‚   β”œβ”€β”€ rtl/              # RTL source files
β”‚   β”‚   β”œβ”€β”€ FreePDK45/        # Technology-specific results
β”‚   β”‚   β”‚   β”œβ”€β”€ synthesis/    # Synthesis outputs
β”‚   β”‚   β”‚   └── implementation/ # Physical implementation
β”‚   β”‚   └── config.tcl        # Design configuration
β”‚   β”œβ”€β”€ b14/                  # VHDL benchmark design
β”‚   β”œβ”€β”€ leon2/                # LEON2 processor design
β”‚   └── des3/                 # Additional designs
β”œβ”€β”€ server/                    # MCP server implementations
β”‚   β”œβ”€β”€ synth_setup_server.py    # Synthesis setup service
β”‚   β”œβ”€β”€ synth_compile_server.py  # Synthesis compile service
β”‚   β”œβ”€β”€ floorplan_server.py      # Floorplanning service
β”‚   β”œβ”€β”€ powerplan_server.py      # Power planning service
β”‚   β”œβ”€β”€ placement_server.py      # Placement service
β”‚   β”œβ”€β”€ cts_server.py           # Clock tree synthesis service
β”‚   β”œβ”€β”€ route_server.py         # Routing service
β”‚   β”œβ”€β”€ save_server.py          # Design save service
β”‚   └── mcp/                   # MCP server implementations
β”‚       β”œβ”€β”€ mcp_eda_server.py   # Main MCP server
β”‚       └── start_mcp_server.sh # MCP server startup script
β”œβ”€β”€ experiment/                 # Experimental framework
β”‚   β”œβ”€β”€ generate/              # TCL generation methods
β”‚   β”‚   β”œβ”€β”€ baseline1_generate.py  # Pure LLM generation
β”‚   β”‚   β”œβ”€β”€ baseline2_generate.py  # LLM + template generation
β”‚   β”‚   β”œβ”€β”€ ours_generate.py       # MCP agent generation
β”‚   β”‚   └── common_config.py       # Shared configuration
β”‚   β”œβ”€β”€ evaluate/              # Evaluation framework
β”‚   β”‚   β”œβ”€β”€ tcl_evaluator.py       # Main evaluator
β”‚   β”‚   └── evaluation_metrics.py  # Quality metrics
β”‚   β”œβ”€β”€ results/               # Generation results
β”‚   β”œβ”€β”€ evaluation_results/    # Evaluation reports
β”‚   └── run_experiment.py      # Main experiment runner
β”œβ”€β”€ scripts/                   # EDA tool scripts
β”‚   β”œβ”€β”€ FreePDK45/           # Technology-specific scripts
β”‚   β”‚   β”œβ”€β”€ frontend/        # Synthesis scripts
β”‚   β”‚   └── backend/         # Physical implementation scripts
β”‚   └── _helper/             # Python helper scripts
β”œβ”€β”€ config/                    # Configuration files
β”‚   β”œβ”€β”€ synthesis.csv           # Synthesis parameters
β”‚   β”œβ”€β”€ imp_global.csv          # Implementation parameters
β”‚   β”œβ”€β”€ placement.csv           # Placement parameters
β”‚   └── cts.csv                 # CTS parameters
β”œβ”€β”€ libraries/                 # Technology libraries
β”‚   └── FreePDK45/           # FreePDK45 library files
β”œβ”€β”€ logs/                      # Execution logs
β”œβ”€β”€ deliverables/              # Final design outputs
β”œβ”€β”€ mcp_agent_client.py          # Main MCP agent client
β”œβ”€β”€ restart_servers.sh           # Server startup script
β”œβ”€β”€ docker-compose.yml           # Docker Compose configuration
β”œβ”€β”€ docker/                      # Docker configuration files
β”‚   β”œβ”€β”€ Dockerfile.agent         # MCP Agent Client Dockerfile
β”‚   β”œβ”€β”€ Dockerfile.servers       # MCP Servers Dockerfile
β”‚   β”œβ”€β”€ health_check.py          # Health check script
β”‚   β”œβ”€β”€ deploy.sh                # Deployment script
β”‚   └── env.example              # Environment template
β”œβ”€β”€ requirements.txt             # Python dependencies
└── README.md                    # This file

Configuration

Design Configuration (designs/<design>/config.tcl)

# Top-level module name
set TOP_NAME "your_module"

# File format (verilog/vhdl)
set FILE_FORMAT "verilog"

# Clock port name
set CLOCK_NAME "clk"

# Clock period in nanoseconds
set clk_period 1.0

Synthesis Configuration (config/synthesis.csv)

ParameterDescriptionDefault Value
clk_periodTarget clock period (ns)1.0
DRC_max_fanoutMaximum fanout10
DRC_max_transitionMaximum transition time (ns)0.5
DRC_max_capacitanceMaximum capacitance (pF)5.0
compile_cmdCompilation commandcompile_ultra
map_effortMapping efforthigh
power_effortPower optimization effortmedium
area_effortArea optimization effortmedium

Implementation Configuration (config/imp_global.csv)

ParameterDescriptionDefault Value
ASPECT_RATIODie aspect ratio1.0
target_utilTarget utilization0.7
design_flow_effortFlow effort levelstandard
design_power_effortPower optimization effortmedium

Experimental Framework

Supported Designs

The system supports various benchmark designs:

  • des: DES encryption design (Verilog)
  • b14: VHDL benchmark design
  • leon2: LEON2 processor design
  • des3: Additional DES variant

Experiment Methods

  1. Baseline1 (Pure LLM): Direct GPT-4 TCL generation without templates
  2. Baseline2 (LLM + Template): GPT-4 generation with template guidance
  3. Ours (MCP Agent): Real MCP agent execution with EDA tools

Quality Metrics

The evaluation framework assesses TCL quality across multiple dimensions:

  • Syntax: Valid TCL syntax and structure
  • Completeness: Coverage of required commands
  • Executability: Ability to run successfully
  • Professionalism: Industry-standard practices

Running Experiments

# Complete experiment
cd experiment
python run_experiment.py --full

# Specific methods only
python run_experiment.py --generate baseline1 ours

# Evaluation only
python run_experiment.py --evaluate --summary

# Clean and run
python run_experiment.py --clean --full

API Reference

MCP Agent Client API

POST /agent

Main endpoint for natural language EDA operations.

Request Body:

{
  "user_query": "Run synth_setup for design=\"des\" and return the log path."
}

Response:

{
  "tool_called": "synth_setup",
  "tool_input": {
    "design": "des",
    "tech": "FreePDK45",
    "version_idx": 0,
    "force": true
  },
  "tool_output": {
    "status": "ok",
    "log_path": "/path/to/log/file",
    "reports": {
      "check_design.rpt": "report content"
    }
  }
}

Individual MCP Server APIs

Synthesis Setup Server (Port 13333)

POST /setup/run

{
  "design": "des",
  "tech": "FreePDK45",
  "version_idx": 0,
  "force": true
}
Floorplan Server (Port 13335)

POST /floorplan/run

{
  "design": "des",
  "top_module": "des3",
  "tech": "FreePDK45",
  "syn_ver": "cpV1_clkP1_drcV1",
  "g_idx": 0,
  "p_idx": 0,
  "force": true
}
Placement Server (Port 13337)

POST /place/run

{
  "design": "des",
  "top_module": "des3",
  "tech": "FreePDK45",
  "impl_ver": "cpV1_clkP1_drcV1__g0_p0",
  "g_idx": 0,
  "p_idx": 0,
  "restore_enc": "/path/to/powerplan.enc.dat",
  "force": true
}

Monitoring and Debugging

Log Files

All operations generate detailed logs in the logs/ directory:

logs/
β”œβ”€β”€ setup/           # Synthesis setup logs
β”œβ”€β”€ compile/         # Synthesis compile logs
β”œβ”€β”€ floorplan/       # Floorplanning logs
β”œβ”€β”€ powerplan/       # Power planning logs
β”œβ”€β”€ placement/       # Placement logs
β”œβ”€β”€ cts/            # Clock tree synthesis logs
β”œβ”€β”€ route/          # Routing logs
└── save/           # Design save logs

Status Checking

# Check if all servers are running
netstat -tlnp | grep -E "(1333[3-9]|13440|8000)"

# Check server processes
ps aux | grep -E "(synth_setup|floorplan|placement|cts|route)"

# Monitor logs in real-time
tail -f logs/setup/des_setup_*.log

Common Issues and Solutions

1. Port Already in Use
# Kill existing processes
pkill -f "synth_setup_server.py"
pkill -f "floorplan_server.py"
# ... repeat for other servers
2. EDA Tool Not Found
# Check tool installation
which dc_shell
which innovus

# Set up environment variables
export SNPSLMD_LICENSE_FILE=/path/to/synopsys/license
export CDS_LIC_FILE=/path/to/cadence/license
3. Library Path Issues
# Verify FreePDK45 library
ls -la libraries/FreePDK45/

# Check library references in scripts
grep -r "FreePDK45" scripts/

Testing

Run Example Design

# Complete flow test
./run_pipeline.sh

# Individual stage test
python3 scripts/_helper/synthesis_config_row_no_dbg.py \
  --design des --version-idx 0 --tech FreePDK45

Test Different Designs

# Test VHDL design (b14)
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_setup for design=\"b14\" and return the log path."}'

# Test another design (leon2)
curl -X POST http://localhost:8000/agent \
  -d '{"user_query":"Run synth_setup for design=\"leon2\" and return the log path."}'

Run Experiments

# Test experimental framework
cd experiment
python run_experiment.py --full --summary

# Test specific method
python run_experiment.py --generate ours --case_ids case_0

Contributing

We welcome contributions! Please see our for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Code Style

  • Use Python 3.9+ features
  • Follow PEP 8 style guidelines
  • Add type hints
  • Include docstrings for all functions

Documentation

  • : Step-by-step setup and usage
  • : Detailed API reference
  • : MCP protocol details

Acknowledgments

  • Synopsys for Design Compiler
  • Cadence for Innovus
  • OpenAI for GPT-4 API
  • FreePDK45 for open-source technology library
  • FastAPI for the web framework

Support

Version History

  • v2.0.0 - Added experimental framework and MCP server improvements
  • v1.2.0 - Enhanced monitoring and logging capabilities
  • v1.1.0 - Added VHDL support and improved error handling
  • v1.0.0 - Initial release with basic MCP EDA functionality

Made with for the EDA community

Author: Yiyi Lu, Jingyu Pan, Junyao Zhang

Email: