Skip to main content
Glama
cameroncoats

multicomp-mcp

by cameroncoats
README.md
# multicomp-mcp

MCP server for the **Multicomp Pro MP711134** bench power supply with built-in
multimeter (a rebadged OWON SPM-series source measuring unit), connected over
USB serial. It lets an LLM agent control the PSU during live debugging
sessions — e.g. power-cycling a board, watching its current profile during
boot, or waiting for a rail to come up — without having to poll.

## Tools

| Tool | Purpose |
|------|---------|
| `get_status` | One-call snapshot: output state, mode (STANDBY/CV/CC/FAULT), setpoints, measured V/I/P, OVP/OCP settings + trip flags, DMM function + reading |
| `set_output` | Set voltage / current limit / OVP / OCP / output enable; safe ordering, readback-verified, refuses voltage above OVP |
| `power_cycle` | Off → wait → on → wait for rail to settle; reports residual voltage and time-to-rail |
| `wait_for` | Block until voltage/current/power/DMM reading enters a range, or mode reaches CV/CC/etc., with `stable_for` debounce; timeout is reported, not raised |
| `run_profile` | Host-driven waveform engine (the instrument has no sequencer): play step/ramp segments with optional per-segment current limits and repeats at up to ~20 Hz, sampling V/I/mode throughout; returns commanded-vs-measured series and per-segment stats. For brownout/dip tests, battery discharge emulation, tolerance sweeps |
| `capture` | Record V/I/P for up to 120 s; returns stats, mode transitions, and a downsampled time series (current-profile-during-boot style debugging) |
| `dmm_measure` | Read the built-in multimeter, optionally switching function (V/A/Ω/F/diode/continuity); normalized SI values, `OL` handled |
| `scpi_raw` | Escape hatch for any other SCPI command (e.g. `SYST:LOC` to hand the front panel back) |

## Setup

Requires [uv](https://docs.astral.sh/uv/). From this directory the server is
already wired up via `.mcp.json` for Claude Code. To register it globally:

```sh
claude mcp add multicomp --scope user -- \
  uv run --project /path/to/multicomp-mcp multicomp-mcp
```

Configuration via environment variables:

- `MULTICOMP_PORT` — serial device path, overrides auto-discovery
- `MULTICOMP_BAUD` — baud rate (default 115200)

Without `MULTICOMP_PORT` the server discovers the instrument by enumerating
USB serial ports, trying CH340 adapters (`1a86:7523` — the bridge chip the
MP711134 uses, which exposes no product string or serial number) first, and
confirming with an `*IDN?` probe. Other serial devices on the bus are left
alone unless the PSU isn't found, in which case they receive one harmless
`*IDN?` query.

## Protocol notes (verified on live hardware, firmware FV:V2.0.0)

The official command reference is the [OWON SPM Series programming
manual](https://files.owon.com.cn/software/Application/SPM_Series_programming_manual.pdf).
Findings from probing the real device:

- 115200 baud 8N1, `\n`-terminated. Queries answer in ~10–20 ms.
- Set commands are **silent on success** and reply `ERR` on rejection
  (out-of-range value, unknown command). No `SYST:ERR?` queue to speak of
  (it always reads `0x0000`).
- `*IDN?` → `multicomp pro,MP711134,25280364,FV:V2.0.0`
- PSU: `VOLT`, `CURR`, `OUTP {ON|OFF}`, `VOLT:LIM` (OVP), `CURR:LIM` (OCP),
  `MEAS:VOLT?`, `MEAS:CURR?`, `MEAS:POW?`
- `MEAS:ALL:INFO?` → `V,I,P,OVP,OCP,OTP,mode` (mode: 0 standby, 1 CV, 2 CC,
  3 failure) — the workhorse status/poll query.
- `MEAS:ALL?` returns only `V,I` on this firmware (manual claims `V I P`).
- DMM readings come from `CONF:ALL?` →
  `FUNC,value+unit,Auto|Manual,range` (e.g. `VOLT:DC,+0.0007V,AUTO,2V`,
  `RES,OL,AUTO,200k Ohm`). `MEAS:*` always refers to the PSU output
  terminals, not the DMM.
- DMM function switch: `FUNC:VOLT:DC`, `FUNC:VOLT:AC`, `FUNC:CURR:DC`,
  `FUNC:CURR:AC`, `FUNC:RES`, `FUNC:CAP`, `FUNC:DIOD`, `FUNC:CONT` — takes
  ~0.8 s to apply. Ranging: `VOLT:DC:RANG {200E-3|2|20|200|1000}`,
  `...:RANG:AUTO {ON|OFF}`, `...:RANG:NULL` (relative mode); similar for
  CURR/RES.
- Compound commands (`;`-separated) are **not** supported — first command only.
- After `OUTP ON` the output ramps to the setpoint over ~1–2 s (no-load).
  Dropping the setpoint with no load is also slow (output caps discharge).
- The device occasionally drops a query sent immediately after a state
  change — the client retries empty reads.
- **No sequencer/list mode over SCPI**: every `LIST`/`PROG`/`SEQ`/`TIMER`
  style command returns `ERR` (the "waveform" feature in the marketing blurb
  is the on-screen V/I curve display). `run_profile` therefore drives the
  setpoint from the host.
- **Do not flood the port**: back-to-back writes with no gap wedge the
  instrument for several seconds (it stops answering). With ≥5 ms between
  transactions, sustained set+measure cycles at ~20-40 Hz are 100% reliable.
- Output slew (no load): ~5.5 V/s rising; falling is load-dependent —
  unloaded it droops at ~2 V/s, so downward steps need a real load to be
  meaningful.
- Quirks: `SIM:KEY:*` emulates front-panel keys; `*RST` is a factory reset
  (avoid); `SYST:LOC` returns control to the front panel.