diff --git a/README.md b/README.md index a51d58c..208ad88 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,123 @@ # mcltspice -MCP server for LTspice circuit simulation automation on Linux. +MCP server for LTspice circuit simulation automation on Linux. Drives LTspice via Wine in batch mode, parses binary `.raw` results, and exposes 37 tools for end-to-end circuit design workflows. -## Features +## Quick Start -- **Run Simulations** - Execute .asc schematics or .cir netlists in batch mode -- **Extract Waveforms** - Parse binary .raw files to get voltage/current data -- **Modify Schematics** - Programmatically edit component values -- **Browse Libraries** - Access 6500+ symbols and 4000+ example circuits +```bash +# Install and run +uvx mcltspice + +# Add to Claude Code +claude mcp add mcltspice -- uvx mcltspice + +# Local development +claude mcp add mcltspice -- uv run --directory /path/to/mcltspice mcltspice +``` ## Requirements - **Linux** with Wine installed -- **LTspice** extracted (see below) +- **LTspice** extracted from the Windows installer (see [Setup](#ltspice-setup)) - **Python 3.11+** -## Installation +## Tools -```bash -# From PyPI (once published) -uvx mcltspice +### Simulation -# From source -uv pip install -e . -``` +| Tool | Description | +|------|-------------| +| `simulate` | Run simulation on a `.asc` schematic | +| `simulate_netlist` | Run simulation on a `.cir` / `.net` netlist | +| `parameter_sweep` | Sweep a parameter across a range of values | +| `temperature_sweep` | Run simulations at different temperatures | +| `monte_carlo` | Monte Carlo analysis with component tolerances | +| `optimize_circuit` | Automatically optimize component values to hit target specs | +| `tune_circuit` | Measure performance and suggest parameter adjustments | -### LTspice Setup +### Waveform Extraction & Visualization + +| Tool | Description | +|------|-------------| +| `get_waveform` | Extract signal data from a `.raw` file | +| `list_simulation_runs` | List runs in a stepped/Monte Carlo simulation | +| `evaluate_waveform_expression` | Evaluate math expressions on waveforms (V*I, dB, etc.) | +| `export_csv` | Export waveform data to CSV | +| `plot_waveform` | Generate SVG plots from simulation results | + +### Signal Analysis + +| Tool | Description | +|------|-------------| +| `analyze_waveform` | FFT, THD, RMS, settling time, and more | +| `measure_bandwidth` | Measure -3dB bandwidth from AC analysis | +| `get_operating_point` | Extract DC operating point (.op) results | +| `get_transfer_function` | Extract .tf (transfer function) results | + +### Noise Analysis + +| Tool | Description | +|------|-------------| +| `analyze_noise` | Comprehensive noise analysis from .noise simulation | +| `get_spot_noise` | Noise spectral density at a specific frequency | +| `get_total_noise` | Integrated RMS noise over a frequency band | + +### Stability & Power + +| Tool | Description | +|------|-------------| +| `analyze_stability` | Gain margin and phase margin from AC loop gain | +| `analyze_power` | Power metrics from voltage and current waveforms | +| `compute_efficiency_tool` | Power conversion efficiency | + +### Schematic & Netlist + +| Tool | Description | +|------|-------------| +| `read_schematic` | Parse schematic components and nets | +| `edit_component` | Modify component values in a schematic | +| `diff_schematics` | Compare two schematics and show changes | +| `run_drc` | Design rule checks on a schematic | +| `create_netlist` | Build a SPICE netlist programmatically | +| `create_from_template` | Create a circuit from a pre-built template | +| `generate_schematic` | Generate a graphical `.asc` schematic from a template | +| `read_touchstone` | Parse Touchstone S-parameter files (.s1p, .s2p) | + +### Library & Templates + +| Tool | Description | +|------|-------------| +| `list_templates` | Available circuit templates with parameters and defaults | +| `list_symbols` | Browse LTspice's 6500+ component symbols | +| `list_examples` | Browse 4000+ example circuits | +| `get_symbol_info` | Pin details and attributes for a component symbol | +| `search_spice_models` | Search `.model` definitions in the library | +| `search_spice_subcircuits` | Search `.subckt` definitions (op-amps, ICs, etc.) | +| `check_installation` | Verify LTspice and Wine setup | + +## Resources + +| URI | Description | +|-----|-------------| +| `ltspice://symbols` | All component symbols by category | +| `ltspice://examples` | All example circuits | +| `ltspice://status` | Installation status | +| `ltspice://templates` | All circuit templates with parameters | +| `ltspice://template/{name}` | Detail for a specific template | + +## Prompts + +| Prompt | Description | +|--------|-------------| +| `design_filter` | Walk through filter design (type, topology, specs) | +| `analyze_power_supply` | Guide through power supply analysis | +| `debug_circuit` | Systematic circuit debugging workflow | +| `optimize_design` | Iterative design optimization | +| `monte_carlo_analysis` | Statistical yield analysis | +| `circuit_from_scratch` | Build a circuit from a description | +| `troubleshoot_simulation` | Diagnose simulation errors | + +## LTspice Setup Extract LTspice from the Windows MSI installer: @@ -42,39 +134,7 @@ export WINEARCH=win64 wineboot --init ``` -Set the `LTSPICE_DIR` environment variable or use the default `~/claude/ltspice/extracted/ltspice`. - -## MCP Tools - -| Tool | Description | -|------|-------------| -| `simulate` | Run simulation on .asc schematic | -| `simulate_netlist` | Run simulation on .cir netlist | -| `get_waveform` | Extract signal data from .raw file | -| `read_schematic` | Parse schematic components and nets | -| `edit_component` | Modify component values | -| `list_symbols` | Browse component symbol library | -| `list_examples` | Browse example circuits | -| `get_symbol_info` | Get symbol pins and attributes | -| `check_installation` | Verify LTspice setup | - -## MCP Resources - -- `ltspice://symbols` - All available component symbols -- `ltspice://examples` - All example circuits -- `ltspice://status` - Installation status - -## Usage with Claude Code - -```bash -claude mcp add mcltspice -- uvx mcltspice -``` - -Or for local development: - -```bash -claude mcp add mcltspice -- uv run --directory /path/to/mcltspice mcltspice -``` +Set `LTSPICE_DIR` to point at your extracted directory, or use the default `~/claude/ltspice/extracted/ltspice`. ## Repository