Skip to main content
Glama
uSimmics MCP Bridge

uSimmics MCP Bridge

by timecino-hub

uSimmics MCP Bridge

tests-and-package Python 3.11+ License: MIT

Let an AI assistant build, simulate and inspect uSimmics 5.9 circuits for you. The bridge is a local MCP server: your assistant edits saved .sch files, runs the native harmonic-balance solver in the background and gets back a picture of the circuit and its spectrum, without clicking through the desktop UI.

Alpha 0.3.0a2. Native simulation targets Windows with separately installed uSimmics 5.9. Portable CI checks package installation, files, previews and MCP; it does not establish that the native solver passes. This is an independent project, not an official uSimmics/QucsStudio product. Original Qucs and Qucs-S use different file formats.

中文说明 · Tools and examples · Contributing · Security

Preview of the bundled BAT54 mixer: the schematic above, its harmonic-balance spectrum below with labelled mixing products

What you can ask for

  • "Create a project, build a 1 MHz voltage divider, simulate it and show me the spectrum."

  • "Run the BAT54 mixer example and tell me the IF power at 1 MHz."

  • "Sweep R1 over 50, 100 and 200 Ohm and compare the IF level at 1 MHz."

  • "Clone the mixer, move the LO to 12 MHz and compare the IF power of both versions."

The assistant answers these with the bridge's tools, listed below.

Related MCP server: qucs-mcp

Quick start

You need Python 3.11+ and uv. Native simulation also requires a separately installed uSimmics 5.9 on Windows. The bridge does not bundle or download the simulator, its model libraries or course material. Template discovery works before configuration; the divider can be built and previewed with a portable workspace configuration.

  1. Install the commands:

    uv tool install git+https://github.com/timecino-hub/usimmics-mcp-bridge.git
  2. Tell the bridge where uSimmics and your projects live, then check the setup:

    usimmics-bridge configure --installation-root "C:/Apps/uSimmics" --project-root "C:/CircuitProjects"
    usimmics-bridge doctor

    doctor prints separate workspace_ready, solver_ready and bat54_ready fields. Its overall ready requires a usable workspace and solver. The BAT54 model is an optional capability: its absence does not block the divider or other RLC circuits.

  3. Add the server to your MCP client (next section) and reload the client's tools.

To pin a version, install the wheel from a GitHub release with uv tool install <wheel-path>.

First example from an installed package

Both examples ship inside the wheel. You can discover them from any working directory, without a source checkout or a configured simulator:

usimmics-bridge examples list
usimmics-bridge examples show voltage_divider

After configuring a workspace, these PowerShell commands create a project, export a complete build request and draw the divider. No native solver is executed:

@{ name = "first_example" } | ConvertTo-Json | Set-Content -Encoding utf8 create.json
$project = usimmics-bridge call create_project --arguments-file create.json | ConvertFrom-Json
$schematic = Join-Path $project.project_path "divider.sch"
usimmics-bridge examples export voltage_divider --output build.json --schematic-path $schematic
usimmics-bridge call build_schematic --arguments-file build.json
@{ path = $schematic } | ConvertTo-Json | Set-Content -Encoding utf8 preview.json
usimmics-bridge call preview_schematic --arguments-file preview.json

The last command returns an image_path for the PNG. Choose a new project name and export filename when repeating the example: existing projects and export files are preserved. With a ready native solver, usimmics-bridge run $schematic then returns an isolated dataset; pass its dataset path to preview_schematic to add the spectrum. Building the mixer template also requires the installed BAT54 model.

An MCP client can use list_schematic_templates and get_schematic_template for the same examples. The latter returns a specification object; add the intended .sch path and pass it to build_schematic.

Connect an MCP client

The server command is usimmics-mcp. It talks MCP over stdio, opens no network port and needs no API key or cloud service. GUI clients may not see your shell's PATH, so register the absolute path that (Get-Command usimmics-mcp).Source prints.

Claude Code (--scope user makes it available in every project):

claude mcp add --transport stdio --scope user usimmics -- (Get-Command usimmics-mcp).Source

Codex:

codex mcp add usimmics -- (Get-Command usimmics-mcp).Source

Claude Desktop and other clients configured with JSON:

{
  "mcpServers": {
    "usimmics": { "command": "C:\\Users\\you\\.local\\bin\\usimmics-mcp.exe" }
  }
}

The server takes no arguments. To use a config file other than the default, set USIMMICS_BRIDGE_CONFIG in the server's environment.

Before your client reloads, you can exercise the real MCP transport from a terminal. It prints JSON and the paths of rendered images instead of dumping base64:

usimmics-mcp-call list
usimmics-mcp-call environment_status
usimmics-mcp-call preview_schematic --arguments-file request.json

Tools

Task

Tools

Environment and projects

environment_status, list_projects, create_project

Installed examples

list_schematic_templates, get_schematic_template

Read, save and copy

read_schematic, save_schematic, clone_schematic

Build and edit

build_schematic, inspect_schematic, update_parameters

Check and look

validate_schematic, preview_schematic

Simulate and keep results

run_schematic, read_results, publish_results

Explore variants

parameter_sweep, compare_results

Long-running jobs

start_job, job_status, cancel_job

The usual flow is get a template → create a project → build and save → validate → preview → run, then optionally publish the verified dataset so the uSimmics GUI can plot it. Installed templates have one source under usimmics_bridge/data/examples; docs/tools.md walks through the full workflow.

What the preview shows

preview_schematic returns a PNG that the bridge draws from the saved file, plus JSON metadata. It is not a screenshot of the uSimmics window.

  • Schematic. Components and wires sit at their saved coordinates. Junction dots mark real T-junctions; bare crossings stay unconnected. Net labels appear as tags with a leader to their node. A label that would collide is moved to the nearest free spot and named in adjusted_labels. Paintings annotations are omitted with a warning.

  • Spectrum. One panel per node voltage on a shared frequency axis, in dBm into 50 Ω (AC peak, DC RMS) with a −140 dBm display floor. The strongest lines are labelled with their mixing product (f1−f2, 2f2−f1, …), frequency and level. spectrum_markers returns those markers numerically, with dBm rounded to two decimals; the image labels use one decimal. Raw data is never changed.

  • Provenance. A dataset that does not match the saved schematic is flagged in the image and in warnings.

Supported scope

  • File format: QucsStudio Schematic 5.9 only.

  • Components: R, C, L, Vac, Vdc, Diode, Filter, GND and one harmonic-balance (HB) block. BAT54 is loaded from your installation on request. Vdc works as a component inside HB; DC operating-point analysis is not provided.

  • Results: the tested real/complex QucsData v2 subset. Unknown record types fail.

  • Not yet supported: transient, AC and S-parameter analyses, nested sweeps, arbitrary device models, mirrored components, native diagram markers and other diagram types. Unsupported input fails explicitly instead of being guessed.

Safety and data integrity

  • Validated saves. Saves check sections, property records, Rect/Legend/trace diagrams and connectivity before writing. Builder routes are explicit and orthogonal, and crossings or touches between different nets are rejected.

  • No silent overwrites. Writing to an existing file needs its inspected SHA256, keeps a backup and replaces the file atomically. Cooperative cross-process locks serialize bridge writers. The uSimmics GUI does not take part in those locks and its unsaved buffers are invisible to the bridge, so reload a document in the GUI before saving over bridge edits.

  • Isolated runs. Every run and sweep gets its own output folder. Publishing requires matching source/result provenance and DataSet=*.dat. Sweeps leave the source unchanged, allow at most 20 points and limit each solver call to 30 seconds. Comparisons use actual samples, never interpolation.

  • Recoverable work. Sweep summaries are checkpointed after each point, including failures and cancellation, and can be resumed with resume_from. A persistent MCP client can start a background job, inspect progress and cancel the active solver. One-shot usimmics-mcp-call processes cannot retain background jobs; use ordinary run/sweep calls there.

  • Result provenance. Successful runs record a run ID, source snapshot, duration and dataset validation in a manifest. Published datasets retain a neighboring .dat.manifest.json so their origin can still be checked after copying them into the project. See results and provenance for validation and warning states.

  • Local only. Configured roots guard against accidental file access but are not an operating-system sandbox. The bridge runs simulator.exe from the installation you configure. See SECURITY.md.

Configuration

The config file is %LOCALAPPDATA%/usimmics-bridge/config.json on Windows and $XDG_CONFIG_HOME/usimmics-bridge/config.json (or ~/.config/...) elsewhere. Point to another file with USIMMICS_BRIDGE_CONFIG or the CLI's --config. configure can discover common install locations or USIMMICS_HOME. Overwriting an existing config needs --force and keeps a backup.

Development

uv sync --extra dev --locked
uv run --locked pytest -m "not integration" --basetemp .testtmp-unit -q
uv build
uv export --locked --no-dev --no-emit-project --no-hashes --output-file .ci-runtime-requirements.txt
python scripts/smoke_wheel.py --wheel dist --requirements .ci-runtime-requirements.txt

CI tests the locked dependencies on Windows/Linux with Python 3.11/3.12 and separately resolves the latest dependency versions permitted by the package. Each job builds distributions, installs the wheel in a fresh virtual environment, and runs the portable create → build → preview → read/save flow through real MCP stdio outside the checkout. The smoke check confirms the imported code comes from that environment and verifies the returned PNG.

Native tests remain opt-in: uv run --locked pytest -m integration --basetemp .testtmp-native -q -rs. They find uSimmics through local discovery or USIMMICS_HOME and skip when absent. A skipped native test is not evidence of solver compatibility. They generate their own divider, RC/RL, BAT54 and parameter-sweep circuits. See CONTRIBUTING.md for release verification.

License

Bridge code and original examples are MIT-licensed. uSimmics and external models keep their own terms and are not included. The community project qucs-mcp was reviewed during research; this bridge is an independent implementation and does not vendor that repository.

Available Tools

21 tools
build_schematicA
Destructive

Build and save a circuit from component/pin descriptions without writing .sch syntax.

Components: {type,name,position:[x,y],orientation:0..3,params:{parameter:value}}. Diode additionally requires model='BAT54' (loaded locally) or explicit properties. Connections: {from:{component,pin},to:{component,pin},via:[[x,y]],label:optional}. Pins are zero-based; default R/filter/diode pin0 left, Vac pin0 top, GND pin0 center. All routes must be orthogonal. Different-net crossings/touches are rejected. Harmonics: {order:3,count:4}. Source frequencies are inserted automatically.

Inputs: path (required), components (required), connections (required), harmonics, +1 more. Returns: path, saved, backup, sha256, +2 more

cancel_jobA
Idempotent

Request cancellation, then poll until cancelled; finished jobs are unchanged.

The worker terminates the native process tree, saves partial sweep results and releases its solver slot before reporting cancelled. Repeated cancellation is safe.

Inputs: job_id (required).

clone_schematicB
Destructive

Save a copy of a schematic as an independent variant. Existing destination needs its hash.

Inputs: source (required), destination (required), expected_sha256. Returns: path, saved, backup, sha256, +2 more

compare_resultsA
Read-onlyIdempotent

Compare a complex voltage at one actual frequency across 1..20 datasets (no interpolation).

Includes magnitude and impedance-qualified dBm; AC samples are peak voltages, DC uses RMS.

Inputs: variable (required), frequency_hz (required), dataset_paths (required), impedance. Returns: object

create_projectB

Create a new _prj directory in a configured project root. Fails if it already exists.

Inputs: name (required), root. Returns: project_path

environment_statusA
Read-onlyIdempotent

Check local installation, simulator, BAT54 library, configured project roots and capabilities.

Inputs: no named parameters. Returns: object

get_schematic_templateC
Read-onlyIdempotent

Return a fresh builder specification and requirements for an installed template.

Inputs: name (required).

inspect_schematicB
Read-onlyIdempotent

Inspect a .sch file, component parameters and SHA256 before a background edit or run.

Inputs: path (required). Returns: object

job_statusB
Read-onlyIdempotent

Read a session-local job's status, latest progress, result or error.

Inputs: job_id (required).

list_projectsA
Read-onlyIdempotent

List existing uSimmics projects in the configured local roots, without creating projects.

Inputs: no named parameters. Returns: object

list_schematic_templatesA
Read-onlyIdempotent

Describe templates available in the installed package, without configuration or disk writes.

Inputs: no named parameters.

parameter_sweepB

Simulate 1..20 independent parameter variants, preserve source, return JSON/CSV comparison.

Each run is limited to 1..30 seconds. Comparison frequency must exist as an actual sample. Results include per-point status and a durable partial summary. fail_fast stops after a failed point; resume_from retries unfinished points after checking source and data hashes. Cancellation terminates the current solver and preserves the checkpoint.

Inputs: path (required), values (required), component (required), parameter (required), +5 more. Returns: object

preview_schematicA

Return a PNG image of the saved circuit layout and optionally its discrete HB spectrum.

Renders original component positions, labels, wires and supported symbols using the bridge renderer. The PNG is returned as native MCP image content and saved locally. It is NOT a screenshot of the native GUI and omits Paintings annotations with a warning. Colliding labels are nudged clear and named in adjusted_labels. The optional spectrum draws one panel per node voltage (peak-voltage dBm/50 Ohm, labelled display floor) and labels the strongest lines with mixing product, frequency and level; spectrum_markers returns dBm rounded to two decimals. Data whose provenance does not match the schematic is flagged in the image.

Inputs: path (required), dataset_path.

publish_resultsA
Destructive

Save this bridge's verified run dataset to the schematic's normal .dat path for GUI plots.

Requires matching run provenance and current schematic hash. Backs up existing .dat. Refuses stale results and custom DataSet paths. Reload in the GUI to view changes there.

Inputs: path (required), dataset_path (required), expected_sha256 (required). Returns: object

read_resultsB
Read-onlyIdempotent

Read verified QucsData v2 real/complex simulation results, with a bounded number of points.

Inputs: path (required), max_points. Returns: object

read_schematicA
Read-onlyIdempotent

Read complete saved .sch source plus SHA256, including malformed files for diagnosis.

Inputs: path (required). Returns: path, state, sha256, content

run_schematicB

Compile a supported 5.9 schematic and run simulator.exe headlessly in an isolated run folder.

Supports the documented R/C/L, Vac/Vdc, BAT54/Diode, Filter, GND and HB subset. Unknown components or ambiguous wiring fail explicitly. Returns unique output paths and solver status; does not overwrite the GUI's datasets or open a window.

Inputs: path (required), timeout. Returns: object

save_schematicA
Destructive

Save a complete supported 5.9 schematic atomically, including components, wires and plots.

Supply full source from read_schematic with requested edits. Existing files require their current SHA256 and are backed up; omit the hash for new files. Syntax and connectivity validate before any write. Saves UTF-8/LF, never an unsaved GUI buffer.

Inputs: path (required), content (required), expected_sha256. Returns: path, saved, backup, sha256, +2 more

start_jobA

Start a background run or sweep; poll job_status and use cancel_job to stop it.

Requires a persistent MCP session. Job IDs are session-local (latest 64 retained), with at most four active jobs and one native solver at a time. Completed artifacts and sweep summaries survive server restarts. Closing the server cancels active jobs.

Inputs: request (required).

update_parametersA
Destructive

Atomically edit component parameters with backup and conflict detection.

Each edit: {"component": "V1RF", "parameter": "frequency", "value": "12 MHz"}. Use parameter names/indices returned by inspect_schematic. Frequency changes also update matching harmonic-balance frequency keys. All edits validate before writing. Reload the file in uSimmics to see these disk changes.

Inputs: path (required), edits (required), expected_sha256 (required). Returns: object

validate_schematicA
Read-onlyIdempotent

Check saved-file sections, plot closure, supported component connections and HB settings.

Returns valid/errors/warnings and a compiled netlist. This is supported-format validation, not a claim that every native GUI feature can be rendered or checked.

Inputs: path (required). Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 21 tools

    Disambiguation4/5

    Most tools target clearly distinct operations: project setup, schematic CRUD, validation, simulation jobs, and result handling. A few boundaries require careful reading, especially run_schematic vs. start_job vs. parameter_sweep, and inspect_schematic vs. validate_schematic vs. read_schematic, but descriptions clarify them.

    Naming Consistency4/5

    The set uses a mostly consistent snake_case convention, usually verb_noun (list_projects, read_schematic, save_schematic, cancel_job). Minor deviations are noun-first names like environment_status, job_status, and parameter_sweep, but the pattern remains readable.

    Tool Count3/5

    At 21 tools, the surface is on the heavy side for a single MCP server, though the domain includes schematic editing, validation, rendering, simulation, job control, and templates. The count is defensible but borderline; some grouping could reduce cognitive load.

    Completeness4/5

    Coverage is strong: projects, templates, schematic build/read/save/clone/inspect/validate/preview/update, background jobs, sweeps, result comparison/publishing/reading, and environment checks are present. Minor gaps include no explicit delete/cleanup operation for projects or schematics and no dedicated artifact-listing tool.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A thin MCP server that wraps spicelib for circuit simulation. Exposes tools for running AC, transient, DC op, and parameter sweep analyses, enabling behavioral model fitting through iterative simulation and measurement comparison.
      4
      29 PyPI
      8
      GPL 3.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP-compatible agents to generate Qucs circuit schematics, run simulations, and parse results programmatically.
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agents to create, read, update, and validate editable analog/RF circuit schematic projects (including a five-transistor OTA template), wiring and moving components by pin name, running topology checks, exporting SVG or SPICE/Spectre netlists and normalized JSON, and opening the browser editor with a project loaded. It also exposes the component library's exact pins and defaults so drawings stay netlist-correct.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables building wire-connected native schematics, visually checking them, editing values, and running native frequency/transient analyses plus symbolic formulas and plots, with results saved as CSV/PNG and openable in the separately installed application.
      29
      MIT