
MCP服务器赋予LLM通过LTSpice和NGspice设计、仿真和分析SPICE电路的能力
概览
核心功能可用,但要预料到有些粗糙和破坏性的变化。 一个MCP服务器,连接LLM助手(Claude及其他MCP客户端)与真实电路仿真:LTspice和ngspice,以及对LTspice .asc原理图的直接编辑。仿真结果以结构化数字形式返回——截止频率、超冲、相位裕度、上升时间以及每设备小信号操作点参数(gm、gds、vth等)——因此助手可以在你打开的LTspice文件中设计、验证和迭代电路,而无需手动解析原始文件。基于spicelib构建。 你还需要在主机上使用 LTspice 或 ngspice(在 Windows、Linux 和 macOS 上自动检测;在 WSL 上则明确设置 LTspice 路径——WSL 注释)。网表编辑(.cir/.net)完全无需模拟器;.asc 原理图编辑需要 LTspice 的 .asy 符号库。需要 UV;服务器本身在首次使用时从 PyPI 获取。
概述(AI 翻译)
进行中 0.6.0 是一个突破性版本: 旧的每操作工具被合并 到下面描述的集合中,引擎便可导入为 Python 版本 API。如果你需要旧工具,就钉住
ltspice-mcp==0.5.*。
ltspice-mcp 允许 AI 助手运行 LTspice 和 ngspice 模拟,并编辑 LTspice .asc 的设计图。助手不会直接获取原始输出文件,而是按名称返回测量值:截止频率、过冲、相位裕度、上升时间,以及每个设备的工作点值,如 gm、gds 和 vth。它运行在你在 LTspice 中打开的相同文件。基于 spicelib 构建。
快速开始
克劳德代码:
Claude Desktop: 在 packaging/mcpb/ 中构建扩展
并将.mcpb文件拖拽到Claude桌面。它提供了一个可选的沙盒
文件夹;留空,则没有沙盒。
任何其他MCP客户端(Cursor、Windsurf、Gemini CLI、Continue、Cline、Zed等):安装服务器并将其添加到客户端的MCP配置中。
这需要 Python 3.11 或更新版本。在 Claude 代码中,你可以跳过 JSON 部分
claude mcp add -s project spice -- ltspice-mcp。
你还需要在同一台机器上运行一个模拟器:LTspice 或 ngspice,找到了 Windows、Linux 和 macOS 上会自动实现。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
ltspice-mcp
WIP 0.6.0 was a breaking release: the old per-operation tools were merged into the set described below, and the engine became importable as a Python API. Pin
ltspice-mcp==0.5.*if you need the old tools.
ltspice-mcp lets AI assistants run LTspice and ngspice simulations and edit LTspice .asc schematics. Instead of raw output files, the assistant gets measurements back by name: cutoff frequency, overshoot, phase margin, rise time, and per-device operating-point values such as gm, gds and vth. It works on the same files you open in LTspice. Built on spicelib.
Quick start
Claude Code:
/plugin marketplace add cognitohazard/ltspice-mcp
/plugin install ltspice-mcp
Claude Desktop: build the extension in packaging/mcpb/
and drag the .mcpb file onto Claude Desktop. It offers an optional sandbox
folder; left blank, there is no sandbox.
Any other MCP client (Cursor, Windsurf, Gemini CLI, Continue, Cline, Zed, …): install the server and add it to the client’s MCP config.
uv tool install ltspice-mcp # or: pipx install ltspice-mcp
{
"mcpServers": {
"spice": { "command": "ltspice-mcp", "args": [] }
}
}
This needs Python 3.11 or newer. In Claude Code you can skip the JSON with
claude mcp add -s project spice -- ltspice-mcp.
You also need a simulator on the same machine: LTspice or ngspice, found
automatically on Windows, Linux and macOS. On WSL, set the LTspice path
yourself (WSL). Editing .asc schematics needs LTspice,
because it uses LTspice’s symbol libraries. Reading and checking netlists
works without a simulator. The plugin and the extension need
uv.
Make sure the assistant uses it. An assistant may run the simulator from
the shell out of habit. Keep the server’s name spice (the plugin already
does; avoid ltspice, which LTspice’s own MCP server uses), and add this to
your project’s CLAUDE.md or your client’s equivalent:
Always use the spice MCP server for any SPICE/circuit simulation, sweep, or analysis. Do not invoke ngspice or LTspice from the shell, and do not hand-parse
.rawfiles orwrdataoutput.
When the shell is fine covers the exceptions, if you prefer a softer rule.
What you can ask
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"spice": { "command": "ltspice-mcp", "args": [] }
}
}