Skip to main content

ltspice-mcp

Work in progress. Expect breaking changes across versions.

ltspice-mcp is an MCP server that lets an AI assistant simulate circuits with LTspice or ngspice and edit LTspice schematics. Its goals are speed, correctness, token efficiency and clean schematics.

The assistant uses ready-made, well-tested tools, which know the quirks of SPICE and of each simulator, instead of improvised scripts.

Mechanical checks catch common errors before a file is written or run, and direct the assistant's attention to the right place. Layout is left to the assistant's judgment, not an auto-router.

Results come back as named numbers, such as a phase margin, instead of waveforms to read. To see a waveform yourself, ask for an interactive chart, shown in the chat where the client supports it.

Sweeps, corners and Monte Carlo take one call and run as background jobs that survive a restart and can be replayed.

With LTspice 26.1 or later on Windows, you and the assistant can edit the same open schematic (Working with LTspice open).

Everything the tools do is also available from Python, as the ltspice_mcp.api package. The server is 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. The extension asks for an optional sandbox folder. If you leave it 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": [] }
  }
}

The server needs Python 3.11 or newer. In Claude Code, claude mcp add -s project spice -- ltspice-mcp adds it without editing the JSON.

You also need LTspice or ngspice on the same machine. The server finds either one on Windows and Linux. On WSL, set the LTspice path yourself (WSL). Editing .asc schematics needs LTspice, because the server uses LTspice's symbol libraries. Reading and checking netlists works without a simulator. The plugin and the extension need uv.

macOS is not supported yet: the server cannot read simulation results there. It reads each .raw and .log file in a separate process with a memory limit, which has not been validated on macOS.

Make sure the assistant uses the server. Some assistants run the simulator from the shell instead. Name the server spice, as the plugin does, and not ltspice, which is the name LTspice's own MCP server takes. Then add this rule 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 .raw files or wrdata output.

If you prefer a less strict rule, When the shell is fine lists the cases in which running the simulator from the shell is acceptable.

LTspice's own MCP server. LTspice 26.1 and later include an MCP server, which registers as ltspice and can run beside this one. It drives the LTspice window and returns raw samples and logs, leaving measurements and Monte Carlo setup to the assistant. This server does not need it. Alongside LTspice's own MCP server describes an LTspice setting you may want to change.

Examples

  • "Bias this common-source amplifier at 100 µA. What's its gain, and does the transistor stay in saturation at the slow and fast corners?"
  • "Here's my LDO schematic. What are the overshoot and settling time for a 1 mA to 100 mA load step, and how much phase margin does it have at full load?"
  • "Run 500 Monte Carlo samples with 1% resistors and mismatch in the input pair, and tell me what fraction keep the output offset under 1 mV."
  • "Find an N-channel MOSFET in the LTspice library for a 12 V, 5 A low-side switch, and compare the conduction loss of the three best candidates."
  • "I have my filter open in LTspice and the output doesn't move. Find out why, fix it, and show me V(out)."

Supported simulators

Simulator Status
LTspice Primary. Windows, WSL2 (runs the Windows LTspice), Linux via Wine. Required for .asc schematic editing.
ngspice Simulation and analysis. Does not need LTspice.
QSPICE, Xyce Secondary, selected per run. Netlists only, not .asc. QSPICE only when the server runs natively on Windows.

Tools

The server has 8 tools:

Tool What it does
run_experiments Run a circuit, or a sweep or Monte Carlo set of runs, optionally measuring each
jobs Check on, wait for, cancel, or list submitted runs
analyze_results Measure finished runs, or a .raw file produced elsewhere
inspect Read circuits, schematics, symbols, nets, models, and server capabilities
edit_schematic Create and edit .asc schematics: place, move, wire, label
verify_circuit Check a circuit, compare a schematic with a netlist, draw a schematic
plot_waveform Interactive waveform chart, in the chat where the client supports it, otherwise in a browser
run_code Run a Python snippet that calls the server's Python API, for loops and calculations

The assistant reads how to use them from inspect(kind="guide"), which covers the simulators and common tasks, and looks up any option with inspect(kind="reference").

Configuration

The server runs without configuration. To change a setting, copy ltspice-mcp.example.toml to ltspice-mcp.toml in your working directory. That file describes every option. Any of them can also be set with an LTSPICE_MCP_ environment variable. The server keeps job records and results in .ltspice-mcp/ in the working directory; add that folder to .gitignore.

The tools can use any path unless you set a sandbox. [security] allowed_paths limits them to the folders it lists. It does not limit run_code, which runs Python with the server's own permissions, so approve run_code in your client as you would a shell command. If anyone else can reach the server, set [tools] run_code = false.

docs/USAGE.md covers the common settings, WSL, the files the server creates, and running the server on another machine.

Python API

Scripts and notebooks can do what the tools do by importing ltspice_mcp.api. Use it for optimizers, curve fits, CI checks, or any loop where each run depends on the last. The API returns complete results and numpy arrays, where the tools return pages. Scripts and the server share the job records in the working directory, so each can read a job the other ran.

pip install ltspice-mcp        # or: uv add ltspice-mcp

A script needs this install even if you use the plugin or the Desktop extension, which keep the server in an environment of their own. An assistant in a session does not need it, because it can use the API through run_code.

With an RC low-pass in circuits/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

this sweeps R1 and returns the lowest and highest cutoff frequency:

from ltspice_mcp.api import Api

with Api(working_dir="circuits") as api:
    result = api.run_experiments(
        circuits=[{"path": "rc.cir"}],
        variations=[{"kind": "assign", "assign": {"R1": ["1k", "2k", "4k"]}}],
        analyze={"recipes": [
            {"key": "fc", "metric": "bode_filter", "signal": "V(out)",
             "field": "cutoff_high_hz", "reduce": ["min", "max"]},
        ]},
    )
    print(result["analysis"]["result"]["results"]["fc"]["reduced"])

api.reference() lists the operations and api.guide() returns the guide. Python API explains how the API differs from the tools. The full specification is in docs/design/python_api.md.

Research behind the design

Published studies by other groups informed three design choices:

  • Measurements are returned as named numbers. A study of LLM workflows for switched-mode power supply design (arXiv:2507.10639, first published as SPICEAssistant) found that GPT-4o could not reliably read a ripple value from a waveform given as numbers or as an image, so its tools extract such values from each LTspice run and return them as text. With that simulation feedback, o3 solved 84.9% of 269 power-supply design tasks, against 25.4% with no simulation. The study compared simulation feedback with none, not named numbers with raw output.
  • Schematic edits are typed and checked. NetlistBench (arXiv:2608.12197) found that the strongest model's accuracy on netlist edits with dependent steps fell from 80% at 3 steps to 26% at 15. The study measured unassisted edits to text netlists. edit_schematic, which checks each typed operation before it writes the file, was designed in response; its effect has not been measured.
  • The tool interface is typed. A benchmark of agents that take chip designs from RTL to GDS (arXiv:2607.17528) traced 31.7% of physical-design errors to failures at the tool interface. That work is in a different domain, so it does not show the same effect in circuit simulation. The server follows the benchmark's recommendations: registered APIs, persistent sessions and structured results.

Development

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)

To release, run scripts/release.sh <version> and push the tag it creates. The script renders the fragments in changelog.d/ into CHANGELOG.md, stamps the version into the plugin and Desktop-extension manifests, and tags the commit. The pushed tag publishes to PyPI.

Contributing

The project does not take outside contributions yet. Bug reports with a reproduction are welcome as issues.

License

GPL-3.0-or-later

Metadata

Release files for ltspice-mcp 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ltspice-mcp 0.8.0
File Size Uploaded Provenance Actions
ltspice_mcp-0.8.0.tar.gz 5.0 MB With provenance Details for ltspice_mcp-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ltspice-mcp 0.8.0
File Interpreter ABI Platform Actions
ltspice_mcp-0.8.0-py3-none-any.whl Python 3 none any Details for ltspice_mcp-0.8.0-py3-none-any.whl

Total release size: 6.6 MB

Release files / ltspice_mcp-0.8.0.tar.gz

Download URL ltspice_mcp-0.8.0.tar.gz
Size 5.0 MB
Tags Source
SHA-256 checksum
How to use checksums
8110dd2a145c7a4454e3c99d698361c2552fc1c77fef69914a32eedbed859880
BLAKE2b-256 checksum
How to use checksums
3e7c2815d7b3dc62195b3960fa14fd7e11fdeb96e5c88fdb7b2a2df2325eb7ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / ltspice_mcp-0.8.0-py3-none-any.whl

Download URL ltspice_mcp-0.8.0-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
da6c68216c163cde4caa0d522a4e7ee36fef279cee7ac228f7714deda5052b65
BLAKE2b-256 checksum
How to use checksums
c818a590d4d5a4e419e182088b6207093587a50eda38dae981806be301feb9f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for ltspice-mcp 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ltspice_mcp-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page