ltspice-mcp
仓库来源: 此公共集成分支基于上游
cognitohazard/ltspice-mcp标签v0.5.0(提交4dc456000e1a436ef37a585c23ab35954a8caf04e)。 本分支中的新增内容提供了与安装无关的部署示例和文档。未修改任何上游服务器源代码。
ltspice-mcp
正在进行中。 核心功能可用,但预计会有粗糙之处和破坏性变更。
一个 MCP 服务器,将 LLM 助手(Claude 及任何其他 MCP 客户端)连接到真实的电路仿真:LTspice 和 ngspice,以及直接编辑 LTspice .asc 原理图。仿真结果以结构化数字返回——截止频率、超调量、相位裕度、上升时间,以及按名称读回的每个器件的 小信号工作点参数(gm、gds、vth 等)——因此助手可以在你于 LTspice 中打开的同一文件中设计、验证和迭代电路,而无需手动解析原始文件。基于 spicelib 构建。
快速开始
在 Claude Code 中,安装插件:
/plugin marketplace add cognitohazard/ltspice-mcp
/plugin install ltspice-mcp你还需要在主机上安装 LTspice 或 ngspice(在 Windows、Linux 和 macOS 上自动检测;在 WSL 上需显式设置 LTspice 路径——WSL 说明)。电路编辑无需任何仿真器即可工作。需要 uv;服务器本身在首次使用时从 PyPI 获取。
手动安装(任何 MCP 客户端)
安装服务器,然后将客户端指向它:
uv tool install ltspice-mcp # or: pip install ltspice-mcp / pipx install ltspice-mcpClaude Code — 一条命令(去掉 -s project 可全局安装):
claude mcp add -s project ltspice -- ltspice-mcp其他客户端 — Claude Desktop、Cursor、Windsurf、Gemini CLI、Continue、Cline、Zed 等——将这段 mcpServers 配置添加到客户端的 MCP 配置文件中(每个客户端都记录了自己的路径):
{
"mcpServers": {
"ltspice": { "command": "ltspice-mcp", "args": [] }
}
}需要 Python 3.11+。用 ltspice-mcp --help 验证。同一服务器还以两个别名发布——circuit-mcp 和 ngspice-mcp——因此 uvx circuit-mcp / uvx ngspice-mcp 是 uvx ltspice-mcp 的等效替代,如果你觉得这些名称更容易发现的话。
Web 客户端(claude.ai、ChatGPT)需要 stdio→HTTP 桥接,例如 mcp-proxy——只能在完全受你控制的网络上暴露此服务器,因为它会在 allowed_paths 内写入文件并生成进程。
还提供了 Claude Desktop 扩展:在 packaging/mcpb/ 中构建 .mcpb 文件,然后将其拖到 Claude Desktop 上即可一键安装,并带有用于电路目录的原生文件夹选择器。与插件一样,它封装了 PyPI 包,需要主机上有 uv 和仿真器(它不捆绑 LTspice 或 ngspice)。
Related MCP server: ltspice-mcp
使用方法
连接后,你可以用自然语言请求电路工作。助手设计电路并决定测量什么;服务器运行仿真器,解析二进制输出,并返回数字。它会报告运行产生的结果,包括仿真器自身的警告,并将结果是否良好的判断留给你和助手。
"将该 NMOS 共源级偏置到目标漏电流的饱和状态,并报告 gm/ID。"
助手编写网表,在 LTspice 上求解偏置点,并按名称读取器件的 工作点——漏电流、gm、gds、VDS 与 VDSAT 对比以确认处于饱和状态,以及模拟设计人员用来定标的 gm/ID。如果偏置有偏差,它会调整栅参考或 W/L 并重新运行,每次只需几秒。
其他以同样方式工作的请求:
"该稳压器阶跃响应的超调量和稳定时间是多少?" — 运行瞬态分析,并从波形中测量两者,以及上升时间、振铃频率和最终值。
"运行 200 次蒙特卡洛,电阻容差 5%,告诉我输出分布。" — 每次运行扰动组件,仿真批次,并报告每个测量的均值、标准差和最坏情况值。
"将负载从 100 Ω 扫描到 10 kΩ,找出效率下降的位置。" — 参数扫描,每次运行都有结果。
"表征此 NMOS:gm 和 gm/ID 与 VGS 的关系。" — 编写
.dc Vgs测试文件,使用.save @m1[gm] @m1[id],在 ngspice 上运行,并将 gm/ID 表作为一个 CSV 返回(无需.control块,无需解析原始文件)。"为低侧开关寻找 N 沟道功率 MOSFET,并测量导通状态压降。" — 在加载的库中搜索零件(
find_model),将其放入脉冲栅瞬态中,并从.meas结果中读取 Vds(on) 和负载电流。"将此差分对构建为可在 LTspice 中打开的原理图。" — 将组件放置并连线到真实的
.asc文件中,并带有正交路由和引脚碰撞检查。"这个环路稳定吗?" — 环路增益的 AC 分析;报告每个交叉点的相位和增益裕度,而不仅仅是第一个。
"这个串联 RLC 的谐振频率和 Q 值是多少?" — 运行 AC 扫描,并报告每个峰值的中心频率、Q 值和 −3 dB 带宽。
警告与它影响的数字一起出现。 像 ngspice 这样的仿真器可能会在日志深处打印一次"奇异矩阵",然后完成运行并写出完全合理的数字——手动读取时看起来一切正常。当你向服务器请求其中一个数字时,隐藏的行会附加到该数字上,出现在紧邻值的 observations 字段中,因此故障会出现在你正在查看的地方,而不是容易被忽略的地方。
在同一文件上进行协同设计
所有操作都基于普通的 LTspice 和 SPICE 文件,因此工作在你和助手之间来回传递,而不是停留在聊天中:
在 LTspice 中绘制原理图,然后交给助手:"工作点是多少?"、"为什么输出不动?"、"添加补偿并检查相位裕度。"
或者反过来:助手设计并验证电路,然后写入
.asc;你在 LTspice 中打开它,检查并手动调整。你的手动编辑就是文件的新状态——助手会在下一次请求时从那里继续。变更可以在设计过程中双向流动:在 GUI 中调整一个值并请求重新验证,或者让助手在你提交之前扫描你正在考虑的变更。
功能
仿真与测量。 运行 LTspice 或 ngspice,并直接解析二进制输出。测量在服务器端计算并以数字返回:时域(上升/下降、超调、稳定、延迟、周期/占空比/抖动、RMS、THD)、频域(滤波器截止频率和滚降、任意频率下的增益和相位、稳定裕度、带 Q 值的谐振峰、积分噪声)、DC 工作点,以及 .MEAS 指令结果(包括失败的)。每个器件的 小信号工作点参数(gm、gds、vth 等)在两个仿真器上都按名称返回——LTspice 通过自动添加的 .options logopinfo 块,ngspice 通过 .save @dev[param] 轨迹。使用 export_waveform 读取 .dc 扫描中的集合作为 gm/ID 表,或使用 operating_point 读取单个偏置点(以 m1.gm / @m1[gm] 形式寻址,无需解析原始文件)。
原理图和 netlist 编辑。 创建和编辑真实的 LTspice .asc 文件——放置组件、连接引脚、标记网络——并在写入前进行验证:会与引脚碰撞、重叠连接点或对角运行的连线会被拒绝,每次编辑都会返回关于浮动引脚或悬空标签的警告。会话中的编辑可以撤销。普通 netlist(.cir/.net)在文本级别获得相同的操作,外加静态验证,在仿真之前捕获格式错误的卡片。
扫描和蒙特卡洛。 多维参数扫描和蒙特卡洛,支持每个组件的容差、.MODEL 工艺变化和 Pelgrom W·L 器件失配。每次测量的统计量跨运行聚合,任何单次运行都可以提取出来,像独立仿真一样分析。
任务与信任。 仿真作为可取消的任务运行,具有超时和并发上限;长时间运行立即返回任务 ID,任务状态在服务器重启后仍然存在。结果报告事实而非结论:完成的运行携带仿真器自身的警告、未产生任何结果的测量,以及作为结构化观察的极端节点值。判断结果是否可信由读取它的模型决定。
支持的仿真器
仿真器 | 状态 |
LTspice | 主要。Windows 原生,WSL2(通过 interop 使用 Windows LTspice.exe),Linux 通过 Wine。 |
ngspice | 一流:仿真、解析、诊断、分析。无需 LTspice 安装的开源路径。 |
QSPICE、Xyce | 支持但次要。 |
配置
开箱即用,使用默认值。要自定义,请将 ltspice-mcp.example.toml 复制为 ltspice-mcp.toml;任何设置都可以用 LTSPICE_MCP_ 前缀的环境变量覆盖,--config PATH 或 LTSPICE_MCP_CONFIG 选择文件。关键选项:
[simulator]
default = "ltspice" # ltspice, ngspice, qspice, xyce (null = auto-detect)
path = "" # explicit executable path (required on WSL)
ngbehavior = "hsa" # ngspice compat mode; unset = spicelib default, "hsa" fixes sectioned .lib corner select
[security]
allowed_paths = ["."] # sandbox: only these directories are accessible
[simulation]
max_parallel = 4
timeout = 300.0 # seconds
[tools]
profile = "full" # or "agentic"
[state]
persist_jobs = true有关完整选项列表,请参阅 src/ltspice_mcp/config.py([analysis]、[schematic]、[logging] 等)。
在 WSL 上,LTspice.exe 通过 Windows interop(而非 Wine)运行,spicelib 无法跨 WSL 边界自动检测它。请显式设置 Windows 侧路径:
[simulator]
path = "/mnt/c/Program Files/ADI/LTspice/LTspice.exe"仿真输出会自动重定向到 Windows 临时目录:LTspice 的 .MEAS 结果通过 SQLite .db 文件存储,这些文件在 UNC 路径(\\wsl.localhost\...)上会失败,如果没有重定向,测量数据会从日志中静默消失。
.asc 编辑的 .asy 符号路径在 Windows 和 WSL 上自动检测;使用 [schematic] symbol_paths 或 LTSPICE_MCP_SYMBOL_PATHS 覆盖。
工具配置文件
配置文件 | 工具 | 使用场景 |
| 49 | 任何 MCP 客户端、自动化、非代理 LLM |
| 41 | 具有原生文件访问(读取/编辑/写入)的 LLM 代理 |
agentic 配置文件去掉了 netlist 编辑包装器和库会话管理——有能力的代理通过直接文件编辑完成的工作——并保留仿真生命周期、二进制 .raw 解析、批处理编排和 .asc 几何工具。skills/ 目录(skills/ltspice/SKILL.md、skills/ngspice/SKILL.md)包含与之配套的领域知识:将相关技能复制到客户端的持久指令位置。
运行位置。 服务器会调用本地的 LTspice/ngspice,并从磁盘读取电路文件,因此它必须运行在模拟器和文件所在的位置。两种配置可用:本机上的 MCP 主机(Claude Desktop、Claude Code、Cursor、Gemini CLI、Codex 等),或沙箱可以安装 ngspice 并注册服务器的基于浏览器的云代理(已通过 Claude 验证)。LTspice 仅限本地使用(Windows 应用);ngspice 是开源的,在两种环境中都可以使用。没有沙箱的消费级 Web 聊天没有模拟器,也没有文件访问权限,因此无法直接运行此服务器;如果你想要这种 UI,可以将其桥接到你控制的机器上(例如 mcp-proxy)。
底层机制:工具级循环
对于“design a 1 kHz RC low-pass and verify it”,助手实际做的是。它写出网表(R=1k,C=159.155n → fc = 1 kHz):
* rc.cir — RC low-pass
V1 in 0 AC 1
R1 in out 1k
C1 out 0 159.155n
.ac dec 50 1 1Meg
.end然后驱动三个工具:
validate_netlist(path="rc.cir")
→ OK: directives valid, element arities check out — safe to simulate
run_simulation(netlist="rc.cir")
→ {"job_id": "sim_a3f1", "status": "completed", "raw_file": ".../rc.raw", ...}
bode_metrics(raw_file=".../rc.raw", signal="V(out)", mode="filter")并取回标量,而不是图表:
{
"signal": "V(out)",
"filter_type": "lowpass",
"passband_gain_db": 0.0,
"passband_ripple_db": 0.02,
"cutoff_low_hz": null,
"cutoff_high_hz": 1000.4,
"stopband_rejection_db": 59.97,
"rolloff_slope_db_per_decade": -19.9,
"estimated_order": 1,
"warnings": []
}(节选——完整响应还包括通带边界和过渡带宽)
偏离目标 → set_component_value,重新运行,重新测量。长时间运行的模拟会返回作业 ID 而不是阻塞;check_job/cancel_job 负责管理它们。作业元数据持久化保存在每个电路的 sidecar 文件中({dir}/.ltspice-mcp/jobs/——将 .ltspice-mcp/ 添加到你的 .gitignore),MCP 资源(spice://results/...、spice://netlists/...、spice://config)会暴露作业、信号、测量结果和配置供浏览。
每个工具都声明 MCP 注解(readOnlyHint、destructiveHint、idempotentHint、openWorldHint);返回数据的工具会为 structuredContent 自省声明 outputSchema。
工具 | 描述 |
| 从内容字符串创建新的网表 |
| 创建一个空的 |
| 读取电路文件( |
| 列出组件(可选前缀过滤器)或按引用查找一个组件 |
| 设置一个组件值,或通过 |
| 读取所有 |
| 添加或移除 SPICE 指令( |
| 添加组件;返回引脚位置、边界框、重叠警告 |
| 通过引用连接两个引脚,并带路径点路由;验证引脚冲突、连接点、对角线 |
| 符号引脚位置、方向、边界框、描述 |
| 已放置组件的引脚位置、边界框、属性 |
| 通过 LTspice 将 |
| 在仿真前对网表或原理图进行静态预检 |
| 在引脚 / |
| 将 |
| 两个电路文件之间的结构差异 |
| 在一个事务中应用多个 |
| 运行仿真 — 短运行同步,长运行异步(作业 ID);设置批处理标志,处理 ngspice 无头原始数据方言,路由 raw/log 产物,呈现收敛/超时错误(无需手动解析原始文件) |
| 按 ID 检查作业状态,或列出所有作业 |
| 取消正在运行的仿真或批处理;终止模拟器进程 |
| 最小值、最大值、平均值、RMS、峰峰值(AC 的 dB/相位) |
| 信号在窗口内的抽取最小/最大值统计包络 — 查看形状,然后重新请求更窄的窗口以放大 |
| 将一个或多个信号以全保真 CSV 格式导出到磁盘(所有分析类型; |
| 交互式 HTML 图表(瞬态 / DC / Bode 双面板,带 |
| 特定时间/频率下的信号值(或设备工作点参数 |
| DC 工作点:所有节点电压、支路电流和每个设备的工作点参数(gm/gds/vth/…),在 LTspice(自动 |
| 完整摘要:仿真类型、信号、测量、警告 |
| 一个瞬态边缘的上升/下降时间和转换速率 |
| 阶跃响应的过冲、欠冲、稳定时间 |
| 两个瞬态信号之间的传播延迟 |
| 振荡信号的周期、频率、占空比、抖动 |
| 通过 FFT 计算周期瞬态的总谐波失真(THD/THD+N);相干采样以获得精确结果;呈现所有条件 |
| 在扫描或蒙特卡洛运行中聚合 |
| 按 |
| 环路增益稳定性:所有单位增益 / -180° 交叉点及每个交叉点的裕度 |
| AC 峰值,每个峰值带 Q 因子和 -3 dB 带宽 |
| AC 响应的极点/零点结构:净阶数、角频率范围 + Q、非最小相位 / RHP 零点、传输延迟(供人工审查的事实) |
| 将 |
| 配置多参数扫描(线性或对数) |
| 执行配置的扫描(异步,返回作业 ID) |
| 配置蒙特卡洛:容差、 |
| 执行配置的蒙特卡洛分析(异步,返回作业 ID) |
| 扫描/MC 作业进度、每个信号的统计或每次运行的数据 |
| 查找模型候选(默认模糊匹配, |
| 加载 |
| 卸载先前加载的库 |
| 列出已加载的库,可选带模型名称 |
| 检测到的模拟器、配置、沙箱路径、运行时状态 |
| 最近使用的电路和作业(来自持久索引) |
开发
uv sync # install runtime + dev dependencies
uv run pytest tests/ -v # tests
uv run pyright # type checking
uv run ruff check src/ tests/ # lint
uv run ltspice-mcp # run the server (stdio)更多:docs/DESIGN.md(范围、架构、非目标)和 docs/spice_lex.md(SPICE 解析器内部)。
许可证
GPL-3.0
Available Tools
49 toolsac_structureARead-onlyIdempotent
Read the pole/zero STRUCTURE of an .AC response — net order, corner frequencies (as ranges) with Q, out-of-phase zeros, and transport delay — to support design reasoning (where the poles/zeros roughly are, damping, out-of-phase zeros). It first tries a rational fit and uses its poles/zeros when the fit is clean; otherwise it falls back to asymptotic Bode reading (slope breakpoints + joint gain-phase + group delay + a gain-phase consistency residual).
Returns FACTS, not a verdict — bring your own control/design knowledge. The most design-critical fact is the non_minimum_phase flag: an out-of-phase zero or a transport delay adds phase lag the magnitude plot cannot show, and caps achievable loop bandwidth; do not close a loop on magnitude alone when it is flagged.
IMPORTANT — these are read from a finite sweep, so HAVE A HUMAN REVIEW them against the Bode plot (use plot_waveform on the same signal) and the circuit before acting. Closely-spaced corners merge into one range (merged: true) rather than being resolved individually, and exact pole/zero COUNTS are not guaranteed — for exact poles/zeros run a .pz analysis on ngspice. Requires a .AC run. Siblings: bode_metrics (margins / cutoffs / point queries), resonance (peaks + Q), stability_metrics (loop margins).
Inputs: signal (required), step, format, job_id, +2 more. Returns: method, signal, corners, net_order, +7 more
add_componentA
Add a new component to an .asc schematic at a specified grid position.
Inputs: x (required), y (required), path (required), symbol (required), +5 more. Returns: pins, symbol, position, rotation, +3 more
apply_schematic_opsADestructive
Apply many .asc edits in one transaction. Loads the schematic once, runs each op against the in-memory editor in order, and saves once at the end. Cuts the typical 25+ tool calls to build a real circuit (add_component × N + connect × N + add_net_label × N + edit_directive × N) down to a single round-trip. This is also the home for the ack-only schematic mutations that have no standalone tool — they return no geometry to act on, so they live here rather than each costing a separate tool slot.
Supported ops (each tagged via the op field): add_component, set_component_value, set_component_attribute, remove_component, move_component, add_net_label, remove_net_label, remove_wire, connect, add_directive, remove_directive.
By default, the first op that raises aborts the whole transaction and nothing is written to disk. Set stop_on_error=false to run every op and persist whatever subset succeeded — useful when each op is independent and partial progress is acceptable. Errors are recorded under each op's error field; successes carry the per-op result keys (e.g. wire_count).
Inputs: ops (required), path (required), format, dry_run, +1 more. Returns: path, saved, dry_run, results, +3 more
batch_resultsARead-onlyIdempotent
Query a batch simulation job (sweep or Monte Carlo). Without signal: returns job status and progress. With signal: returns aggregate statistics or per-run data for that signal.
Inputs: job_id (required), at, raw, limit, +4 more. Returns: mode, runs, stats, job_id, +12 more
bode_metricsARead-onlyIdempotent
AC / Bode-plot analysis in one tool, selected by mode. The response shape depends on the mode:
mode='filter' — filter type, cutoffs (at ref_db below passband), passband gain/ripple, stopband rejection, transition BW, pole-order, and an auto-estimated asymptotic roll-off slope (dB/decade) — covers cutoff AND slope in one call.
mode='slope' — magnitude slope (dB/decade + dB/octave) between f_low and f_high; pick endpoints ≥1 decade past any knee. Use when you need a custom window or dB/octave ('filter' already reports an auto-estimated asymptotic dB/decade slope).
mode='point' — magnitude (dB + linear) and phase at each of frequencies (log-axis interpolation; out-of-range clamps + warns).
mode='crossing' — every frequency where quantity crosses level (phase is UNWRAPPED first); the escape hatch for custom queries like unity-gain (0 dB) or phase-margin (-180°) frequencies.
Pass all_steps=true to compute the chosen mode for every step of a .step sweep in one call (returns a steps list instead of a single result) — e.g. the -3 dB cutoff at every value of a stepped component.
To analyze a run of a completed sweep/MC job, pass job_id + run_index instead of raw_file (combine with all_steps to also sweep the .step axis within that run).
For loop-gain stability margins use stability_metrics; for resonant peaks & Q use resonance.
Inputs: mode (required), signal (required), step, f_end, +19 more. Returns: mode, level, steps, params, +31 more
cancel_jobADestructiveIdempotent
Cancel a running simulation job (single run, or a sweep/Monte-Carlo batch). Kills the simulator process(es) and marks the job as cancelled.
Inputs: job_id (required).
check_jobARead-onlyIdempotent
Check status of a simulation job by ID, or list all jobs. Without job_id: lists active jobs (filter with status param). With job_id: returns detailed status or completion results.
Inputs: format, job_id, status. Returns: jobs, count, error, range, +23 more
component_infoARead-onlyIdempotent
Get a placed component's pin positions, bounding box, value, and attributes from an .asc schematic.
Inputs: path (required), reference (required), format. Returns: pins, value, symbol, position, +4 more
configure_montecarloAIdempotent
Configure a Monte Carlo analysis with component tolerances and return a config_id for later execution.
Inputs: netlist (required), seed, mismatch, num_runs, +3 more.
configure_sweepAIdempotent
Configure a multi-parameter sweep for a netlist and return a config_id for later execution. Dimensions combine as a full cross-product, so this also covers deterministic worst-case corner analysis (give each component a two-value [low, high] set — N parts yields 2^N corners that bound the true extremes, which random Monte Carlo cannot guarantee) and sensitivity analysis (sweep one part at a time across its tolerance to rank impact). Use configure_montecarlo instead for statistical yield/spread. NOT for a bias sweep: a native .dc Vds Vgs (e.g. a gm/ID characterization) goes in one deck + run_simulation + export_waveform, not here — this is for per-value SEPARATE runs (corners, L/W, .lib model swaps).
Inputs: netlist (required), parameters (required).
connectA
Connect two component pins with wire(s). Resolves pin positions automatically. Waypoints define the wire route through intermediate points. For a straight horizontal or vertical connection, waypoints can be omitted.
Inputs: path (required), to_pin (required), from_pin (required), waypoints. Returns: to, from, points, warnings, +2 more
create_netlistADestructive
Create a new SPICE netlist file from content string. Automatically appends .END if missing.
Inputs: name (required), content (required), overwrite.
create_schematicADestructive
Create an empty .asc schematic ready for incremental editing via add_component / connect / add_net_label. Tip: prefer create_netlist + .cir for design iteration; use this only when a visual schematic is the deliverable. Prefer apply_schematic_ops for multi-step builds (one transaction); wire signal nets with connect; label grounds — and any net a .meas/B-source references by name — via add_net_label flags at pins. Don't hand-edit the .asc. Full layout guidance: the spice://guide resource.
Inputs: name (required), width, format, height, +1 more. Returns: path, width, height
diff_circuitARead-onlyIdempotent
Structural diff between two circuit files: reports added/removed components, components whose value or attributes (Value2/SpiceLine/SpiceModel) changed, and added/removed .PARAM/.MEAS/.MODEL directives. Use after set_component_value, set_component_attribute or edit_directive to confirm that the intended change actually landed.
Inputs: path_a (required), path_b (required), format.
edge_metricsARead-onlyIdempotent
Use when you need to quantify HOW FAST one transition happened: rise time, fall time, slew rate. Inputs a transient .raw plus a time window around the edge of interest.
Returns: transition_time (10→90% by default, configurable via low_pct/high_pct), slew_rate (V/s or A/s), detected low/high levels, and the three crossing times.
Levels are auto-estimated from the first/last 10% of the window — NOT global min/max — so overshoot/undershoot doesn't poison the level estimate. Crossings are sub-sample-accurate via linear interpolation. Rejects AC analysis.
PICK THE WINDOW. If the transient has startup glitches or multiple edges, set t_start/t_end tightly around the edge you care about — otherwise you get the first edge in the full waveform, which is often the power-up artifact. Use edge_index only when multiple edges in the window are intentional.
For settling/overshoot after the edge, use pulse_response. For delay between two signals' edges, use timing_between.
Inputs: signal (required), edge, step, t_end, +10 more. Returns: signal, low_pct, high_pct, warnings, +10 more
edit_directiveA
Add or remove a SPICE directive or .asc free-text comment. Set kind=comment for annotation text; default is a SPICE directive. Works on .cir/.net and .asc; kind=comment is .asc-only. remove matches against directives AND comments, so callers can delete either kind without knowing which it is. Adding a .param is not supported here — use the 'parameter' tool to set .PARAM values.
Inputs: path (required), action (required), instruction (required), x, +3 more.
export_netlistADestructiveIdempotent
Export an .asc schematic to a SPICE netlist (.net) using LTspice.
Inputs: path (required).
export_waveformA
Full-fidelity waveform egress: write every sample of one or more signals to a CSV file on disk and return its path — for when you want to compute on the raw data yourself (FFT, custom metrics, cross-correlation) rather than read a scalar or a decimated envelope.
Lossless within the chosen window (no decimation — that is get_waveform's job). Works on transient (.tran), DC sweep (.dc), AC (.ac), and noise (.noise). Complex AC traces are written as magnitude(dB)+phase(deg) by default (complex_format selects re/im or both); phase is the wrapped np.angle — run np.unwrap yourself for a continuous curve. A stepped (.step / Monte-Carlo) run is written tidy/long: one row per (step, sample) with leading step_index/step_value columns, because each transient step has its own time vector. The observations list surfaces FACTS (rows written, window coverage, non-finite samples KEPT, the complex format used) — not verdicts.
Returns the CSV path plus row/column counts; read the file with your own tools. Sibling egress, don't confuse: get_waveform returns a DECIMATED envelope as numbers in your context (no file); plot_waveform renders an interactive PICTURE for a human. For a single scalar use signal_stats/query_value.
Inputs: t_end, format, job_id, out_dir, +5 more. Returns: path, columns, n_steps, signals, +6 more
find_modelARead-onlyIdempotent
Find model/subcircuit candidates across loaded (and optionally built-in) libraries. Default is fuzzy matching — finds typos, case variants, and near-neighbour part numbers (e.g., '2N3905' → '2N3904'); pass exact=true to only return the exact case-insensitive match. Returns ranked candidates with similarity score and an include_directive emitted in the simulator's native path form (on WSL this is the Windows path LTspice.exe expects, not the /mnt/c Linux path). Each candidate carries ports (the .SUBCKT port list, empty for .MODEL) and params (default parameter values from the body / params: clause). For .MODEL devices it also carries device_type (the SPICE device token: NPN, PNP, D, NMOS, VDMOS, NJF …) and, for recognised tokens, a usage connection-order string (e.g. Qxxx C B E <name>) — a .MODEL gives parameters but not node order, and wiring the part in the wrong order simulates silently wrong.
Inputs: name (required), full, exact, limit, +3 more. Returns: exact, query, cutoff, results, +1 more
get_waveformARead-onlyIdempotent
Decimated numeric egress FOR THE MODEL: returns a min/max-preserving stat-envelope of one real-valued signal as DATA in your context (numbers, not a picture) over a time/sweep/frequency window — for when a scalar isn't enough and you need the SHAPE (switching nodes, amplifier internal nodes, startup transients).
Splits the window into equal-time buckets; each bucket reports the raw sample min/max (a narrow spike or ringing peak is never averaged away), time-weighted trapezoidal mean/rms (correct on SPICE's adaptive timestep), pk_pk, and crest_factor (peak/rms — high = impulsive/spiky). Scalar-guided zoom: read the envelope, then re-request a narrower [t_start, t_end] to resolve a region at higher resolution (same call, tighter window). The observations list surfaces FACTS, not verdicts (decimation coverage, dropped non-finite samples, which bucket has the largest pk-to-pk) — you decide what the shape means.
Works on transient (.tran), DC sweep (.dc), and noise (.noise) results. Sibling egress, don't confuse: export_waveform writes EVERY sample to a CSV FILE for your own code; plot_waveform renders an interactive PICTURE for a human to look at. For complex AC data use bode_metrics; for a single scalar use signal_stats; for one point value use query_value.
Inputs: signal (required), step, t_end, format, +5 more. Returns: signal, buckets, axis_unit, decimated, +7 more
list_componentsARead-onlyIdempotent
List components in a circuit file, optionally filtered by type prefix, or return a single component value by reference.
Inputs: path (required), limit, format, offset, +2 more. Returns: components, pagination
list_librariesDRead-onlyIdempotent
List loaded libraries. With detail=true, also shows the .SUBCKT and .MODEL names defined in each library (so foundry .bjt/.mod files with hundreds of .MODEL cards are discoverable without guessing), and names encrypted vendor files whose bodies can't be parsed.
Inputs: path, limit, detail, format, +1 more. Returns: libraries, pagination
load_libraryA
Load a SPICE library file (.lib, .mod) or directory of library files into the session.
Inputs: path (required).
measurement_statsARead-onlyIdempotent
Use to AGGREGATE .MEAS scalar results across a .step sweep or Monte Carlo run. Answers questions like 'across 100 MC trials, what's the worst-case rise time?' or 'how does gain vary as R sweeps 1k..10k?'. Inputs the .log file produced by the run.
Returns per-measurement: min, max, mean, median, std, p10, p90, min_step_index (argmin) and max_step_index (argmax), failure count, and an optional histogram (set histogram_bins=0 to skip).
Accepts any job id: a sweep/MC batch aggregates across its runs; a single-simulation job aggregates its own log (one value per step for a .step run). WHEN-style .MEAS (constant level, varying crossing) is detected the same way on both paths and swaps to aggregating the 'at' (crossing) field; the aggregated_field output says which was used. On a plain single run, stats collapse to n=1 (one value per measurement): the headline stats are the value the simulator printed — for a WHEN that's the trigger level — and any AT/crossing time is returned separately in the entry's 'at' field, so a single-run WHEN/AT read isn't lost. (simulation_summary also just reads the raw scalars.)
Works with .MEAS from any analysis type (.tran/.ac/.dc/.op) — the measurement directives themselves embed the analysis context. Pass measurement=NAME to aggregate just one; otherwise returns all .MEAS in the log.
Inputs: format, job_id, log_file, measurement, +1 more. Returns: stats, per_run
noise_integralARead-onlyIdempotent
Integrate a .noise spectral density to a total RMS noise over a band. SPICE stores amplitude density (V/√Hz or A/√Hz) for both LTspice and ngspice, so total = sqrt(∫ density² df) — the same value LTspice shows when you Ctrl-click a V(onoise) label. Reports the band actually integrated and the sample count. Noise figure / SNR are left to you (they need the source resistance and a reference level).
Inputs: step, f_end, format, job_id, +4 more. Returns: unit, signal, n_points, warnings, +4 more
operating_pointARead-onlyIdempotent
Read DC operating point data: all node voltages, branch currents, and each semiconductor's small-signal params (gm/gds/vth/vdsat/caps) — from LTspice's log (run_simulation auto-adds '.options logopinfo' on .op runs) or ngspice's @dev[param] traces, surfaced uniformly by name. Each value carries its SI unit where the simulator declared the type (see units). Pass device='M1' to get just one device's params + terminal currents in a single call.
A run-level solve failure (singular matrix / non-convergence) taints every value here; that simulator line is relayed into warnings — read it before trusting the bias point.
Inputs: at, step, device, format, +3 more. Returns: step, units, device, currents, +5 more
parameterAIdempotent
Read, write, or delete .PARAM directive values in a circuit file. Pass delete=true with name to remove a parameter (the inverse of setting one).
Inputs: path (required), name, value, delete, +1 more. Returns: parameters
periodic_metricsARead-onlyIdempotent
Use for an oscillating transient signal (clock, oscillator output, switching waveform) when you need period, frequency, duty cycle, pulse widths, and period-to-period jitter.
Returns: period (mean across measured periods), frequency (1/period), jitter_rms (std-dev of period lengths — timing jitter, NOT signal amplitude variance), duty_cycle_pct, mean high/low pulse widths, edge counts. duty_cycle_pct / pulse_widths are null if no full periods could be paired. A period is the span between consecutive rising crossings, so num_periods_measured = num_rising_edges - 1 (you need N+1 edges to measure N periods).
Uses threshold crossings; threshold defaults to the midpoint of window min/max. For a signal with DC drift, set an explicit threshold — the auto midpoint moves with the drift and the edge detection gets unstable. min_periods guards against accidentally running on 1-edge windows.
Skip the startup transient via t_start/t_end; the first cycle is often wider than steady state. Rejects AC analysis. For a single edge (not periodic), use edge_metrics.
Inputs: signal (required), step, t_end, format, +6 more. Returns: period, signal, warnings, frequency, +8 more
plot_waveformA
Render an INTERACTIVE chart of one or more signals FOR A HUMAN to look at (zoom/pan/hover) — the co-design complement to the numeric tools. It returns NO data values to the model; it produces a picture.
Picks the chart from the run type: transient (V/I vs time), DC sweep, AC Bode (stacked magnitude-dB + phase-deg vs log frequency), noise (vs log frequency); a .step / Monte-Carlo run overlays every step as a labelled trace (or pass step for one). Full fidelity by default, with a min/max-preserving downsample above max_points (spikes survive; surfaced as a fact). Writes a self-contained HTML file and returns its path — into out_dir if given, else a '.ltspice-mcp/plots/' sidecar next to the circuit (for a job_id) or next to the raw (for a raw_file); on a host that supports MCP Apps the chart is also embedded as an interactive in-chat widget, otherwise it opens in your local browser.
Sibling egress, don't confuse: for numbers in your context use get_waveform (decimated); for every sample on disk use export_waveform (CSV); for a scalar use signal_stats/bode_metrics. This tool is for looking, not measuring.
Inputs: open, step, t_end, format, +8 more. Returns: path, opened, opener, panels, +11 more
pulse_responseARead-onlyIdempotent
Use when you need step-response quality metrics: overshoot %, undershoot %, settling time, peak value and peak time. Inputs a transient .raw covering ONE step transition — ideally with the stimulus edge near t_start and enough tail to see settling.
Returns: direction (rising/falling), initial/steady-state values, peak (absolute and pct), settling_time (to within settling_tolerance_pct band). settling_time is null in three cases, kept distinct in the text and quality flags: 'never (within window)', 'undefined (full-pulse window)', and 'unknown' when the trailing window is too noisy to trust the final value (still ringing) — pass final_value there.
Definitions: overshoot is excursion BEYOND final in the step direction; undershoot is excursion beyond initial opposite the step direction. overshoot_pct = 0 means MEASURED overdamped, not missing data. settling_tolerance_pct defaults to 2% of |final - initial|; 1% and 5% are also common.
If the auto-detected initial/final (mean of first/last 10% of window) is contaminated by ringing, pass explicit initial_value/final_value. Rejects AC analysis.
For just rise/fall time without overshoot, use edge_metrics.
Inputs: signal (required), step, t_end, format, +7 more. Returns: signal, quality, warnings, direction, +8 more
query_valueARead-onlyIdempotent
Look up the value of a signal at a specific time point (transient) or frequency (AC). Returns the nearest data point without interpolation.
To pick a step of a .step/.DC sweep by its axis VALUE (rather than a raw step index), pass step_axis + step_value (e.g. step_axis='temp', step_value='27'); at then selects the inner-axis point within that step (optional). AC samples also return magnitude_linear alongside magnitude_db/phase_deg.
To query a run of a completed sweep/MC job, pass job_id + run_index instead of raw_file — the run is analyzed like any standalone raw.
This is one signal at one point (signal=). For many signals, or a whole waveform over a window, use export_waveform (signals=).
If the run hit a run-level solve failure (singular matrix / non-convergence), that simulator line is relayed into warnings — the value is still returned, but the whole solve is suspect, so read it.
Inputs: signal (required), at, step, format, +5 more. Returns: axis, unit, value, signal, +12 more
read_circuitARead-onlyIdempotent
Read and parse a circuit file (.cir/.net or .asc). For netlists: returns content and component values. For schematics: returns layout and directives.
Inputs: path (required), format. Returns: file, type, wires, labels, +4 more
recentARead-onlyIdempotent
Call on session start to find circuits the user was last working with, including jobs that were still running when the server stopped. Needs no inputs.
Returns a list of recent circuits, each with its absolute path, whether the file still exists, last-touched timestamp, total persisted job count, status_counts (completed/failed/interrupted/etc.), and the IDs of any interrupted jobs.
'interrupted' means a simulation was in flight when the server stopped — recovery path is check_job(job_id) to see whether results are recoverable or the run needs to be re-kicked. Does NOT start or cancel anything; purely read-only.
Inputs: format. Returns: count, circuits
reset_schematicADestructiveIdempotent
Revert an .asc schematic to the state it had BEFORE the first edit this session — a recovery escape hatch for when a sequence of edits went wrong. The server snapshots each .asc file's bytes just before its first in-session mutation (add_component, set_component_value, move_component, connect, apply_schematic_ops, etc.); this restores that snapshot exactly and drops it (so a later edit establishes a fresh restore point). Because add_component is a trigger, the first add_component on a freshly created schematic snapshots the empty file — so reset can revert all the way back to the empty post-create state, dropping every component added this session. Returns reverted=false (not an error) when the file has no recorded in-session edits. Note: the snapshot lives only for the current server session — it does not persist across restarts, and it is not a substitute for version control.
Inputs: path (required), format. Returns: path, bytes, reverted
resonanceARead-onlyIdempotent
Detect magnitude peaks in an AC sweep and estimate Q factor + -3 dB bandwidth for each. Useful for RLC resonators, crystal oscillators, peaking amps, or any response with distinct resonant modes.
Q = f_peak / Δf(-3 dB from peak). Q is returned as null for peaks without two flanking -3 dB crossings inside the swept range — widen the sweep if you need Q for a boundary peak.
min_prominence_db=3 rejects the gentle hump of a filter's passband (which isn't a resonance). Tight resonances (Q > 30) need dense sampling near f_peak — log sweeps with <50 pts/decade will under-sample the peak and give inflated Q/bandwidth.
For overall filter characterization use bode_metrics(mode='filter'); for stability margins use stability_metrics.
Inputs: signal (required), step, format, job_id, +5 more. Returns: peaks, signal, warnings, num_peaks_detected
run_montecarloA
Execute a previously configured Monte Carlo analysis asynchronously and return a job_id immediately.
Inputs: config_id (required), max_parallel.
run_simulationA
Run a SPICE simulation on a netlist file. Sets the right batch flags, handles the ngspice headerless-raw dialect, routes the raw/log artifacts, and parses the results — so you never hand-parse a rawfile. Automatically runs synchronously for short simulations (<=30s timeout) or asynchronously for longer ones. Use wait=true to force synchronous execution. Returns raw/log file paths and simulation summary on completion, or a job ID for async tracking.
Inputs: netlist (required), wait, format, timeout. Returns: error, range, errors, job_id, +16 more
run_sweepA
Execute a previously configured parameter sweep asynchronously and return a job_id immediately.
Inputs: config_id (required), max_parallel.
server_statusARead-onlyIdempotent
Get comprehensive server status including detected simulators, configuration settings, security sandbox paths, and runtime state. Use this to check what capabilities are available before attempting operations.
Inputs: format. Returns: runtime, simulators, tool_count, diagnostics, +6 more
set_component_valueAIdempotent
Set component value(s) in a circuit file (single or batch mode), or rewrite one component's node connectivity ('nodes', single mode, .cir/.net only). A no-op value write is reported as unchanged.
Inputs: path (required), nodes, value, values, +1 more.
signal_statsARead-onlyIdempotent
Scalar summary of one signal in a .raw result. Use this when you need a single number per metric (average, RMS, peak, etc.) — not a waveform or a trend.
Transient: time-weighted mean, RMS, std, abs-mean, and min/max/pk-pk using trapezoidal integration (RMS = sqrt(∫ y² dt / T)). This is correct on SPICE's adaptive timestep — simple np.mean(y) would overweight densely sampled regions. Optionally restrict to [t_start, t_end]; passing no window averages the whole waveform including any startup transient, which is usually wrong for RMS/mean.
DC: returns min/max/pk-pk and the simple/abs mean over the swept axis, plus sweep_start_used/sweep_end_used/sweep_span. RMS and std are deliberately omitted — they're meaningless on a non-time axis. Use t_start/t_end to restrict the sweep range.
AC: returns magnitude (dB) min/max/mean and phase (deg) min/max. t_start/t_end are rejected for AC — use query_value for a point at a specific frequency.
Noise: returns min/max/pk-pk of the noise spectral density over the frequency axis, plus freq_start_used/freq_end_used. Mean, RMS, std, and duration are omitted — a plain mean of spectral density is dominated by sample clustering and the sweep span, not the circuit; min/max is the useful worst-case reading. t_start/t_end are rejected — pass them via query_value at specific frequencies instead.
Related tools: for rise/fall times use edge_metrics; for overshoot/settling use pulse_response; for period/duty use periodic_metrics; to aggregate .MEAS values across a sweep use measurement_stats.
Inputs: signal (required), step, t_end, format, +4 more. Returns: max, min, rms, std, +20 more
simulation_summaryARead-onlyIdempotent
Get a comprehensive simulation summary including type, signal list, data size, .MEAS results, Fourier analysis, AC bandwidth metrics, and warnings.
Inputs: step, format, job_id, signal, +3 more. Returns: range, errors, fourier, signals, +9 more
stability_metricsARead-onlyIdempotent
Find EVERY unity-gain and -180° phase crossover in a loop-gain AC sweep, report phase margin at each unity-gain crossing and gain margin at each -180° crossing. Replaces the single-crossing approximation in simulation_summary, which returns wrong margins on conditionally-stable systems.
Run this on a LOOP-GAIN signal (typically a dedicated middlebrook probe or .AC of the open loop). Running on a closed-loop output gives meaningless margins — if the DC phase starts near ±180° (a closed-loop / inverting output rather than a loop probe, which starts near 0°), a warning says so in warnings.
Returns: dc_gain_db, high_freq_gain_db, stability classification (stable / unstable / conditional / unconditional / always_below_unity), all crossings, per-crossing margins, and the worst-case values.
Nuances:
Phase is UNWRAPPED first, so systems whose phase drops past -360° are handled correctly (otherwise the raw wrap hides the crossing).
If phase NEVER crosses -180°, gain margin is 'infinite' (returned as null with stability='unconditional'). That's stable, not an error.
If gain NEVER reaches unity, phase margin is undefined (returned as null with stability='always_below_unity').
Multiple crossovers trigger stability='conditional' and a warning — each one needs its own review.
For -3 dB filter cutoffs use bode_metrics(mode='filter'); for custom crossings use bode_metrics(mode='crossing').
Inputs: signal (required), step, format, job_id, +3 more. Returns: signal, warnings, stability, dc_gain_db, +7 more
symbol_infoARead-onlyIdempotent
Get symbol pin positions, bounding box, and description. Optionally compute absolute positions for a given placement and rotation.
Inputs: symbol (required), x, y, format, +1 more. Returns: name, pins, placement, bbox_width, +4 more
thdARead-onlyIdempotent
Total harmonic distortion (THD and THD+N) of a periodic transient signal via FFT — works on any .tran result without a .four directive in the deck, and on any simulator. Defaults to COHERENT sampling (record trimmed to whole fundamental cycles, rectangular window) so harmonics land exactly on bins and THD is exact; window='hann' is the approximate fallback. Surfaces every condition the number depends on: the fundamental (given vs auto-detected), window kind, cycles analyzed, FFT length, sample rate, and per-harmonic levels. For LTspice's own .four result instead, see simulation_summary's Fourier section.
Inputs: signal (required), step, t_end, format, +7 more. Returns: fs_hz, n_fft, signal, thd_db, +12 more
timing_betweenARead-onlyIdempotent
Use when you need propagation delay / skew between TWO signals — e.g. input-to-output delay, clock-to-Q, input-skew. Inputs one transient .raw containing both signals on a shared time axis.
Returns: signed delay = t_b - t_a where t_a and t_b are the FIRST threshold crossings of signal_a and signal_b in the window. Negative delay means signal_b leads signal_a.
Thresholds default to 50% of EACH signal's own min-max range in the window — intentional for asymmetric CMOS where V_in and V_out have different rails. Override per-signal via threshold_a / threshold_b if you need absolute thresholds (e.g. VIH/VIL at fixed voltages). Set direction_a / direction_b independently (e.g. rising input → falling output for an inverter).
Picks only the FIRST crossing of each signal in the window — if both signals have multiple edges, tighten t_start/t_end around the specific edge pair you want. Rejects AC analysis.
Inputs: signal_a (required), signal_b (required), step, t_end, +10 more. Returns: t_a, t_b, delay, signal_a, +8 more
trace_netARead-onlyIdempotent
Report everything electrically connected to a net: starting from a pin ('Ref.Pin'), a net label ('net:NAME'), or an (x,y) coordinate, return the net's labels and every component pin, FLAG, and wire vertex on it. Follows both wires (segment-aware — catches labels placed mid-wire) and same-name FLAGs (LTspice's name-based nets). Use it to answer 'what's on net X', to confirm a connect landed, or to spot an accidental short (a net carrying two different non-ground labels).
Inputs: path (required), x, y, pin, +1 more. Returns: pins, start, labels, is_shorted, +1 more
unload_libraryAIdempotent
Unload a previously loaded library from the session.
Inputs: path (required).
validate_netlistARead-onlyIdempotent
Lint a netlist or schematic before simulation — the static circuit check gate. Catches: empty/whitespace-only netlist files, element arity (too few nodes, missing E/G/F/H/B value), dangling nodes in .cir/.net netlists (a node touching only one element terminal — warning, since deliberate fragments are legal), bias-topology degeneracies in .cir/.net netlists (a net with no DC path to ground — floating MOSFET gate, capacitive island, current-source-only node, or isolated domain — warning, since the operating point may still be defined by other means), duplicate/multiple analysis directives ('More than one analysis specified'), .MEAS whose analysis kind isn't present, known-bad .MEAS patterns (vdb()/phase()/group_delay()), and directives the LTspice runner is known to reject (set target_simulator='ngspice' to instead flag ngspice-only incompatibilities, e.g. a zero '.tran' step time). On .asc, also surfaces named-net shorts, floating pins, and dangling labels. Returns a structured issue list; an empty list means the file passes the static gate. Note: value tokens (e.g. a typo'd '1kk') and undefined model references are NOT checked — LTspice coerces or resolves those at run time.
Inputs: path (required), format, target_simulator. Returns: file, issues, issue_count
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 49 tools
Most tools have clearly distinct purposes, with detailed cross-referencing that resolves potential confusion (e.g., get_waveform vs export_waveform vs plot_waveform). A few overlaps exist—such as run_sweep/run_montecarlo and the various AC analysis tools—but the descriptions explicitly delineate when each should be used.
All tool names follow a snake_case convention with a mostly verb_noun pattern (run_simulation, list_components, set_component_value). A few names are nouns or adjectives (resonance, operating_point, recent, parameter), but the overall style is consistent and readable.
49 tools is a very large surface for an MCP server, exceeding the 25+ threshold where coherence tends to degrade. While the domain is broad (simulation, analysis, schematic editing, libraries), the sheer number makes navigation and selection harder.
The tool set covers the full LTspice workflow: circuit creation/editing, netlist validation, simulation execution (single, sweep, Monte Carlo), job management, comprehensive signal analysis (time/frequency/AC/noise), and library management. There are no obvious dead ends; every core operation has a corresponding tool.
Maintenance
Related MCP Connectors
Design circuits with your AI agent: circuit blocks, simulation, checks and KiCad files.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Design circuits, simulate and verify embedded firmware, and lay out PCBs with AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceAI-powered circuit design through simulation — an MCP server that gives language models direct access to SPICE circuit simulation via ngspice, enabling natural language circuit description and automated netlist generation, simulation, measurement, and spec verification.28107 PyPI51GPL 3.0
- FlicenseCqualityCmaintenanceMCP server for automating LTspice on macOS, enabling simulation, schematic generation, data extraction, verification, and rendering via natural language or agents.7122-
- AlicenseNot gradedqualityBmaintenanceThis MCP server enables agents to control LTspice on macOS for running simulations, generating schematics, extracting data, and automating verification workflows.MIT
- AlicenseAqualityBmaintenanceAn MCP server that connects LLM assistants to real circuit simulation: LTspice and ngspice, plus direct editing of LTspice .asc schematics. Simulation results come back as structured numbers so the assistant can design, verify, and iterate on circuits.48594 PyPI89GPL 3.0