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-mcpRun 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.
| Name | Required | Description | Default |
|---|---|---|---|
| netlist_path | Yes | ||
| start_freq | Yes | ||
| stop_freq | Yes | ||
| points_per_decade | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, but description discloses non-destructive behavior (temporary copy), output format (.npz), and how to load results. Could mention prerequisite netlist existence but still strong.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-structured with paragraphs, front-loaded purpose, and an Args table. Every sentence provides essential information with no waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers parameters, non-modification, output file details, and return format. Output schema exists but description's Returns section adequately describes the result. Complete for this tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Despite 0% schema coverage, description includes an Args section with clear explanations and examples for each parameter (e.g., SPICE suffix for frequencies), adding significant meaning beyond schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states it runs an AC frequency sweep on a SPICE netlist, injects .ac command, does not modify original. Distinguishes from sibling run_sweep which is for parameter sweeps.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly says to use run_sweep instead for sweeping component values across multiple AC runs, providing clear when-to-use and alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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)
| Name | Required | Description | Default |
|---|---|---|---|
| netlist_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description fully bears the responsibility of disclosing behavior. It states that the tool 'injects a .op command into a temporary copy of the netlist (does not modify the original file)' and that results are small enough to return directly. This provides clear insight into side effects and performance characteristics, though it could also mention error handling or permissions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured, with separate sections for purpose, behavior, arguments, and return value. Every sentence adds value without redundancy, making it easy to scan and understand.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that the tool has only one parameter and an output schema is provided in the description, the description covers the necessary information: what the tool does, how it works, what is returned, and the format of the result. It is complete for its simplicity, though it could mention potential errors or limitations to achieve full completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has zero description coverage, so the description must add meaning. The Args section clarifies that 'netlist_path' is an 'Absolute path to the netlist file', which provides essential semantic context beyond the schema's mere type definition. This fully compensates for the missing schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool performs a DC operating point analysis on a SPICE netlist. The verb 'Run' and specific resource 'DC operating point analysis' are precise. The tool name and description differentiate it from siblings such as AC analysis, sweep, and transient, making its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not provide any guidance on when to use this tool over alternatives like run_ac_analysis or run_transient. There is no explicit context about appropriate use cases, prerequisites, or conditions that would help an AI agent decide when to invoke this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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
| Name | Required | Description | Default |
|---|---|---|---|
| netlist_path | Yes | ||
| analysis_cmd | Yes | ||
| runs | Yes | ||
| parallel | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Describes internal use of SimRunner, concurrency, per-run .npz file creation, and default parallelism. Mentions output format (JSON list with run, data_file, values, traces). No annotations provided, so description fully carries the burden.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Well-organized: purpose sentence, implementation detail, usage recommendation, example, parameter descriptions, return description. Every sentence adds value; no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers all inputs and output format despite having output schema. Explains output file naming and return structure. Even with good annotations, the description would be complete; without annotations, it is exemplary.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All four parameters are explained with descriptions, types, and examples. netlist_path as absolute path, analysis_cmd as full SPICE line, runs as list of dicts with key-value pairs, parallel with default. Compensates for 0% schema description coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states it runs multiple SPICE simulations in parallel sweeping component values. Distinguishes from siblings by explicitly advising use instead of calling run_ac_analysis/run_transient in a loop.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly tells when to use this tool vs alternatives: 'Use this instead of calling run_ac_analysis / run_transient in a loop — it's significantly faster for multi-run sweeps.' Provides a concrete example.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| netlist_path | Yes | ||
| step_time | Yes | ||
| stop_time | Yes | ||
| start_time | No | 0 |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses that the tool creates a temporary copy (no modification to original), injects a .tran command, saves results to .npz file, and provides loading instructions. This gives good insight into behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured: a concise summary sentence followed by behavioral details, an example usage, alternative tool reference, and clear parameter descriptions. No wasted sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of an output schema, the description covers return format (JSON summary with data_file, time range, trace names). It also addresses key behavioral aspects like file creation. For a moderate complexity tool (4 params, SPICE context), it is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It clearly explains each parameter: netlist_path, step_time, stop_time, and start_time (including default and format examples like '1n', '10u'). This adds significant meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states 'Run a transient simulation on a SPICE netlist' with a specific verb and resource. It distinguishes from sibling tool run_sweep by noting that run_sweep is for parameter sweeping across multiple runs.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear guidance on when to use this tool (single transient analysis) and explicitly directs to run_sweep for sweeping parameters. It does not list explicit when-not scenarios but offers a clear alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.5- First observed
run_ac_analysis - First observed
run_dc_op - First observed
run_sweep - First observed
run_transient
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 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.7119-
- 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.4843GPL 3.0
- FlicenseNot gradedqualityFmaintenanceProvides circuit simulation capabilities via MCP, enabling creation, simulation (DC, AC, transient), and analysis of electronic circuits using PySpice.1-