Skip to main content
Glama
lucasgerads

spicelib-mcp

by lucasgerads

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SPICE_PATHNoOverride the simulator binary location
SPICE_SIMULATORNoThe simulator to use: ngspice, ltspice, or qspice (default: ngspice)ngspice

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
run_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.

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.

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)

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

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucasgerads/spicelib-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server