Skip to main content
Glama
PPK2 MCP Server

PPK2 MCP Server

by zhixuan2333

PPK2 MCP server

A Model Context Protocol (stdio) server that lets an MCP client — Claude Code, Claude Desktop, Cursor — drive a Nordic Power Profiler Kit II (PPK2) over its USB serial port: set mode/voltage, power a device-under-test (DUT), measure current/power/energy, and capture the 8 digital channels as a logic analyser.

The server holds the serial port open for its whole lifetime and serialises every tool call behind one lock, so it is the single owner of the PPK2 — the client talks to the device only through these tools.

Requirements

  • A PPK2 connected over USB

  • uv (the installer below will fetch it if missing)

  • Python ≥ 3.10 (uv will fetch one if needed)

  • Claude Code CLI (optional, for auto-registration)

Related MCP server: blea

One-shot install

git clone https://github.com/zhixuan2333/PPK2-MCP && cd PPK2-MCP
./install.sh          # installs uv, syncs deps, registers the MCP server
./install.sh --run    # ...and immediately launches Claude with a test prompt

install.sh registers the ppk2 server with the Claude Code CLI (claude mcp add, user scope). The serial port is autodetected — no path to configure. Then in Claude:

Use the ppk2 MCP tools to check the PPK2: call ppk2_status, then configure source mode at 3.3V, power the DUT on, measure current for 2 seconds, capture the logic channels for 1 second, and finally power off and disconnect.

Manual setup

uv sync     # create .venv and install dependencies from uv.lock

Run the server standalone (speaks MCP over stdio, so this is mostly a smoke test — Ctrl-C to exit). The PPK2 port is autodetected; override with PPK2_PORT if needed:

uv run ppk2_mcp_server.py
# or pin a port:  PPK2_PORT=/dev/cu.usbmodemXXXX uv run ppk2_mcp_server.py

.mcp.json in this repo also registers the server for any Claude Code session opened in this directory (autodetected port, no edits needed). Approve the project server (or run /mcp) and confirm it shows connected.

Tools

Tool

What it does

ppk2_status

Connection state, mode, voltage, DUT power, available ports. Never opens the port.

ppk2_configure

Open the port, read calibration, set meter mode (ampere/source) + voltage.

ppk2_power

Turn DUT power output ON/OFF.

ppk2_measure

Sample current for N seconds → summary stats (current/power/charge/energy).

ppk2_logic

Capture the 8 digital channels (D0–D7) → per-channel duty, edges, activity.

ppk2_disconnect

Release the serial port.

Modes

  • ampere — the PPK2 measures current drawn from an external supply (it does not power the DUT). voltage_mv is still used for the gain/offset calibration, so set it to your external rail voltage.

  • source — the PPK2 sources voltage_mv to the DUT and measures the current it draws. Use ppk2_power("ON") to enable the output rail.

Serial port resolution

First match wins: a tool's explicit port arg → PPK2_PORT env var → autodetection via ppk2_api.list_devices().

Notes

  • A serial line has a single owner — only one process can hold the PPK2 at a time. Stop other PPK2 tools (e.g. nRF Connect Power Profiler) before using this.

  • Unconnected digital pins float and read a constant/noisy level; drive them from your DUT to see real logic activity.

Available Tools

6 tools
ppk2_configureA

Open the PPK2 and configure it for measurement.

Opens the serial port (if not already open), reads the device calibration, selects the meter mode, and sets the voltage. Call this before ppk2_measure.

Args: mode: "ampere" — the PPK2 measures current drawn from an external supply (it does not power the DUT). voltage_mv is still required and is used for the gain/offset calibration, so set it to your external rail voltage. "source" — the PPK2 sources voltage_mv to the DUT and measures the current it draws. Use ppk2_power("ON") to enable the output. voltage_mv: Source/reference voltage in millivolts (800–5000). port: Serial port override; defaults to PPK2_PORT or autodetection.

Returns the resulting status.

Inputs: mode, voltage_mv, port. Returns: object

ppk2_disconnectA

Release the serial port (stops sampling and drops DUT power first).

Use this to hand the port to another process, or to recover from a wedged connection — the next tool call will reopen it.

Inputs: no named parameters. Returns: object

ppk2_logicA

Capture the PPK2's 8 digital logic channels (D0–D7) — a logic analyser.

The PPK2 samples 8 digital inputs alongside current at ~100k samples/s. This starts sampling, discards a settling window, collects digital states for duration_seconds, and returns per-channel statistics: the fraction of time each channel was high, the number of edges (level transitions), and the first/last observed level. Requires a prior ppk2_configure.

Note: unconnected digital pins float and may read a constant or noisy level; drive them from your DUT to see real activity.

Args: duration_seconds: Capture window after settling. 0.05–60. settle_ms: Initial samples discarded before timing starts. Default 100 ms. channels: Which channels (0–7) to report. Default all eight. include_series: If true, also return a downsampled level series per channel (each point is the fraction high over that block, 0.0–1.0). series_points: Target number of points in each downsampled series.

Returns sample count, achieved sample rate, and a channels map keyed by channel index.

Inputs: duration_seconds, settle_ms, channels, include_series, +1 more. Returns: object

ppk2_measureA

Sample current for a fixed duration and return summary statistics.

Starts continuous sampling, discards an initial settling window, collects samples for duration_seconds, stops, and computes statistics. Requires a prior ppk2_configure. The PPK2 streams ~100k samples/s, so raw samples are never returned by default — only aggregates (and an optional downsampled series).

Args: duration_seconds: How long to collect samples (after settling). 0.05–60. settle_ms: Initial data discarded before timing starts, to skip the switch-on transient. Default 200 ms. include_series: If true, also return a downsampled current series. series_points: Target number of points in the downsampled series.

Returns current statistics in microamps (µA), plus average power (µW), charge (µC) and energy (µJ) when a voltage is configured. samples is the raw sample count; sample_rate_hz is the achieved rate.

Inputs: duration_seconds, settle_ms, include_series, series_points. Returns: object

ppk2_powerA

Turn the DUT power output ON or OFF.

In source mode this enables/disables the voltage the PPK2 sources to the DUT. In ampere mode it connects/disconnects the PPK2's internal switch in the current path. Requires ppk2_configure to have been called first.

Args: state: "ON" or "OFF".

Inputs: state (required). Returns: object

ppk2_statusA

Report PPK2 connection and configuration state.

Returns whether a device is connected, the resolved/candidate serial port, the active meter mode, the configured source/reference voltage, the last commanded DUT power state, and any serial ports that look like a PPK2. Safe to call any time; never opens the port.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool addresses a distinct aspect of PPK2 operation: configuration, disconnection, logic capture, current measurement, power control, and status reporting. There is no overlap in functionality.

    Naming Consistency5/5

    All tools follow a consistent `ppk2_<verb_or_noun>` pattern. The names clearly indicate their action (configure, disconnect, measure, power, status) or feature (logic), making them predictable.

    Tool Count5/5

    Six tools is a well-scoped set for a PPK2 hardware interface. Each tool maps to a required operation for using the device, without unnecessary bloat or missing essentials.

    Completeness4/5

    The tool set covers the full workflow: configure, power control, measurement, logic analysis, and cleanup. A very minor gap is the absence of a separate tool to read calibration data, but configure handles it implicitly.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for Nordic Semiconductor's Power Profiler Kit II (PPK2), enabling current measurement and device control via 12 tools from Claude.
      1
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to list, inspect, probe, capture, and analyze current measurements from the Nordic Power Profiler Kit II, returning aggregates and file paths rather than raw samples.
      -
    • F
      license
      A
      quality
      C
      maintenance
      Enables LLMs to control a Nordic Power Profiler Kit II over USB serial for current capture (500 nA–2000 mA at 100 kSa/s plus 8 logic channels) and DUT power sourcing (0.8–5 V), with samples written to npz files. Also supports offline analysis such as statistics, activity/duty-cycle segmentation, and battery-life estimation.
      19
      -