Skip to main content
Glama
visualizer-mcp

visualizer-mcp

by htminuslab

visualizer-mcp

visualizer-mcp 是一个 Model Context Protocol (MCP) 服务器,它通过 Visualizer 命令通道 (VCC) TCP 接口将 AI 助手连接到 Siemens Questa Visualizer。它允许 Claude Code 通过自然语言控制实时仿真:打开波形、运行设计、检查信号值以及跨时间搜索信号历史记录。Visualizer 随所有 Questa 版本提供(OEM 版本除外?)。


先决条件

工具

用途

备注

Python 3.10+

运行 MCP 服务器

python.org

uv

通过 uvx 安装服务器(无需手动 venv)

docs.astral.sh/uv

Siemens Visualizer

服务器控制的仿真 GUI

visualizer 必须在 PATH 中

Claude Code

发出工具调用的 AI 助手

claude.ai/code

注意:其他 LLM 也应该可以使用,但我使用的是 Claude Code(订阅版)。


Related MCP server: Xcelium MCP Server

安装

Linux

# 1. Install uv (skip if already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env    # reload PATH

# 2. Register visualizer-mcp with Claude Code
claude mcp add visualizer -- \
  uvx --from git+https://github.com/htminuslab/visualizer-mcp visualizer-mcp

Windows (PowerShell)

# 1. Install uv (skip if already installed)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# 2. Register visualizer-mcp with Claude Code
claude mcp add visualizer -- `
  uvx --from git+https://github.com/htminuslab/visualizer-mcp visualizer-mcp

验证注册:

claude mcp list

工作目录。 默认情况下,服务器会相对于其自身的工作目录(即您启动 claude 的目录)查找 Visualizer 的连接文件 (.Visualizer/vccserver.cfg)。在同一个仿真目录中启动 Visualizer 和 Claude Code,则无需进一步配置。如果它们不同,请设置 VCC_WORK_DIR — 请参阅 环境变量。


工作原理

Claude Code ──stdio──► visualizer-mcp ──TCP──► Visualizer GUI
  (LLM host)   (MCP)   (this server)   (VCC)  (Siemens EDA)

Claude Code 通过 stdio(标准 MCP 传输)将 visualizer-mcp 作为子进程启动。服务器与 Visualizer 命令通道 (VCC) 服务器保持一个持久的 TCP 连接,该服务器在每个 Visualizer 会话中自动启动。

连接顺序:

  1. 在第一次工具调用时,服务器读取 $VCC_WORK_DIR/.Visualizer/vccserver.cfg。Visualizer 在启动时写入此文件;它包含 port@hostname 格式的 VCC 主机和端口。

  2. 服务器打开一个 TCP 套接字,发送 vccRegisterClient,并订阅 vDesignStateChange、vTimeChange 和 vHierarchyChange 通知。

  3. 每个工具调用将 Tcl 命令编码为 VCC 帧(10 字节头部 + 大括号分隔的主体),通过套接字发送,并等待匹配的回复帧。帧通过递增的消息编号与调用者匹配。

  4. 异步信号通知(例如时间变化、设计状态变化)作为未经请求的 s 类型帧到达,并存储在 256 条目的环形缓冲区中,可通过 vcc_recent_signals 读取。

  5. 如果 Visualizer 关闭且套接字断开,服务器会在下一次工具调用时重新连接(或自动启动 Visualizer)。

Visualizer 调试环境命令参考手册 中描述的每个 Visualizer Tcl 命令(run、step、wave add、examine、force、env 等数百个命令)都可以通过 vcc_eval 转义入口使用。


MCP 工具

所有工具在成功时返回 {"ok": true, "result": "..."},在失败时返回 {"ok": false, "error": "..."}。

工具

描述

vcc_connect

连接到 Visualizer(如果需要则自动启动)。幂等。

vcc_status

报告 cfg 文件是否存在、主机/端口和连接状态。不进行连接。

vcc_eval

原样发送任何 Tcl 命令 — 可在此处访问完整的 Visualizer 命令集。

vcc_run

推进仿真:"100ns"、"8 us"、"-all",或省略以进行默认步进。

vcc_step

将仿真器单步执行 N 个增量周期。

vcc_run_status

返回当前的仿真器运行状态。

vcc_get_time

返回当前的仿真时间。

vcc_wave_add

通过层次路径将一个或多个信号添加到波形窗口。

vcc_force

强制将信号设置为某个值,可选择在特定的仿真时间。

vcc_examine

在当前或指定的仿真时间读取信号的值。

vcc_scan_signal

在时间范围内扫描信号;可选择搜索特定值。

vcc_recent_signals

返回来自 Visualizer 的最新异步信号通知。


环境变量

变量

默认值

描述

VCC_WORK_DIR

服务器 CWD

读取 .Visualizer/vccserver.cfg 的目录;也是自动启动 Visualizer 时的 CWD。

VCC_CFG_FILE

(未设置)

cfg 文件的显式路径;覆盖 VCC_WORK_DIR 查找。镜像 Visualizer 的 -vccfile 标志。

VCC_CLIENT_NAME

Claude-MCP

随 vccRegisterClient 发送的名称。

VCC_VISUALIZER_BIN

visualizer

自动启动 Visualizer 时使用的二进制文件。

VCC_LAUNCH_TIMEOUT_S

60

启动 Visualizer 后等待 cfg 文件的秒数。

VCC_CMD_TIMEOUT_S

30

每个命令的超时时间(秒)。

要在注册服务器时设置环境变量:

# Linux
claude mcp add visualizer \
  -e VCC_WORK_DIR=/path/to/sim \
  -- uvx --from git+https://github.com/htminuslab/visualizer-mcp visualizer-mcp

# Windows
claude mcp add visualizer `
  -e "VCC_WORK_DIR=C:\path\to\sim" `
  -- uvx --from git+https://github.com/htminuslab/visualizer-mcp visualizer-mcp

示例:VHDL 分频器仿真

vhdl_example/ 目录包含一个 32 位非恢复整数分频器 (div.vhd) 和一个测试平台 (div_tb.vhd)。测试平台在多个操作数对上执行无符号和有符号除法。本演练展示了如何使用 Claude Code 来编译、仿真和查询设计。

1. 启动 Visualizer

打开终端/CMD 提示符,切换到 vhdl_example/,并使用以下命令启动 Visualizer:

cd vhdl_example
visualizer -do run.do

run.do 编译 VHDL 源文件,将设计优化为 div_tb_vopt,并使用 vsim -visualizer 将其加载到仿真器中。Visualizer GUI 出现,仿真在时间 0 处暂停。

2. 启动 Claude Code 并验证 MCP 服务器

在同一个 vhdl_example/ 目录中打开一个新终端并启动 Claude Code:

cd vhdl_example
claude

在 Claude Code 中,输入以下命令以确认 MCP 服务器已连接:

/mcp

您应该看到 visualizer 列为已连接的服务器。您也可以直接询问 Claude:

Visualizer MCP 工具可用吗?

Claude 将确认并列出可用工具。

Visualizer 转录窗口应列出 VCC 服务器连接:

# Loading std.standard
# Loading std.textio(body)
# Loading ieee.std_logic_1164(body)
# Loading ieee.numeric_std(body)
# Loading work.div_tb(rtl)#1

# 18:09:53: Loading design data...
# 18:09:53: Loaded  design units
# 18:09:53: Loaded  design hierarchy
# 1

# VCC server established connection with remote client: Claude-MCP

3. 打开波形窗口并加载测试平台信号

询问 Claude:

打开波形窗口并添加 div_tb 中的所有测试平台信号

Claude 调用:

vcc_eval("view wave")
vcc_wave_add(["sim.div_tb.*"])

所有顶层测试平台信号(clk_s、reset_s、dividend_s、divisor_s、quotient_s、remainder_s、start_s、busy_s)都会出现在 Visualizer 波形窗口中。

4. 运行仿真 8 µs

询问 Claude:

运行仿真 8 微秒

Claude 调用:

vcc_run("8 us")

仿真推进到 8 µs。波形在 Visualizer GUI 中更新,显示测试平台执行的所有除法运算。

5. 一些调试示例

询问 Claude:

在仿真过程中 remainder_s 是否曾经等于 23?

Claude 回复:

  Called visualizer 16 times (ctrl+o to expand)

● Yes — remainder_s did equal 23 at some point during the simulation. Let me find the exact timestamp.

  Called visualizer (ctrl+o to expand)

● Yes, remainder_s equaled 23 during the simulation. It held that value continuously from 3890 ns to 5580 ns
  (about 1.69 µs), which corresponds to one of the division results being held stable while busy_s was
  asserted. The value then changed as the next operation completed.

✻ Churned for 1m 0s

您可以继续询问 Claude 进行调查:

在 4651 ns 时,你能确认 quotient_s 和 remainder_s 的值对于 dividend_s 和 divider_s 的给定输入值是否正确吗?

Claude 回复:

● At 4651 ns the signal values are:

  ┌─────────────┬────────────┐
  │   Signal    │   Value    │
  ├─────────────┼────────────┤
  │ dividend_s  │ 23         │
  ├─────────────┼────────────┤
  │ divisor_s   │ 46         │
  ├─────────────┼────────────┤
  │ divsigned_s │ 1 (signed) │
  ├─────────────┼────────────┤
  │ quotient_s  │ 0          │
  ├─────────────┼────────────┤
  │ remainder_s │ 23         │
  └─────────────┴────────────┘

  Verification: 23 ÷ 46 = 0 remainder 23

  Check: (46 × 0) + 23 = 23 ✓

  Both outputs are correct. Since the dividend (23) is smaller than the divisor (46), the quotient is 0 and
  the full dividend value is returned as the remainder.

✻ Baked for 8s

一些一般性评论

  • 从 Claude Code 提示符控制 Visualizer 速度较慢且成本效益不高,因为简单的命令会消耗 Token。显然,运行 .do 或 qrun 文件更容易。但是,演示的原因是展示可能性,让 LLM 控制仿真并检查结果非常有趣。

  • 此代码的大部分是由 Claude Code 4.6 创建的。

  • Siemens 有一个功能更强大的 Questa/Visualizer MCP 服务器,称为 Questa Agentic Toolkit。

许可证

有关此演示的详细信息,请参阅 LICENSE 文件。

注意

本文中使用的所有徽标、商标和图形均为其各自所有者的财产。

Available Tools

12 tools
vcc_connectA

Ensure Visualizer is running and the VCC socket is open. Idempotent.

Returns an error with instructions if Visualizer is not running.

Inputs: no named parameters. Returns: object

vcc_evalB

Send any Tcl command to Visualizer's command interpreter.

This is the escape hatch — every Visualizer Tcl command (run, step, wave add, force, examine, env, ...) can be sent through this tool.

Inputs: tcl (required), timeout_s. Returns: object

vcc_examineA

Examine the value of a signal, optionally at a specific simulation time.

signal: dot-separated hierarchical path with "sim." prefix e.g. sim.testbench.u1.my_signal time: simulation time e.g. "400 ns" (omit for current time) radix: decimal (default), binary, hexadecimal, unsigned, octal

The returned value may include a size/radix annotation e.g. "4'd3" (4-bit vector, decimal value 3). If Visualizer is not configured to annotate, the plain value is returned e.g. "3". Signal must be last in the examine command; this tool enforces that.

Inputs: signal (required), time, radix. Returns: object

vcc_forceB

Force signal to value (e.g. force sim.top.rst 1 0; force sim.top.clk 0 50ns).

Inputs: signal (required), value (required), time. Returns: object

vcc_get_timeA

Return the current simulation time.

Inputs: no named parameters. Returns: object

vcc_recent_signalsB

Return recent async signal notifications received from Visualizer (e.g. vTimeChange, vDesignStateChange). Newest last.

Inputs: limit. Returns: object

vcc_runA

Advance simulation. time may be "100ns", "-all", or None for default.

Inputs: time. Returns: object

vcc_run_statusC

Report runStatus (current simulator state).

Inputs: no named parameters. Returns: object

vcc_scan_signalA

Scan a signal across a time range; optionally search for a specific value.

Returns all sampled values across the range as a Tcl list. If find_value is given, also reports whether the signal ever held that value (handles both plain "3" and annotated forms like "4'd3"). When find_value is given and no time range is specified, the scan starts from time 0 to cover the full simulation.

signal: dot-separated hierarchical path with "sim." prefix e.g. sim.testbench.u1.my_signal find_value: value to search for e.g. "6" (optional) from_time: range start e.g. "0 ns" (defaults to "0" when find_value given) to_time: range end e.g. "1 us" (omit to scan to simulation end) radix: decimal (default), binary, hexadecimal, unsigned, octal

Inputs: signal (required), find_value, from_time, to_time, +1 more. Returns: object

vcc_statusA

Report VCC server reachability, host/port, and registration status.

Does NOT auto-launch. Use vcc_connect (or any other tool) to trigger an auto-launch if Visualizer is not running.

Inputs: no named parameters. Returns: object

vcc_stepB

Single-step the simulation count times.

Inputs: count. Returns: object

vcc_wave_addA

Add one or more signals to the wave window. Use dot-separated paths with "sim." prefix, e.g. ["sim.top.clk", "sim.top.dut.state", "sim.div_tb.*"]

Inputs: signals (required). Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools have clear distinct purposes (connect, examine, run, step, etc.), but vcc_status and vcc_connect overlap in reporting connection status, and vcc_eval is an escape hatch that could replicate other tools. Minor ambiguity.

    Naming Consistency3/5

    All tools share the vcc_ prefix, but the second part mixes verb_noun (connect, examine, run), noun_verb (wave_add), adjective_noun (recent_signals), and lone noun (status). Inconsistent structure.

    Tool Count5/5

    12 tools cover essential simulation control, signal inspection, wave management, and connection setup. Well-scoped for a visualizer MCP server.

    Completeness4/5

    Core functions are covered, but some operations (e.g., removing waves, setting radix per signal) are missing and must be done via vcc_eval. Minor gaps that can be worked around.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      F
      maintenance
      Enables RTL simulation and hardware verification with Verilator through automatic testbench generation, natural language queries about simulations, waveform analysis, and protocol-aware testing for Verilog/SystemVerilog designs.
      4
      4
      MIT
    • A
      license
      A
      quality
      Not graded
      maintenance
      Enables AI assistants to perform Electronic Design Automation (EDA) tasks including Verilog synthesis, simulation, ASIC design flows, and waveform analysis through a unified interface.
      6
      ISC
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to analyze hardware simulation VCD waveforms and GTKWave save files, providing access to signal values, bus definitions, and groupings without loading entire files.
      5
      MIT