Skip to main content
Glama
microcap-mcp

microcap-mcp

by monoxide-xen

microcap-mcp

ИИ-агент строит, считает и рисует аналоговые схемы в Micro-Cap 12.

tests License: MIT Python 3.11+ Windows MCP

Русский · English

Схему нарисовал сам сервер (1:1 с Micro-Cap, с рабочей точкой) · график посчитал Micro-Cap


Работает через штатный batch-режим Micro-Cap (MC12 @batch.bat) — headless, без GUI-автоматизации и без модификации программы.

Что делает

🔧 Строит схемы с нуля — 8 генераторов каскадов (общий эмиттер, повторитель, MOSFET, дифпара, токовое зеркало, каскод, ОУ, RLC) с авто-смещением. Каждый сверен с теорией: усиление, рабочая точка, резонанс.

📊 Считает — transient / AC / DC / искажения / устойчивость, рабочая точка, свипы. Комплексный вывод как {re, im}, диагностика солвера.

🎨 Рисует — сам рендерит .CIR в SVG 1:1 с Micro-Cap: родные символы из библиотеки MC, сетка, все повороты и отражения, раскладка подписей. Накладывает напряжения рабочей точки. /IC в batch-режиме MC этого не умеет — а сервер умеет.

Related MCP server: ltspice-mcp

Установка

Нужен Windows, Python 3.11+ и установленный Micro-Cap 12 (фримварь). Клонировать ничего не надо — укажи в MCP-клиенте, и uvx сам скачает пакет:

{
  "mcpServers": {
    "microcap": {
      "command": "uvx",
      "args": ["microcap-mcp"],
      "env": { "MICROCAP_HOME": "E:/Tools/MC12" }   // только если автопоиск не нашёл
    }
  }
}

Драйвер сам ищет Micro-Cap в типовых местах; MICROCAP_HOME укажи на папку с mc12_64.exe, если он лежит нестандартно.

git clone https://github.com/monoxide-xen/microcap-mcp
cd microcap-mcp
uv sync
{
  "mcpServers": {
    "microcap": {
      "command": "uv",
      "args": ["--directory", "C:/path/to/microcap-mcp", "run", "microcap-mcp"]
    }
  }
}

Инструменты

Инструмент

Что делает

simulate · sweep · plot

посчитать SPICE-нетлист, свип по .DEFINE, график в JPEG

generate_transistor_amplifier · _emitter_follower · _mosfet_amplifier

каскады на транзисторе / MOSFET, авто-смещение под середину питания

generate_differential_pair · _current_mirror · _cascode · _amplifier

дифпара, зеркало, каскод, усилитель на ОУ

generate_schematic

источник + R/C/L последовательно и параллельно (RC/RL/RLC, делители, контуры)

simulate_schematic · plot_schematic

посчитать / построить график произвольной .CIR

draw_schematic · annotate_schematic

нарисовать .CIR в SVG (1:1 с MC) · с рабочей точкой на схеме

simulate_example · search_examples · get_example · describe_example · list_domains

~490 эталонных схем из поставки MC: поиск, исходник, анализы

Плюс ресурсы microcap://guide и microcap://domains и промпт analyse_circuit — чтобы агент не дал MC молча соврать.

Тесты

uv run pytest        # 138 юнит без Micro-Cap; +30 интеграционных против физики (нужен MC)

Без Micro-Cap интеграционные пропускаются — CI остаётся зелёным.

Как это устроено

  • Особенности Micro-Cap — поведение, которого нет в мануале (а местами оно мануалу противоречит).

  • eval/harness.py — прогон всех ~490 схем поставки с раскладкой провалов по причинам (сейчас 88% отвечают).

Лицензия

MIT на код репозитория. Micro-Cap 12 принадлежит Spectrum Software — не включён, не перезалит, не модифицирован: используется его документированный CLI.

Available Tools

20 tools
annotate_schematicA

Render the schematic as SVG with each labelled node's DC operating-point voltage written beside it — a marked-up drawing you can read the bias off.

Runs the DC operating point (a short transient at t=0), reads the voltage at every [Grid Text] node the schematic labels (IN, OUT, OUTP…), and overlays them on the drawing. Best on the generated stages and other circuits that hold a stable operating point.

Inputs: cir (required).

describe_exampleA

Report what a reference circuit is set up to do, without running it.

Returns the analyses it defines and the expressions it plots. Read this before simulate_example so you ask for an analysis that exists.

Inputs: name (required). Returns: object

draw_schematicA

Render a .CIR schematic as an SVG picture — the drawing, not a plot.

Micro-Cap's own schematic-image command does not work in batch, so this draws the circuit directly from the .CIR (the same placements, wires and node labels), giving recognisable symbols for R/C/L, sources, ground, BJT/MOSFET and op-amp. Use it to see a circuit — a reference you fetched or one drawn by the generators — without opening Micro-Cap. No simulation runs.

Returns SVG (vector, self-contained); save it as .svg or embed it.

Inputs: cir (required).

generate_amplifierA

Draw a .CIR op-amp amplifier with a near-ideal op-amp.

inverting gives gain -Rf/Rin; non-inverting gives 1 + Rf/Rg. The feedback resistor is sized from gain and rin. Produces a drawn schematic; feed it to simulate_schematic or hand the .CIR to the user.

Args: gain: magnitude of the closed-loop gain (> 0; non-inverting needs >= 1). kind: inverting or non-inverting. rin: input resistor (inverting) or gain resistor to ground (non-inverting); sets the feedback resistor from the gain. source: source VALUE, Micro-Cap syntax ("DC=0 AC=1" for AC). analysis: AC, Transient, or DC. output_node: label for the output node.

Returns the .CIR text.

Inputs: gain (required), rin, kind, source, +2 more. Returns: object

generate_cascodeA

Draw a .CIR cascode amplifier (common-emitter under common-base).

A common-emitter transistor stacked under a common-base transistor. The midband gain is the common-emitter's, -Rc/(Re+re'), but the upper transistor shields the lower one's collector from the output swing, so the Miller capacitance nearly vanishes and both output impedance and bandwidth rise — the reason to use a cascode over a plain common-emitter. All bias points are computed for a mid-supply output with active-region headroom, and both bases are driven by sources carrying their DC bias directly (no coupling caps or dividers). Rc must exceed Re.

Args: rc, re: collector load and emitter degeneration; their ratio is the gain. vcc: supply voltage. source: AC drive VALUE added to the lower base's bias ("AC=1"). analysis: AC, Transient, or DC. output_node: label for the output node (the upper collector).

Returns the .CIR text.

Inputs: rc, re, vcc, source, +2 more. Returns: object

generate_current_mirrorA

Draw a .CIR BJT current mirror.

A diode-connected NPN sets a reference current Iref = (Vcc - Vbe)/Rref; a matched NPN copies it into Rload. The mirrored current is Iout ≈ Iref (a few % high from the Early effect). It is a DC bias block, so run a transient/DC and read V(OUTC): the mirrored current is (Vcc - V(OUTC)) / Rload.

Args: rref: reference-leg resistor; sets Iref. rload: load on the output transistor's collector. vcc: supply voltage. analysis: transient or dc (it is a bias block, not an AC stage). output_node: label for the output collector node.

Returns the .CIR text.

Inputs: vcc, rref, rload, analysis, +1 more. Returns: object

generate_differential_pairA

Draw a .CIR BJT long-tailed (differential) pair.

Two matched NPN sharing an emitter tail resistor to ground, each collector loaded by Rc. Single-ended drive on one base; the collectors OUTP and OUTN swing in antiphase, each with magnitude Rc/(2*re'). The common-mode base voltage and tail resistor are auto-sized to bias both collectors near mid-supply, so the pair is balanced and in the active region — the differential gain then works out near Vcc/(4*Vt), set by the supply rather than by Rc. Both collectors are labelled; the default trace plots OUTP (edit it to plot OUTN).

Args: rc: collector load on each side. rt: emitter tail resistor; leave unset to auto-size for mid-supply. vcc: supply voltage. vb: common-mode base voltage; leave unset for vcc/2. source: AC drive VALUE for the input base ("AC=1"). analysis: AC, Transient, or DC. output_node: which collector the default trace plots (OUTP/OUTN).

Returns the .CIR text.

Inputs: rc, rt, vb, vcc, +3 more. Returns: object

generate_emitter_followerA

Draw a .CIR emitter follower (common-collector BJT buffer).

Collector straight to the supply, output at the emitter. Voltage gain is just under 1 (Re/(Re+re')); the value is current gain and low output impedance — a buffer that drives a heavy load without loading the source. The divider auto-biases the emitter at mid-supply so it can swing both ways. Feed the result to simulate_schematic.

Args: re: emitter resistor (sets the bias current Vcc/2 / Re). r1, r2: base bias divider; leave unset to auto-bias, or give both. vcc: supply voltage. cin: input coupling capacitor. source: input source VALUE, Micro-Cap syntax. analysis: AC, Transient, or DC. output_node: label for the emitter output node.

Returns the .CIR text.

Inputs: r1, r2, re, cin, +4 more. Returns: object

generate_mosfet_amplifierA

Draw a .CIR common-source MOSFET gain stage (NMOS primitive).

Gate divider bias, source degeneration, AC-coupled input, body tied to source. Midband gain is -gm*Rd/(1+gm*Rs) — roughly -Rd/Rs when gm*Rs is large. By default the gate divider is computed from the model's VTO/KP to bias the drain at mid-supply, so the device stays in saturation and actually amplifies (a mis-biased MOSFET drops out of saturation and the gain collapses). Feed the result to simulate_schematic.

Args: rd, rs: drain and (degeneration) source resistors. r1, r2: gate bias divider; leave unset to auto-bias for a mid-supply drain, or give both to override. vdd: supply voltage. cin: input coupling capacitor. source: input source VALUE, Micro-Cap syntax ("AC=1" for AC gain). analysis: AC, Transient, or DC. output_node: label for the drain output node.

Returns the .CIR text.

Inputs: r1, r2, rd, rs, +5 more. Returns: object

generate_schematicA

Draw a .CIR schematic: a voltage source driving parts in series to ground, optionally with parallel branches from the output node to ground.

Unlike a netlist, this produces a drawn schematic you can open in Micro-Cap. Feed the result to simulate_schematic to run it, or hand the .CIR text to the user.

Bounded on purpose — a source, a series chain of two-terminal passives (R, C, L), and optional parallel shunt branches. That covers RC/RL/RLC, dividers, and resonant tanks. Every pin position is taken from Micro-Cap's own component library, so the drawn circuit is electrically what you asked for. For an op-amp gain stage use generate_amplifier; for a common-emitter BJT stage use generate_transistor_amplifier.

Args: parts: ordered "KIND=VALUE" strings in series, KIND in R/C/L, e.g. ["R=1K", "C=159.155N"] for an RC low-pass. With shunt, the whole chain feeds the output node. source: the source's VALUE in Micro-Cap syntax — "DC=0 AC=1" for an AC probe, or a PULSE ... line for transient. analysis: AC, Transient, or DC. output_node: label for the output node. shunt: extra "KIND=VALUE" strings hung in parallel from the output node to ground, e.g. ["L=1M", "C=1U"] on a series R for a tank.

Returns the .CIR text and the ordered part references.

Inputs: parts (required), shunt, source, analysis, +1 more. Returns: object

generate_transistor_amplifierA

Draw a .CIR common-emitter BJT gain stage (NPN primitive).

Divider bias, unbypassed emitter degeneration, AC-coupled input. The midband gain magnitude is Rc/(Re+re') — roughly Rc/Re when Re is well above the intrinsic re'. By default the R1/R2 divider is computed to bias the collector at mid-supply, so the stage stays in the active region for any Rc/Re and the gain is real (a fixed divider would silently saturate as Rc grows). Rc must exceed Re. Feed the result to simulate_schematic.

Args: rc, re: collector and (unbypassed) emitter resistors; their ratio is the midband gain. Rc must exceed Re. r1, r2: base bias divider (vcc to base, base to ground); leave unset to auto-bias for a mid-supply collector, or give both to override. vcc: supply voltage. cin: input coupling capacitor. source: input source VALUE, Micro-Cap syntax ("AC=1" for AC gain). analysis: AC, Transient, or DC. output_node: label for the collector output node.

Returns the .CIR text.

Inputs: r1, r2, rc, re, +5 more. Returns: object

get_exampleA

Fetch one reference circuit's source text.

.CKT files are plain SPICE and can be fed straight to simulate. .CIR files are Micro-Cap schematics: text, but carrying component coordinates and analysis settings as well as the netlist.

Inputs: name (required). Returns: object

list_domainsA

List the circuit-design domains Micro-Cap ships reference circuits for.

Returns domain name -> circuit count. Start here before designing from scratch: a working reference beats an invented topology.

Inputs: no named parameters. Returns: object

plotA

Run a netlist and return Micro-Cap's own rendered plot as a JPEG image.

Use this to look at a waveform. For numbers to reason about, use simulate — reading values off a picture is guesswork.

Inputs: netlist (required), defines, analysis.

plot_schematicA

Run a .CIR schematic and return Micro-Cap's rendered plot as a JPEG.

The picture companion to simulate_schematic: use it to look at the response of a schematic — a reference circuit you edited, or one drawn by generate_transistor_amplifier / generate_differential_pair / the other generators. For numbers to reason about, use simulate_schematic.

Inputs: cir (required), points, analysis.

search_examplesB

Search the ~470 reference circuits by name or domain.

Inputs: query (required), limit. Returns: result

simulateA

Run a SPICE netlist through Micro-Cap and return the waveform data.

The netlist is plain SPICE. Rules that will bite you if ignored:

  • Node 0 is ground and must exist. Every node needs a DC path to it, or the run fails to converge.

  • A .PRINT line is mandatory — it names the outputs you want. Without it Micro-Cap emits only an operating-point dump and no waveforms.

  • Match the analysis to the question: ac for frequency response and gain/phase, transient for time-domain behaviour and start-up, dc for bias points and transfer curves.

  • Set the time span from the circuit's own constants. A .TRAN running for 10 s on a circuit with microsecond edges returns a flat line.

  • Active parts need their supplies wired; an op-amp without rails does nothing.

Args: netlist: full SPICE deck, first line is the title, ending in .END. analysis: transient | ac | dc | harmonic_distortion | intermodulation_distortion | dynamic_ac | dynamic_dc | stability. defines: values for .DEFINE symbols in the deck, e.g. {"R": "1K"}. max_points: cap on returned samples; the run itself is unaffected.

Returns: Columns, units, sampled data, solver statistics, and any warnings.

Inputs: netlist (required), defines, analysis, max_points. Returns: object

simulate_exampleA

Run one of Micro-Cap's own reference circuits and return its data.

These are worked designs by the tool's authors, so this is the cheapest way to get a trustworthy baseline before modifying anything. Use describe_example first to see which analyses a circuit supports and what it plots — asking for an analysis it was not built for returns nothing useful.

Numeric export is enabled automatically; the shipped circuits have it off.

Args: name: reference circuit name. analysis: which analysis to run. max_points: cap on returned samples. points: resolution to compute at. The reference circuits carry their own display setting, often tiny or 0 — which exports a single useless row and makes an oscillator look dead. Overriding it is what makes the library usable as data; only lower it if you specifically want the circuit's own resolution.

Inputs: name (required), points, analysis, max_points. Returns: object

simulate_schematicA

Run a Micro-Cap .CIR schematic and return its data.

Use this to adapt a reference: fetch one with get_example (its format will be microcap_schematic), change a component value or two in the text, and run the modified schematic here. simulate is for plain SPICE netlists; this is for the coordinate-carrying .CIR format.

Numeric export is switched on automatically, NPts is overridden to points (the shipped setting is often 0, which exports one row), and the symbolic transient bound TMIN is repaired for batch mode — all the things that make a stock schematic yield no data otherwise.

Args: schematic: full .CIR text. analysis: which of the circuit's analyses to run. defines: values for any .DEFINE symbols the schematic uses. points: resolution to compute at; see simulate_example. max_points: cap on returned samples.

Inputs: schematic (required), points, defines, analysis, +1 more. Returns: object

sweepA

Run one netlist repeatedly, varying a .DEFINE parameter.

The deck must declare the symbol, e.g. .DEFINE RLOAD 1K, and use it in a component value. Each value is a separate Micro-Cap run.

Args: netlist: SPICE deck containing a .DEFINE for parameter. parameter: the symbol to vary. values: values to substitute, e.g. ["1K", "10K", "100K"]. analysis: analysis to run for every value. max_points: cap on returned samples per run.

Inputs: values (required), netlist (required), parameter (required), analysis, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 20 tools

    Disambiguation3/5

    Several tools have overlapping names and purposes: simulate, simulate_schematic, and simulate_example are all 'run a simulation' tools with different input formats, and plot and plot_schematic similarly differ only by input type. The descriptions clearly distinguish them, but an agent relying on names alone could easily misselect.

    Naming Consistency4/5

    The naming pattern is predominantly verb_noun with underscores (generate_amplifier, simulate_schematic, describe_example), which is consistent. A few single-word verbs (simulate, sweep, plot) deviate slightly but remain predictable and readable.

    Tool Count4/5

    At 20 tools, the server is slightly over the ideal 3-15 range but each tool serves a distinct purpose in the circuit simulation workflow. The count is justifiable given the breadth of generation, simulation, visualization, and example-library access, though a few generators could potentially be consolidated.

    Completeness4/5

    The tool surface covers the core lifecycle: generate circuits, simulate via netlist or schematic, plot results, and access reference examples. Minor gaps exist, such as no explicit schematic editing tool (text editing is expected instead) and no Monte Carlo or corner analysis, but the main workflows are well supported.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      AI-powered circuit design through simulation — an MCP server that gives language models direct access to SPICE circuit simulation via ngspice, enabling natural language circuit description and automated netlist generation, simulation, measurement, and spec verification.
      28
      107 PyPI
      47
      GPL 3.0
    • F
      license
      C
      quality
      C
      maintenance
      MCP server for automating LTspice on macOS, enabling simulation, schematic generation, data extraction, verification, and rendering via natural language or agents.
      71
      22
      -
    • A
      license
      A
      quality
      B
      maintenance
      An 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.
      48
      868 PyPI
      81
      GPL 3.0