Skip to content

SpiceBook Integration

These tools bridge mcltspice with SpiceBook, a web notebook service for SPICE circuits. You can publish LTspice designs as interactive, runnable notebooks --- shareable via URL --- and test ngspice compatibility without leaving your MCP session.


Publish an LTspice netlist as an interactive SpiceBook notebook. Reads the netlist from a string or file, converts it from LTspice dialect to ngspice (stripping .backanno, Rser=, Windows paths), builds notebook cells with an intro and the netlist, and creates the notebook via SpiceBook’s compose endpoint.

ParameterTypeDefaultDescription
netlist_textstr | NoneNoneNetlist as a string. Mutually exclusive with netlist_path.
netlist_pathstr | NoneNonePath to a .cir, .net, .sp, .spice, or .asc file on disk.
titlestr"Untitled Circuit"Notebook title, shown in the listing and intro cell.
descriptionstr | NoneNoneCircuit description, rendered in the intro markdown cell.
tagslist[str] | NoneNoneTags for categorization and search (e.g. ["filter", "audio"]).
runboolFalseIf True, SpiceBook runs the simulation immediately on publish.

Returns: A dict with notebook_id, url (direct link to the notebook), cell_count, and conversion_warnings (list of strings describing any LTspice-to-ngspice changes).

Example
{
"notebook_id": "rc-lowpass-filter-a3b2c1d4",
"url": "https://spicebook.warehack.ing/notebooks/rc-lowpass-filter-a3b2c1d4",
"cell_count": 2,
"conversion_warnings": [
"Stripped Rser= from: C1 out 0 100n Rser=0.1"
]
}

Run a netlist via SpiceBook’s ngspice engine without creating a notebook. Useful for testing whether a netlist is ngspice-compatible before publishing. The netlist is converted from LTspice dialect first.

ParameterTypeDefaultDescription
netlist_textstr | NoneNoneNetlist as a string. Mutually exclusive with netlist_path.
netlist_pathstr | NoneNonePath to a netlist file on disk.

Returns: The simulation result from SpiceBook’s ngspice engine, plus conversion_warnings if any LTspice constructs were modified.

Example
{
"stdout": "...",
"stderr": "",
"returncode": 0,
"conversion_warnings": []
}

List all notebooks on SpiceBook. No parameters.

Returns: A dict with notebooks (array of notebook summaries) and count.

Example
{
"notebooks": [
{
"id": "rc-lowpass-filter-a3b2c1d4",
"metadata": {
"title": "RC Lowpass Filter",
"tags": ["filter", "analog"],
"modified": "2026-02-15T21:45:24Z"
}
}
],
"count": 1
}

Retrieve a full SpiceBook notebook with all cells and outputs.

ParameterTypeDefaultDescription
notebook_idstr---The notebook ID to retrieve.

Returns: The complete notebook object including metadata (title, tags, engine, timestamps), cells (array of cell objects with type, source, and outputs), and spicebook_version.

Example
{
"spicebook_version": "2026-02-13",
"metadata": {
"title": "RC Lowpass Filter",
"engine": "ngspice",
"tags": ["filter"],
"created": "2026-02-15T21:45:24Z",
"modified": "2026-02-15T21:45:24Z"
},
"cells": [
{
"id": "cell-abc123",
"type": "markdown",
"source": "# RC Lowpass Filter\n\nFirst-order filter with fc = 1.59 kHz",
"outputs": []
},
{
"id": "cell-def456",
"type": "spice",
"source": "V1 in 0 AC 1\nR1 in out 1k\nC1 out 0 100n\n.ac dec 100 1 1meg\n.end",
"outputs": []
}
]
}

Delete a SpiceBook notebook.

ParameterTypeDefaultDescription
notebook_idstr---The notebook ID to delete.

Returns: {"deleted": true, "notebook_id": "..."} on success.


SpiceBook tools read two environment variables:

VariableDefaultDescription
SPICEBOOK_URLhttps://spicebook.warehack.ingBase URL of the SpiceBook instance.
SPICEBOOK_TIMEOUT30HTTP request timeout in seconds.

No authentication is required.

All SpiceBook tools return structured error dicts on failure:

  • Unreachable: {"error": "SpiceBook not reachable at <url>", "hint": "Check connectivity or set SPICEBOOK_URL env var"}
  • Timeout: {"error": "SpiceBook request timed out"}
  • HTTP error: {"error": "HTTP <status>", "detail": "<response body>"}