Content
<div align="center">
# microcap-mcp
**AI agent constructs, calculates and draws analog circuits in Micro-Cap 12.**
[](https://github.com/monoxide-xen/microcap-mcp/actions/workflows/tests.yml)
[](LICENSE)
[](https://www.python.org/)
[](#installation)
[](https://modelcontextprotocol.io/)
**English** · [Русский](README.md)
<img src="docs/assets/hero-ce.svg" width="410" alt="Generated common emitter cascade drawn 1:1 with Micro-Cap, with an overlay of the operating point"> <img src="docs/assets/plot-ac.jpg" width="410" alt="Frequency response calculated by Micro-Cap">
<sub>Circuit drawn by the server itself (1:1 with Micro-Cap, with operating point) · plot calculated by Micro-Cap</sub>
</div>
---
Works through the standard batch mode of Micro-Cap (`MC12 @batch.bat`) — headless, without GUI automation and without modification of the program.
## What it does
🔧 **Builds circuits from scratch** — 8 generators of cascades (common emitter, repeater, MOSFET, differential pair, current mirror, cascode, op-amp, RLC) with auto-biasing. Each verified with theory: gain, operating point, resonance.
📊 **Calculates** — transient / AC / DC / distortions / stability, operating point, sweeps. Complex output as `{re, im}`, solver diagnostics.
🎨 **Draws** — renders `.CIR` to SVG **1:1 with Micro-Cap**: native symbols from MC library, grid, all rotations and reflections, label layout. Overlays operating point voltages. `/IC` in MC batch mode can't do this — but the server can.
<div align="center">
<img src="docs/assets/diffpair.svg" height="200" alt="Differential pair"> <img src="docs/assets/cascode.svg" height="200" alt="Cascode"> <img src="docs/assets/opamp.svg" height="200" alt="Op-amp">
</div>
## Installation
Requires Windows, Python 3.11+ and installed [Micro-Cap 12](https://spectrum-soft.com/) (freeware). No cloning needed — specify in MCP client, and `uvx` will download the package itself:
```jsonc
{
"mcpServers": {
"microcap": {
"command": "uvx",
"args": ["microcap-mcp"],
"env": { "MICROCAP_HOME": "E:/Tools/MC12" } // only if auto-search didn't find it
}
}
}
```
The driver searches for Micro-Cap in typical locations; specify `MICROCAP_HOME` to the folder with `mc12_64.exe` if it's located non-standardly.
<details>
<summary>From sources</summary>
```bash
git clone https://github.com/monoxide-xen/microcap-mcp
cd microcap-mcp
uv sync
```
```jsonc
{
"mcpServers": {
"microcap": {
"command": "uv",
"args": ["--directory", "C:/path/to/microcap-mcp", "run", "microcap-mcp"]
}
}
}
```
</details>
## Tools
| Tool | What it does |
|---|---|
| `simulate` · `sweep` · `plot` | calculate SPICE netlist, sweep by `.DEFINE`, plot in JPEG |
| `generate_transistor_amplifier` · `_emitter_follower` · `_mosfet_amplifier` | transistor / MOSFET cascades, auto-biasing to mid-power supply |
| `generate_differential_pair` · `_current_mirror` · `_cascode` · `_amplifier` | differential pair, mirror, cascode, op-amp |
| `generate_schematic` | source + R/C/L in series and parallel (RC/RL/RLC, dividers, contours) |
| `simulate_schematic` · `plot_schematic` | calculate / plot arbitrary `.CIR` |
| `draw_schematic` · `annotate_schematic` | draw `.CIR` to SVG (1:1 with MC) · with operating point on the scheme |
| `simulate_example` · `search_examples` · `get_example` · `describe_example` · `list_domains` | ~490 reference schemes from MC delivery: search, source, analyses |
Plus **resources** `microcap://guide` and `microcap://domains` and **prompt** `analyse_circuit` — so the agent doesn't let MC silently lie.
## Tests
```bash
uv run pytest # 138 units without Micro-Cap; +30 integrations against physics (MC required)
```
Without Micro-Cap, integrations are skipped — CI remains green.
## How it works
- [Micro-Cap specifics](docs/micro-cap-notes.md) — behavior not described in the manual (and sometimes contradicting it).
- `eval/harness.py` — running all ~490 delivery schemes with layout of failures by reasons (currently 88% pass).
## License
[MIT](LICENSE) for the repository code. Micro-Cap 12 belongs to Spectrum Software — not included, not reuploaded, not modified: its documented CLI is used.