Skip to main content
Glama
multisim-mcp

multisim-mcp

by Aruvelut111

multisim-mcp

An MCP server that lets an AI agent build and simulate circuits in Multisim 14 — no mouse, no GUI automation.

What it does

The agent describes a circuit (components, values, nets), and the server:

  1. Builds the design file (.ms14) directly, including symbols, wires, probes, and virtual instruments.

  2. Runs the simulation through Multisim's COM automation interface in a hidden instance.

  3. Returns numbers and a schematic image: operating point, AC sweep, transient waveforms, PNG/JPG of the drawing.

Everything is structured JSON in, structured JSON out, with typed error codes so the agent can correct itself.

Related MCP server: multisim-mcp

Why not just use the COM API

Multisim's automation interface can open, modify, simulate, and export a design — but it has no method to place a component, draw a wire, or add a probe. The design has to exist first.

So the server builds designs itself: a .ms14 file is a compressed XML document describing the schematic. The server generates that XML from a plain description, then hands the file to Multisim for simulation.

Two paths, one pipeline:

spec (JSON)  ──build──▶  .ms14  ──COM──▶  simulation  ──▶  results (JSON)

Requirements

  • Windows

  • Multisim 14.0 or later

  • Two Python installs:

    • 64-bit for the MCP host (this is what your MCP client launches)

    • 32-bit for the COM bridge — Multisim registers its automation server only in the 32-bit registry view

runtime/ is a local scratch location and is not part of the repo. Pick one of these two routes — the differences matter:

Route A — installer Python (has the py launcher and pip):

py -3.11-32 -m pip install pywin32
set RUNTIME_PY32=C:\Path\To\Python311-32\python.exe

Route B — 32-bit embeddable package (registers no py launcher and ships no pip). Unpack it into <repo>\runtime\py32\ so the default path resolves, then bootstrap pip inside it and install pywin32:

runtime\py32\python.exe get-pip.py
runtime\py32\python.exe -m pip install pywin32

Without a 32-bit interpreter at the configured path the COM bridge exits with NO_PY32; without pywin32 it fails on import pythoncom.

Install

git clone https://github.com/Aruvelut111/multisim-mcp
cd multisim-mcp
pip install -e .

Then bootstrap the donor/template pack from .ms14 files on your machine (NI sample designs, your own saved circuits — anything you have the right to use). NI-derived design files are not distributed with this repository:

python tools\bootstrap_donors.py --scan "C:\path\with\.ms14\designs"

This produces data\blank.ms14, data\donors\*.ms14 (probe donor, the three instrument donors, one donor per component family) and data\SOURCES.md documenting where each file came from.

Configure your MCP client

{
  "mcpServers": {
    "multisim": {
      "command": "python",
      "args": ["-m", "multisim_mcp"]
    }
  }
}

Environment variables (all optional):

Variable

Default

Purpose

RUNTIME_PY32

<root>/runtime/py32/python.exe

32-bit interpreter for the COM bridge

MSIM_BLANK

<root>/data/blank.ms14

empty schematic used as the build base

MSIM_DONORS

<root>/data/donors

donor designs to clone component symbols from

MSIM_CACHE

<root>/.cache

extracted blank XML and other build caches

MSIM_NO_REAP

unset

set to 1 to stop the server from cleaning up orphaned Multisim simulation-server processes

Tools

Building

Tool

Purpose

msim_new_circuit

Start an empty design

msim_add_part

Place a component (refdes, kind, value, x, y)

msim_connect

Create a net from a list of pins, optionally with a probe

msim_save

Write the design to .ms14

msim_build

Do all of the above from one spec dict

msim_list_parts

List available component kinds

msim_list_instruments

List available virtual instruments and their pin names

msim_add_instrument

Place an oscilloscope, multimeter, function generator, or a custom instrument

msim_configure_instrument

Set function-generator panel values (frequency, amplitude, offset)

msim_set_model

Swap a BJT/diode model parameters and display name

msim_delete_part

Remove a component entirely (pins, model, symbol, wires)

msim_disconnect_pin

Disconnect one pin from its net (e.g. to detach a load)

msim_read_design

Read a .ms14's full structure without launching Multisim

msim_edit_open

Load an existing .ms14 into the editing session

msim_rotate_part

Rotate a component symbol 180° (unwired parts)

msim_add_probe

Add a voltage probe to an existing net

msim_report_bom

Bill of materials: refdes, part, annotated value

Simulating

Tool

Purpose

msim_open

Open a .ms14 in a hidden Multisim instance

msim_inspect

List components, probes, variants, sim state

msim_get_value / msim_set_value

Read or change an RLC value

msim_run_dc

DC operating point

msim_run_ac

AC sweep (decade / octave / linear)

msim_run_tran

Transient analysis

msim_get_output

Read waveform data for a probe

msim_spice_run

Run a raw SPICE netlist through the built-in engine (no probes needed)

msim_export_image

Export the schematic as PNG/JPG/BMP

msim_save_as

Save the open design elsewhere

msim_close

Shut down the hidden instance

msim_status

Check runtime and session state

Example

spec = {
    "path": r"C:\work\rc_lpf.ms14",
    "components": [
        {"ref": "V1", "kind": "signal_ac",  "value": 1,    "at": [180, 360]},
        {"ref": "R1", "kind": "resistor",   "value": 1000, "at": [360, 360]},
        {"ref": "C1", "kind": "capacitor",  "value": 1e-6, "at": [540, 360]},
        {"ref": "GND1", "kind": "ground",                  "at": [540, 540]},
    ],
    "nets": [
        {"name": "in",  "pins": ["V1.1", "R1.1"]},
        {"name": "out", "pins": ["R1.2", "C1.1"], "probe": True},
        {"name": "0",   "pins": ["C1.2", "GND1.1"]},
        {"name": "0",   "pins": ["V1.2", "GND1.1"]},
    ],
}

msim_build(spec)
msim_open(spec["path"])
msim_run_ac(num_points=100, start=1, stop=1e5)
data = msim_get_output("V(PR1)")

Result: a 501-point frequency response. Measured corner frequency 158.5 Hz against a theoretical 159.2 Hz.

Pin names

Pins are addressed as "REFDES.PIN". Pin names come from the component symbol:

Component

Pins

Resistor, capacitor, inductor, DC source

"1", "2"

Transistor

"C", "B", "E"

Ground

"1"

Op-amp (ideal)

"IN+", "IN-", "OUT"

Writing Q1.1 for a transistor raises BAD_PIN rather than silently connecting the wrong leg.

Instrument

Pins

Oscilloscope XSC

"1", "2", "4", "3", "5", "6" (A, B, Ext Trig)

Multimeter XMM

"2", "1"

Function generator XFG

"1", "2", "3" (+, common, -)

Pin numbering follows the symbol, not the physical order. Use msim_list_instruments() to read the list back instead of guessing.

Instruments

msim_add_instrument() places an instrument on the schematic. Call it after adding the ordinary parts, then wire it with msim_connect() like any other component:

msim_list_instruments()
msim_add_instrument("oscilloscope")                     # XSC1, auto-placed to the right
msim_add_instrument("function_generator", x=1200, y=160)
msim_connect("in",  ["XFG1.1", "R1.1"])
msim_connect("gnd", ["XFG1.2", "XSC1.3", "GND1.1"])
msim_connect("out", ["R1.2", "XSC1.1"], probe=True)

Built-in kinds: oscilloscope, multimeter, function_generator, plus short aliases (scope, dmm, fgen, xsc, xmm, xfg). Designators are assigned automatically and can be overridden with refdes.

Other instruments (Bode plotter XBP, logic analyser XLA, current probe XCP, ...) work through a donor design:

msim_list_instruments(donor=r"C:\designs\with_bode_plotter.ms14")
msim_add_instrument("custom", donor=r"C:\designs\with_bode_plotter.ms14",
                    donor_refdes="XBP1")

A donor is any .ms14 containing that instrument. The server clones the symbol and its pins; you still have to connect them.

Where the numbers come from. There are two paths:

  1. Probes — msim_run_tran() + msim_get_output() on a probe. The output name is assigned by Multisim (V(PR1)...), and the mapping from probe number to net is not exposed over the automation interface, so prefer the netlabel approach below when exact per-net readings matter.

  2. The built-in SPICE engine — msim_spice_run(netlist, commands, outdir) sends a raw SPICE deck straight through the simulator's command channel (source → op/tran/ac → write → ASCII raw). It needs no probes or instruments, returns every node by the name you chose in the netlist, and is the deterministic way to get numbers. Open any design first (msim_open(blank.ms14) is enough) to provide the COM context.

msim_open(r"C:\path\to\blank.ms14")
r = msim_spice_run(NETLIST_TEXT, ["op", "tran 0 5m 0 2u"],
                   r"C:\out\spice")     # no spaces in outdir

Instrument panels are part of the schematic and show up in exported images; panel settings for the function generator are set with msim_configure_instrument().

Error codes

Code

Meaning

BAD_ARGS

Malformed input

BAD_PIN / BAD_PIN_REF

Pin not found or malformed reference

PIN_CONFLICT

Pin already belongs to another net (would short)

NO_PART

Reference designator not in the design

DUP_REFDES

Reference designator already used

PROBE_OFF_WIRE

probe_at is not on a horizontal wire segment

PROBE_NO_HORIZONTAL

that net has no horizontal wire segment; move a component so the wire has one

BAD_PATH

output file must end in .ms14

NO_SESSION

No circuit being built

NO_PY32 / NO_BLANK

32-bit runtime or blank design not found

WORKER_TIMEOUT / WORKER_DIED / WORKER_DESYNC

COM bridge restarted; error.detail carries the worker's stderr when available

COM_ERROR

Multisim rejected the operation

How circuits stay consistent

Two things are easy to get wrong when editing .ms14 files directly:

A component lives in two trees. The electrical tree (Elements) drives simulation; the drawing tree (Objects) drives what you see. Both must be updated, and they are linked by ID.

A value lives in five places. A resistor's value appears in the parameter list, a human-readable string, an authoritative string copy, a display cache, and the rendered text object. Change one and the others go stale. The build layer updates all five.

Development

python tests/test_regression.py
python tests/test_instruments.py

test_regression.py covers UTF-8 paths, pin conflicts, transistor pin resolution, probe placement validation, duplicate designators, file extension checks, and a DC measurement. test_instruments.py covers instrument placement, wiring, file validity, exported images, and simulation with instruments present. Both need Multisim installed locally for the COM checks.

Known limitations

  • Instrument front panels are not driven over the automation interface. Instruments can be placed and wired, but their panel settings and on-screen readings are not exposed as tools; use probes for numeric results.

  • Transient analysis requires at least one probe; without one there is nothing to record.

  • .ms7 files cannot be opened through COM; only .ms14.

  • Schematic layout is basic. Components are placed at the coordinates you give; there is no auto-router that produces publication-quality schematics.

  • Hierarchical subcircuits (sheet blocks / macro components) are not cloned from donor designs. Ordinary components and instruments are.

  • No live attachment to a Multisim window you opened yourself. The COM interface always creates a separate hidden instance and Multisim registers nothing in the ROT (verified), so agent-vs-GUI collaboration is file-based: you Ctrl+S, the agent reads your file with msim_read_design (your file is never modified), and produces a new .ms14 for you to open.

  • IMultisimCircuit.ReportNetlist crashes (0xC0000005) on any circuit with any arguments — an NI-side defect, verified against the stock blank design. Netlist inspection goes through msim_spice_run instead.

License

MIT — see LICENSE.

Available Tools

30 tools
msim_add_instrumentA

在当前电路里放一台虚拟仪器。

kind "oscilloscope" / "multimeter" / "function_generator", 也接受 scope、meter、fgen、XSC、XMM、XFG 等别名 refdes 位号,省略则自动取下一个空位(XSC1、XSC2…) x, y 面板在图纸上的位置 donor, donor_refdes 可选:从任意 .ms14 里复制任意仪器(配合 msim_list_instruments(donor=...))

仪器引脚像普通元件一样可以写进 msim_connect 的 pins 列表。 COM 的 EnumOutputs 只认探针,所以仪器负责图和连线,读数仍用 msim_connect(probe=True) 加的探针。

Inputs: kind (required), x, y, donor, +2 more.

msim_add_partA

往当前电路里放一个元件。

refdes 位号,如 "R1"、"V1"(同一电路内必须唯一) kind 元件种类,见 msim_list_parts,如 "resistor"、"dc_source"、"ground" value 主参数(电阻 Ω、电容 F、电感 H、电源 V)。ground 不需要 x, y 放置坐标(Multisim 图纸单位,栅格 9)。省略则自动布局

返回该元件的引脚列表,供 msim_connect 使用。

Inputs: kind (required), refdes (required), x, y, +1 more.

msim_add_probeA

给一个已经存在的网络补电压探针(之后 run_dc/run_tran 可读它)。

适合两种场合:msim_disconnect_pin 摘掉引脚后探针变孤儿的网; 或者编辑既有设计(msim_edit_open)后想读某个节点的值。

Inputs: net (required).

msim_buildA

一步到位:按电路描述生成完整 .ms14(元件 + 连线 + 探针 + 落盘)。

spec 结构: { "path": "E:\work\rc_lpf.ms14", "components": [ {"ref": "V1", "kind": "signal_ac", "value": 1, "at": [180, 360]}, {"ref": "R1", "kind": "resistor", "value": 1000, "at": [360, 360]}, {"ref": "C1", "kind": "capacitor", "value": 1e-6, "at": [540, 360]}, {"ref": "GND1", "kind": "ground", "at": [360, 540]} ], "nets": [ {"name": "in", "pins": ["V1.1", "R1.1"]}, {"name": "out", "pins": ["R1.2", "C1.1"], "probe": true}, {"name": "0", "pins": ["C1.2", "V1.2", "GND1.1"]} ] }

"at" 可省略(自动网格布局)。probe=true 的网络会自动挂电压探针。

Inputs: spec (required).

msim_closeA

关闭隐藏的 Multisim 实例,释放资源(直接结束 worker 进程)。

Inputs: no named parameters.

msim_configure_instrumentA

调函数发生器面板参数:频率、幅值、偏置、波形。

amplitude 是峰值电压(与 Multisim 面板一致,不是有效值)。 waveform 目前只支持 "sine",其余波形会明确报错而不是静默忽略。 参数直接写进仪器的 SPICE 模型子电路(面板显示与仿真行为都跟着变), 返回修改前后的模型文本供核对。

Inputs: refdes (required), offset, freq_hz, waveform, +1 more.

msim_connectA

把若干引脚连成一条网络(自动画导线)。

net 网络名,如 "out"。地网统一写 "0"("gnd"/"ground" 会自动归一化) pins 引脚引用列表,格式 "元件.引脚名",如 "R1.1"、"Q1.B"、"Q1.C"、"Q1.E"。 注意三极管引脚名是字母 C/B/E,不是数字,写错会直接报错 probe 是否在这条网络上放一个电压探针(有探针才能跑分析读波形) probe_at [x, y] 探针落点;必须落在该网络的水平导线段上, 省略则在最长水平段中点自动插点。给了非法坐标会报错而不是静默失效

一个引脚只能属于一条网络,重复连接会报 PIN_CONFLICT。 地网需要多段时,重复调用本函数、net 都写 "0" 即可。

Inputs: net (required), pins (required), probe, probe_at.

msim_delete_partA

把一个元件从当前设计里整体移除(引脚、模型、符号、相关导线一起清)。

文件层操作:改的是构建会话,之后 msim_save 保存、msim_open 才进入 仿真通道。被删探针/仪器的输出会随之消失。

Inputs: refdes (required).

msim_disconnect_pinA

把一个引脚从它所在的网络断开(该引脚的导线一并删除)。

例如断开负载电阻的一端来模拟 RL=∞。文件层操作,保存后生效。

Inputs: pin (required), refdes (required).

msim_edit_openA

把一个已有的 .ms14 装进编辑会话,之后所有编辑工具对它生效。

典型用途:用户前台 Multisim 里 Ctrl+S 保存后,agent 用 msim_read_design 看结构,再用本工具装进会话做修改(删元件、断线、改值、换模型……), 最后 msim_save_as 存成新文件(原文件不会被覆盖,除非显式指到原路径)。

会话里的元件/网络缓存会从文件重建;已有探针的位置关联比较复杂, 不做重建——编辑会话里再放探针可能与既有探针重复,需要探针时优先 用 msim_add_probe 按网络名补。

Inputs: path (required).

msim_export_imageB

把当前电路原理图导出成图片。fmt: 0=png 1=jpg 2=bmp。

Inputs: path (required), fmt.

msim_get_outputB

读取一个探针的波形数据(分析跑完之后调)。

返回 points = [[x, y], ...]。DC 分析通常只有 1 个点。

Inputs: name (required), max_points.

msim_get_valueC

读某个 RLC 元件的当前值(Ω / F / H)。

Inputs: refdes (required).

msim_inspectB

查看当前已打开电路的元件、探针、变体、仿真状态。

Inputs: no named parameters.

msim_list_instrumentsA

列出可放进电路的虚拟仪器:示波器、万用表、函数发生器,以及引脚名。

kind 直接传给 msim_add_instrument。传 donor(一个 .ms14 文件)可额外列出 该设计里所有 X 开头的仪器,用来接波特图仪、逻辑分析仪等自定义仪器。

Inputs: donor.

msim_list_partsA

列出可用的元件种类(kind 字符串)以及样例库里实际存在的库元件。

搭电路前先看这个,避免用了不存在的 kind。

Inputs: no named parameters.

msim_new_circuitA

新建一个空电路(只在内存里,还没落盘)。

之后用 msim_add_part / msim_connect / msim_add_probe 搭电路,最后 msim_save。 也可以直接用 msim_build 一步到位。

Inputs: no named parameters.

msim_openB

用 Multisim(隐藏实例)打开一个 .ms14,返回元件和探针列表。

每次打开都换全新 worker + 全新 Multisim 实例(复用会因多文档状态残留 让 EnumOutputs 交替返回 None)。上一个实例偶发还没退干净就连上去, COM 会抛「拒绝访问」——这种瞬时错误自动换实例重试一次。

Inputs: path (required).

msim_read_designA

读取一个 .ms14 的完整结构:元件、引脚、网络、探针数(纯文件层)。

典型用途:你在前台 Multisim 里 Ctrl+S 保存后,agent 用它读取你的 最新电路。Multisim 的 COM 接口无法连接到第三方启动的 GUI 实例 (实测无 ROT 注册),所以「前台协作」的唯一可靠通道就是文件: 你保存 → agent 读这个文件 → agent 产出新文件供你打开。 原件不会被修改。

Inputs: path (required).

msim_report_bomA

元件清单(BOM):位号、型号、图面标注值。

path 省略时读当前编辑会话;给了路径则直接读那个 .ms14(原件不动)。

Inputs: path.

msim_rotate_partA

把元件符号旋转 180°(turns 次),电气连接点跟着转。

用于二极管/稳压管/LED 这类有极性的元件摆向不对的场合。 ⚠ 只对尚未连线或接受重连的元件使用:已画好的导线不会跟随 旋转,端点会错开,旋转后需要断开重连。

Inputs: refdes (required), turns.

msim_run_acB

跑交流扫频分析。

sweep_type: 0=Decade 1=Octave 2=Linear start/stop: 起止频率 Hz 同样要求电路里有探针。

Inputs: stop, start, outputs, num_points, +1 more.

msim_run_dcB

跑直流工作点分析。

outputs 省略则跑电路里所有探针。前提:电路里必须有探针,否则没有输出。

Inputs: outputs.

msim_run_tranA

跑瞬态分析,用来拿波形(相当于示波器看到的曲线)。

duration 仿真时长(秒),默认 3ms(3 个 1kHz 周期) sample_rate 采样率(Hz),默认 200kHz output 探针名,省略则用第一个探针

跑完用 msim_get_output 读数据,points 里是 [时间, 电压] 的点列。

Inputs: output, duration, sample_rate.

msim_saveA

把当前电路写成 .ms14 文件(必须 .ms14 后缀,否则 COM 打不开)。

Inputs: path (required).

msim_save_asC

把当前打开的电路另存为新的 .ms14。

Inputs: path (required).

msim_set_modelA

换元件的显示型号与模型参数(BJT/二极管换型号用)。

model_name 新显示型号,如 "2N3904"(图上标注和属性同步替换) model_text 新模型参数体,如 "NPN IS=6.734E-15 BF=416.4 ..."; 省略则只换显示名

注意:内部 .MODEL 键保留原名不改(改了会与 Multisim 元件数据库 失绑,文件打开即崩——实测),所以仿真参数换、网表 .MODEL 名不变, 对仿真结果无影响。同步 SPICE 参数体、属性槽、符号显示文字, 返回替换后的模型文本。

Inputs: refdes (required), model_name (required), model_text.

msim_set_valueB

改某个 RLC 元件的值(Ω / F / H),改完可以用 msim_save_as 存盘。

Inputs: value (required), refdes (required).

msim_spice_runA

走 Multisim 内核的命令通道跑一张纯网表,返回每个分析的结果数据。

与原理图仿真完全独立:不依赖探针和仪器,只要先用 msim_open 打开任意 .ms14(空白基底即可)建立 COM 上下文。流程:写 deck → 内核执行 → 解析每个 write 出来的 ASCII raw → JSON。

netlist SPICE 网表文本(纯 ASCII,首行是标题注释,末行 .end 可省) commands 分析命令列表,如 ["op", "tran 0 3m", "ac dec 50 10 10meg"]; 只接受分析/绘图命令,其它命令会被拒绝 outdir 结果目录(不能含空格);deck 和 plotN.raw 都写在这里

返回每条命令对应的 plotname/列名/行数据(复数列自动拆成 dB+相位)。

Inputs: outdir (required), netlist (required), commands (required).

msim_statusA

查询当前环境:32 位 worker 是否可用、Multisim COM 是否连得上、当前电路状态。

这是任何操作前应该先调的工具。不启动 Multisim 的可见窗口。

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 30 tools

    Disambiguation3/5

    Several tools have overlapping workflow roles: msim_open vs msim_edit_open vs msim_read_design vs msim_inspect, stepwise creation vs msim_build, and msim_add_probe vs msim_connect(probe=True). The descriptions clarify the distinctions, but the editing-session vs simulation-context boundaries remain easy for an agent to confuse.

    Naming Consistency4/5

    All tools use the msim_ prefix and snake_case, with mostly predictable verb_noun naming. A few names such as msim_status, msim_inspect, and msim_close are noun- or verb-only, but the overall convention is clear.

    Tool Count2/5

    At 30 tools, the surface is large and includes multiple parallel workflows for opening, reading, editing, building, and simulating circuits. While the domain is complex, several tools appear redundant or workflow-specific enough that the set is heavier than ideal.

    Completeness4/5

    The server covers circuit creation, editing, probes, instruments, multiple simulation modes, saving/exporting, BOM reporting, and cleanup. Minor gaps exist, such as no explicit probe removal and limited configuration for instruments beyond the function generator, but the core lifecycle is well covered.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Generates, simulates, and inspects LTspice circuits via MCP tools and resources, providing structured JSON interfaces for AI agents.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to operate the Falstad CircuitJS1 circuit simulator through MCP, including loading circuits, running transient simulations, probing waveforms, exporting circuits, and capturing schematic screenshots.
      8
      1
      GPL 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to control SimInTech dynamic modeling environment via COM API, including creating projects, configuring and connecting blocks, running simulations, and reading/writing signals.
      24
      3
      MIT