pyspice-mcp-server

dirkenglund/pyspice-mcp-server

3.2

If you are the rightful owner of pyspice-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

PySpice MCP Server is a tool for creating and analyzing electronic circuits using the Model Context Protocol (MCP) with PySpice.

Tools
5
Resources
0
Prompts
0

PySpice MCP Server

MCP (Model Context Protocol) server for PySpice circuit simulation, providing tools for creating and analyzing electronic circuits.

Features

  • Create and modify SPICE circuits programmatically
  • Add components: resistors, capacitors, inductors, diodes, voltage/current sources
  • Run analyses: DC operating point, transient, AC frequency response
  • Generate plots: transient waveforms, Bode diagrams
  • Export netlists for use with other SPICE tools

Installation

System-wide Installation

  1. Install dependencies:
cd /Users/englund/Projects/20250808-playground-spice/pyspice-mcp-server
source ../pyspice_env/bin/activate
pip install -r requirements.txt
  1. Create symlink for system-wide access:
sudo ln -s /Users/englund/Projects/20250808-playground-spice/pyspice-mcp-server /usr/local/lib/pyspice-mcp-server
  1. Add to Claude Desktop configuration:
{
  "mcpServers": {
    "pyspice": {
      "command": "/Users/englund/Projects/20250808-playground-spice/pyspice_env/bin/python",
      "args": ["/Users/englund/Projects/20250808-playground-spice/pyspice-mcp-server/pyspice_mcp_server.py"]
    }
  }
}

Available Tools

Circuit Creation

  • create_circuit: Initialize a new circuit
  • clear_circuit: Clear the current circuit

Component Addition

  • add_resistor: Add a resistor
  • add_capacitor: Add a capacitor
  • add_inductor: Add an inductor
  • add_voltage_source: Add a DC voltage source
  • add_current_source: Add a DC current source
  • add_sinusoidal_source: Add an AC sinusoidal source
  • add_pulse_source: Add a pulse voltage source
  • add_diode: Add a diode

Analysis

  • run_dc_analysis: DC operating point analysis
  • run_transient_analysis: Time-domain transient analysis
  • run_ac_analysis: AC frequency response analysis

Visualization

  • plot_transient: Plot transient analysis results
  • plot_bode: Generate Bode plots from AC analysis

Utilities

  • get_netlist: Export circuit netlist

Example Usage

# Create a simple RC filter
create_circuit("RC Low-Pass Filter")
add_voltage_source("V1", "in", "gnd", "1V")
add_resistor("R1", "in", "out", "1kOhm")
add_capacitor("C1", "out", "gnd", "1uF")

# Run AC analysis
run_ac_analysis("1Hz", "1MHz", 20)
plot_bode("out")

Requirements

  • Python 3.8+
  • PySpice 1.5+
  • ngspice (system dependency)
  • MCP SDK

License

MIT