spicelib-mcp
Provides tools for running SPICE circuit simulations (AC analysis, transient, DC op, parameter sweeps) using LTspice as the simulator.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@spicelib-mcp Run AC analysis of the common emitter amplifier from 100Hz to 10MHz"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
spicelib-mcp
A thin MCP server that wraps spicelib for circuit simulation. The heavy lifting, such as simulator invocation, .raw file parsing, and multi-simulator abstraction, is done by spicelib, which deserves most of the credit. This project is purely a transport layer that exposes spicelib's functionality as MCP tools for use with Claude Code (and other coding agents).
Primary use case: behavioral model fitting — run simulations, compare against real measurements, iterate on SPICE models.
Tools
run_ac_analysis— AC frequency sweep, returns magnitude/phase datarun_transient— transient simulation, returns time-domain waveformsrun_dc_op— DC operating point analysisrun_sweep— run multiple simulations in parallel, sweeping component values
Results are saved as .npz files alongside the netlist for further analysis and plotting.
Related MCP server: LTspice MCP
Supported simulators
Simulator |
| Install |
|
| |
| Download from Analog Devices | |
| Download from Qorvo |
Set the SPICE_PATH environment variable to override the simulator binary location.
Setup
Copy .mcp.json.template to .mcp.json in your project directory and adjust SPICE_SIMULATOR if needed:
{
"mcpServers": {
"spicelib": {
"type": "stdio",
"command": "uvx",
"args": ["spicelib-mcp"],
"env": {
"SPICE_SIMULATOR": "ngspice"
}
}
}
}Requirements
Python 3.10+
A supported simulator installed and on PATH
License
GPL-3.0-or-later
Available Tools
4 toolsrun_ac_analysisA
Run an AC frequency sweep on a SPICE netlist.
Injects a .ac dec <points_per_decade> <start_freq> <stop_freq> command
into a temporary copy of the netlist (does not modify the original).
Results are saved to a .npz file next to the netlist. Load with: data = np.load('netlist_ac.npz') freq = data['frequency_hz'] # traces are stored as complex values, e.g. data['v(out)']
For sweeping a component value or parameter across multiple AC runs in parallel, use run_sweep(analysis_cmd=".ac dec N fstart fstop") instead.
Args: netlist_path: Absolute path to the netlist file (.net, .sp, .cir, etc.) start_freq: Start frequency with optional SPICE suffix, e.g. "1", "1k", "100" stop_freq: Stop frequency, e.g. "1G", "100meg" points_per_decade: Points per decade (default 20)
Returns: JSON summary with data_file path, frequency range, and trace names.
Inputs: netlist_path (required), start_freq (required), stop_freq (required), points_per_decade. Returns: result
run_dc_opA
Run a DC operating point analysis on a SPICE netlist.
Injects a .op command into a temporary copy of the netlist (does not
modify the original file). DC op results are small enough to return directly.
Args: netlist_path: Absolute path to the netlist file
Returns: JSON string with keys: type — "dc_op" nodes — dict of node_name → voltage (V) currents — dict of device_name → current (A)
Inputs: netlist_path (required). Returns: result
run_sweepA
Run multiple SPICE simulations in parallel, sweeping component values.
Uses spicelib's SimRunner to execute runs concurrently. Each run gets its own .npz file. Use this instead of calling run_ac_analysis / run_transient in a loop — it's significantly faster for multi-run sweeps.
Example — sweep capacitor C1 across three values with a transient analysis: run_sweep( netlist_path="/path/to/filter.cir", analysis_cmd=".tran 1n 1u", runs=[{"C1": "1p"}, {"C1": "10p"}, {"C1": "100p"}], ) Output files: filter_sweep_001.npz, filter_sweep_002.npz, filter_sweep_003.npz
Each dict in runs maps component reference designators or SPICE parameter
names to their new values (strings with optional SPICE suffix, e.g. "4.7k").
Args: netlist_path: Absolute path to the netlist file analysis_cmd: Full SPICE analysis line, e.g. ".tran 1n 1u" or ".ac dec 20 1 1G" runs: List of dicts, one per simulation. Keys are component names or parameter names; values are the new value strings. parallel: Maximum number of simultaneous ngspice processes (default 4)
Returns: JSON list of per-run summaries, each with keys: run — 1-indexed run number data_file — path to the .npz file values — the component/parameter values used for this run traces — list of trace names in the .npz
Inputs: netlist_path (required), analysis_cmd (required), runs (required), parallel. Returns: result
run_transientA
Run a transient simulation on a SPICE netlist.
Injects a .tran <step_time> <stop_time> <start_time> command into a
temporary copy of the netlist (does not modify the original).
Results are saved to a .npz file next to the netlist. Load with: data = np.load('netlist_tran.npz') time = data['time_s'] vout = data['v(out)']
For sweeping a component value or parameter across multiple transient runs in parallel, use run_sweep(analysis_cmd=".tran step stop") instead.
Args: netlist_path: Absolute path to the netlist file step_time: Time step with SPICE suffix, e.g. "1n", "10u", "1m" stop_time: Simulation end time, e.g. "1m", "100u" start_time: Time at which to start saving data (default "0")
Returns: JSON summary with data_file path, time range, and trace names.
Inputs: netlist_path (required), step_time (required), stop_time (required), start_time. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct SPICE analysis type (AC, DC op, transient) or a sweep that combines them. The descriptions clearly state when to use run_sweep instead of individual calls, eliminating ambiguity.
All tools follow the consistent 'run_<analysis>' pattern with snake_case. The naming is predictable and makes the purpose immediately clear.
With 4 tools covering the core SPICE analyses and a parallel sweep utility, the count is well-scoped for a simulation-focused server. No extraneous or redundant tools.
The core transient, AC, and DC op analyses are covered, and the sweep tool fills the gap for multi-run parameter sweeps. Missing a dedicated DC sweep tool, but the sweep tool can handle that via analysis_cmd, so the gap is minor.
Maintenance
Related MCP Connectors
MCP server for aerospace calculations: orbital mechanics, ephemeris, DSN operations, ...
QuLab MCP remote server (Streamable HTTP) for computational science and lab tools.
MCP server for the Seline Analytics API
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- 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.48868 PyPI81GPL 3.0
- FlicenseNot gradedqualityDmaintenanceProvides circuit simulation capabilities via MCP, enabling creation, simulation (DC, AC, transient), and analysis of electronic circuits using PySpice.1-