Skip to main content
Glama
MHS-5200A MCP Server

MHS-5200A MCP Server

by NaoNaoMe

MHS-5200A MCP Server

License: MIT

A Model Context Protocol (MCP) server for controlling MHS-5200A series signal generators (and compatible models such as MHS-5200P / MHS-5225A) via a serial connection.

Features

  • Full Channel Control: Set frequency, amplitude, duty cycle, DC offset, phase, and waveform for both channels independently.

  • Waveform Selection: Support for Sine, Square, Triangle, Sawtooth, and Arbitrary waveforms.

  • Frequency Sweep: Configure and run linear or logarithmic frequency sweeps.

  • Arbitrary Waveforms: Upload custom waveform data (2 048 points) to any of the 16 memory slots.

  • Advanced Features: Control channel tracking, output inversion, and the internal power amplifier (if equipped).

Related MCP server: dwf-mcp-server

Requirements

  • Python >= 3.13

  • mcp[cli] 2.x (v0.2.0 and later; use mhs5200a-mcp 0.1.x if you are pinned to mcp 1.x)

Installation

Using uv (recommended):

uv pip install mhs5200a-mcp

Or via pip:

pip install mhs5200a-mcp

Or from source:

git clone https://github.com/NaoNaoMe/mhs5200a-mcp.git
cd mhs5200a-mcp
uv sync

Configuration

Claude Desktop Config

Add the server to your claude_desktop_config.json:

{
  "mcpServers": {
    "mhs5200a-mcp": {
      "command": "uvx",
      "args": [
        "mhs5200a-mcp"
      ]
    }
  }
}

Tools Overview

Connection

  • mhs5200_connect: Connect to the device via serial port (e.g., COM3, /dev/ttyUSB0).

  • mhs5200_disconnect: Disconnect from the device.

  • mhs5200_get_status: Get current settings for all channels.

Channel Control

  • mhs5200_set_frequency: Set frequency in Hz (0.01 Hz – 25 MHz).

  • mhs5200_set_amplitude: Set amplitude in volts peak-to-peak (0–15 V).

  • mhs5200_set_waveform: Select waveform (SINE, SQUARE, TRIANGLE, SAWTOOTH_UP, SAWTOOTH_DOWN, ARB00–ARB15).

  • mhs5200_set_duty_cycle: Set duty cycle percentage (0–99.9 %).

  • mhs5200_set_offset: Set DC offset percentage.

  • mhs5200_set_phase: Set phase offset between channels.

  • mhs5200_set_invert: Invert waveform output.

Global Settings

  • mhs5200_set_output: Enable or disable all outputs.

  • mhs5200_set_tracking: Enable channel tracking (CH2 follows CH1).

  • mhs5200_set_power_amp: Enable the internal power amplifier (if supported).

Sweeps & Arbitrary Waveforms

  • mhs5200_configure_sweep: Configure frequency sweep parameters (start/stop frequency, time, mode).

  • mhs5200_set_sweep: Start or stop the configured sweep.

  • mhs5200_upload_arb_waveform: Upload custom waveform data from a file.

Example Workflow

  1. Connect: Call mhs5200_connect with the serial port name (e.g., COM3).

  2. Check Status: Call mhs5200_get_status to read the current device settings.

  3. Configure: Use mhs5200_set_frequency, mhs5200_set_amplitude, etc. to set the desired output.

  4. Enable Output: Call mhs5200_set_output to turn on the signal.

  5. Disconnect: Call mhs5200_disconnect when finished.

License

This project is licensed under the MIT License — see the LICENSE file for details.

Available Tools

16 tools
mhs5200_configure_sweepA

Set sweep parameters for a channel. Use mhs5200_set_sweep to start/stop the configured sweep.

Args: params: Sweep configuration containing: - start_hz (float): Start frequency in Hz - stop_hz (float): Stop frequency in Hz - time_sec (int): Sweep duration (1-600 seconds) - mode (str): "LINEAR" or "LOG" - channel (1 or 2): Target channel

Returns: JSON confirming sweep configuration and start.

Inputs: params (required). Returns: result

mhs5200_connectA
Idempotent

Connect to MHS-5200A signal generator via serial port.

This must be called before using any other mhs5200_* tools. If already connected, the existing connection is closed first.

Args: params: Connection parameters containing: - port (str): Serial port name (e.g., 'COM3', '/dev/ttyUSB0')

Returns: JSON with connection status and device information: { "status": "ok", "model": "5225A", "serial": "1234567890" }

Inputs: params (required). Returns: result

mhs5200_disconnectA
Idempotent

Disconnect from the MHS-5200A signal generator.

Safe to call even if not connected.

Returns: JSON with disconnection status: {"status": "disconnected"} or {"status": "not_connected"}

Inputs: no named parameters. Returns: result

mhs5200_get_statusA
Read-onlyIdempotent

Get complete status of all channels and device settings.

Returns: JSON with full device status including: - Channel 1 & 2: frequency, amplitude, waveform, duty cycle, offset, phase - Global: output state, tracking mode, power amp state

Inputs: no named parameters. Returns: result

mhs5200_set_amplitudeA
Idempotent

Set the peak-to-peak voltage for a channel.

Automatically adjusts attenuation setting for optimal output.

Args: params: Amplitude parameters containing: - channel (1 or 2): Target channel - vpp (float): Peak-to-peak voltage (0.0 to 15.0 V)

Returns: JSON confirming the new amplitude setting.

Inputs: params (required). Returns: result

mhs5200_set_duty_cycleA
Idempotent

Set the duty cycle for a channel (primarily affects square waves).

Args: params: Duty cycle parameters containing: - channel (1 or 2): Target channel - duty_percent (float): Duty cycle (0.0 to 99.9 %)

Returns: JSON confirming the new duty cycle setting.

Inputs: params (required). Returns: result

mhs5200_set_frequencyA
Idempotent

Set the output frequency for a channel.

Args: params: Frequency parameters containing: - channel (1 or 2): Target channel - frequency_hz (float): Frequency in Hz (0.01 to max supported by model)

Returns: JSON confirming the new frequency setting.

Inputs: params (required). Returns: result

mhs5200_set_invertA
Idempotent

Invert (flip vertically) the waveform output for a channel.

Args: params: Invert parameters containing: - channel (1 or 2): Target channel - inverted (bool): True to invert, False for normal

Returns: JSON confirming the inversion setting.

Inputs: params (required). Returns: result

mhs5200_set_offsetA
Idempotent

Set the DC offset for a channel.

The offset is specified as a percentage of half the peak-to-peak amplitude (Vpp/2). For example, with a 5Vpp signal: - offset_percent = 100 shifts the signal by +2.5V - offset_percent = -120 shifts the signal by -3.0V

Formula: DC offset voltage = (Vpp / 2) × (offset_percent / 100)

Args: params: Offset parameters containing: - channel (1 or 2): Target channel - offset_percent (float): Offset as percentage of Vpp/2 (-120 to +120, 0 is center)

Returns: JSON confirming the new offset setting.

Inputs: params (required). Returns: result

mhs5200_set_outputA
Idempotent

Enable or disable all signal outputs.

Args: params: Output control parameters containing: - enabled (bool): True to enable outputs, False to disable

Returns: JSON confirming the output state.

Inputs: params (required). Returns: result

mhs5200_set_phaseA
Idempotent

Set the phase offset of CH2 relative to CH1.

Args: params: Phase parameters containing: - phase_deg (int): Phase offset (-180° to +180°) Positive = CH2 leads CH1 Negative = CH2 lags CH1

Returns: JSON confirming the new phase setting.

Inputs: params (required). Returns: result

mhs5200_set_power_ampA
Idempotent

Enable or disable the internal power amplifier.

Note: Not all MHS-5200A models have this feature.

Args: params: Power amp parameters containing: - enabled (bool): True to enable power amplifier

Returns: JSON confirming the power amp state.

Inputs: params (required). Returns: result

mhs5200_set_sweepA
Idempotent

Start or stop the frequency sweep.

Use mhs5200_configure_sweep first to set sweep parameters, then use this tool to start/stop the sweep.

Args: params: Sweep control parameters containing: - enabled (bool): True to start sweep, False to stop sweep

Returns: JSON confirming the sweep state.

Inputs: params (required). Returns: result

mhs5200_set_trackingA
Idempotent

Enable or disable frequency tracking mode.

When enabled, CH2 automatically follows CH1's frequency.

Args: params: Tracking parameters containing: - enabled (bool): True to enable tracking

Returns: JSON confirming the tracking mode.

Inputs: params (required). Returns: result

mhs5200_set_waveformA
Idempotent

Set the waveform type for a channel.

Args: params: Waveform parameters containing: - channel (1 or 2): Target channel - waveform (str): One of SINE, SQUARE, TRIANGLE, SAWTOOTH_UP, SAWTOOTH_DOWN, or ARB00-ARB15 for arbitrary

Returns: JSON confirming the new waveform setting.

Inputs: params (required). Returns: result

mhs5200_upload_arb_waveformA
DestructiveIdempotent

Upload custom arbitrary waveform data to device memory.

The waveform data must contain exactly 2048 samples, each an integer from 0 to 4095 (12-bit resolution). 2048 is the midpoint (zero crossing).

Args: params: Upload parameters containing: - arb_index (int): Memory slot (0-15, corresponds to ARB00-ARB15) - filepath (str): Path to data file JSON format: [0, 100, 200, ...] Text format: one integer per line

Returns: JSON confirming upload success with slot number and sample count.

Inputs: params (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 16 tools

    Disambiguation5/5

    All 16 tools have distinct, clearly defined purposes with no overlap. Each tool addresses a specific function (e.g., connect, set_frequency, upload_arb_waveform) with unique parameters.

    Naming Consistency5/5

    Tool names consistently follow the 'mhs5200_verb_noun' pattern in snake_case. Variations like 'upload_arb_waveform' (verb_adj_noun) are minor and still predictable.

    Tool Count5/5

    16 tools provide comprehensive coverage for a signal generator's typical operations without being excessive. The scope is well-scoped for the domain.

    Completeness4/5

    Covers most expected operations (connection, waveform, frequency, amplitude, etc.), but lacks per-channel output control (only global) and possibly impedance or reset functions.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      MCP server that lets AI assistants control Siglent SDG waveform generators over a local network using natural language, supporting signal generation, modulation, sweep, burst, and arbitrary waveforms.
      20
      514 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables control of Digilent WaveForms instruments (oscilloscope, AWG, logic analyzer) over USB, supporting devices like Analog Discovery 2/3 and Digital Discovery.
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables remote control of Siglent SDG series function/arbitrary waveform generators via SCPI over TCP/IP. Provides tools for configuring waveforms, modulation, sweep, burst, and other instrument functions.
      1
      -