Vivado MCP Server

Vivado MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to directly interact with AMD/Xilinx Vivado FPGA development tools.

Category
访问服务器

README

Vivado MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to directly interact with AMD/Xilinx Vivado FPGA development tools.

Features

  • Session Management: Start/stop persistent Vivado TCL sessions (avoids 30s startup per command)
  • Project Management: Open/close Vivado projects (.xpr files)
  • Design Flow: Run synthesis, implementation, and bitstream generation
  • Reports & Analysis: Get timing summaries, utilization reports, and design analysis
  • Design Queries: Explore hierarchy, ports, nets, and cells
  • Simulation: Control Vivado's integrated simulator (xsim)
  • Raw TCL: Execute arbitrary Vivado TCL commands for advanced operations

Requirements

  • Python 3.10+
  • AMD/Xilinx Vivado installed (tested with 2023.2+)
  • Vivado must be in your PATH, or specify the full path when starting a session

Installation

From GitHub

git clone https://github.com/coreyhahn/vivado_mcp.git
cd vivado_mcp
pip install -e .

Configure Claude Code

Add to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json or project-level .mcp.json):

{
  "mcpServers": {
    "vivado": {
      "command": "vivado-mcp"
    }
  }
}

Or if you want to specify the Python interpreter:

{
  "mcpServers": {
    "vivado": {
      "command": "python",
      "args": ["-m", "vivado_mcp"]
    }
  }
}

Usage

Once configured, Claude can interact with Vivado through natural language. Example workflow:

  1. Start Vivado session: "Start a Vivado session"
  2. Open project: "Open my project at /path/to/project.xpr"
  3. Run synthesis: "Synthesize the design"
  4. Check timing: "What's the timing summary? Is timing met?"
  5. Check utilization: "Show me the resource utilization"
  6. Close session: "Stop the Vivado session"

Available Tools

Session Management

  • start_session - Start a persistent Vivado TCL session
  • stop_session - Stop the Vivado session
  • session_status - Get session statistics

Project Management

  • open_project - Open a Vivado project (.xpr)
  • close_project - Close the current project
  • get_project_info - Get project information (part, directory, etc.)

Design Flow

  • run_synthesis - Run synthesis
  • run_implementation - Run place and route
  • generate_bitstream - Generate bitstream

Reports & Analysis

  • get_timing_summary - Get timing summary (WNS, TNS, WHS, THS)
  • get_timing_paths - Get detailed timing paths for failing/critical paths
  • get_utilization - Get resource utilization (LUTs, FFs, BRAMs, DSPs)
  • get_clocks - Get clock information
  • get_messages - Get synthesis/implementation messages

Design Queries

  • get_design_hierarchy - Get module/instance hierarchy
  • get_ports - Get top-level ports
  • get_nets - Search for nets
  • get_cells - Search for cells/instances

Simulation

  • launch_simulation - Launch behavioral/post-synth/post-impl simulation
  • run_simulation - Run simulation for specified time
  • restart_simulation - Restart from time 0
  • close_simulation - Close the simulator
  • get_simulation_time - Get current simulation time
  • get_signal_value - Get a signal's current value
  • get_signal_values - Get multiple signal values by pattern
  • add_signals_to_wave - Add signals to waveform viewer
  • set_simulation_top - Set the testbench module
  • get_simulation_objects - List signals in a scope
  • get_scopes - List hierarchy scopes
  • step_simulation - Step simulation
  • add_breakpoint - Add signal breakpoint
  • remove_breakpoints - Remove all breakpoints

Advanced

  • run_tcl - Execute raw TCL commands
  • generate_full_report - Generate full reports to file
  • read_report_section - Read portions of large reports
  • request_feature - Request new features
  • list_feature_requests - List submitted requests

Architecture

┌─────────────────┐     MCP Protocol      ┌─────────────────┐
│   Claude Code   │◄────(JSON-RPC)────────►│  Vivado MCP     │
│   (AI Client)   │     over stdio        │    Server       │
└─────────────────┘                       └────────┬────────┘
                                                   │
                                                   │ pexpect
                                                   │ (TCL commands)
                                                   ▼
                                          ┌─────────────────┐
                                          │ Vivado Process  │
                                          │  (TCL mode)     │
                                          └─────────────────┘

The server maintains a persistent Vivado process in TCL mode. Commands are sent via pexpect and output is captured by waiting for the Vivado prompt. This avoids the ~30 second startup overhead that would occur if Vivado were launched for each command.

Recreating This MCP Server with Claude

This MCP server was created entirely through conversation with Claude. Here's how you can create similar MCP servers:

1. Start with a Clear Goal

Tell Claude what you want to build:

"I want to create an MCP server that lets you control Vivado FPGA tools. You should be able to start Vivado, open projects, run synthesis, check timing, etc."

2. Describe the Architecture

Explain the key technical challenges:

"Vivado takes 30 seconds to start, so we need a persistent session. Vivado has a TCL interface we can use. We need to parse Vivado's text output into structured data."

3. Iterate on Tools

Start with basic tools and add more:

  1. Session management (start/stop)
  2. Project management
  3. Design flow commands
  4. Reports and queries
  5. Simulation control

4. Key Design Patterns Used

Singleton Session: Only one Vivado process runs at a time

_session: Optional[VivadoSession] = None

def get_session() -> VivadoSession:
    global _session
    if _session is None:
        _session = VivadoSession()
    return _session

pexpect for Process Management: Keeps Vivado alive between commands

self.child = pexpect.spawn(
    f'{self.vivado_path} -mode tcl -nojournal -nolog',
    encoding='utf-8',
    timeout=self.timeout
)
self.child.expect('Vivado%', timeout=10)  # Wait for prompt

Output Parsing: Convert text reports to structured JSON

def parse_timing_summary(output: str) -> dict:
    wns_match = re.search(r"WNS\(ns\)\s*:\s*([-\d.]+)", output)
    if wns_match:
        result["wns"] = float(wns_match.group(1))

Response Truncation: Handle large outputs gracefully

def truncate_response(content: str, max_chars: int) -> dict:
    if len(content) > max_chars:
        return {"content": content[:max_chars], "truncated": True}

5. MCP Server Structure

Every MCP server needs:

from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent

server = Server("your-server-name")

@server.list_tools()
async def list_tools() -> list[Tool]:
    return [Tool(name="...", description="...", inputSchema={...})]

@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
    # Handle tool calls
    return [TextContent(type="text", text=json.dumps(result))]

async def main():
    async with stdio_server() as (read_stream, write_stream):
        await server.run(read_stream, write_stream,
                        server.create_initialization_options())

6. Prompt for Creating Your Own MCP Server

Use this prompt template with Claude:

I want to create an MCP server for [YOUR TOOL].

Background:
- [Tool] is a [description] that [what it does]
- It has a [CLI/API/etc] interface that accepts [commands/requests]
- Key operations I want to support: [list operations]

Technical considerations:
- [Startup time, persistent state, output formats, etc.]

Please help me create an MCP server with:
1. Session/connection management
2. Core operations as tools
3. Proper error handling
4. Structured JSON responses
5. Comprehensive code comments

Start with the basic structure and we'll iterate from there.

Contributing

Contributions welcome! Please feel free to submit issues and pull requests.

License

MIT License - see LICENSE file for details.

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选