Skip to main content
Glama
Rigol DL3021 MCP Server

Rigol DL3021 MCP Server

by amahpour

Rigol DL3021 MCP Server

A Model Context Protocol (MCP) server for controlling Rigol DL3021 electronic loads via Ethernet. Enables AI agents to perform automated load testing workflows through SCPI commands over VISA TCP/IP.

Features

  • Ethernet-only communication via PyVISA TCP/IP

  • Network auto-discovery when no IP is configured

  • 22 MCP tools covering measurements, input control, mode configuration, and device management

Available Tools

Category

Tools

Connection

ping, discover_devices, test_connection, connect, disconnect

Device

get_device_info, reset_device

Measurements

measure_voltage, measure_current, measure_power, measure_resistance, measure_all

Input Control

enable_input, disable_input, get_input_state

Mode

set_mode, query_mode

CC Mode

set_cc_current, set_cc_slew_rate, cc_mode

CP Mode

set_cp_power, set_cp_current_limit, cp_mode

Related MCP server: Instrument MCP Server

Installation

First, install the package and its dependencies:

pip install -e .

Or with uv:

uv pip install -e .

This installs the following dependencies:

  • pyvisa >= 1.11.0 - VISA instrument communication

  • pyvisa-py - Pure Python VISA backend

  • fastmcp >= 2.10.6 - MCP server framework

Configuration

The server uses environment variables for configuration:

Variable

Description

Default

RIGOL_DL3021_IP

Device IP address (optional, auto-discovers if not set)

None

RIGOL_DL3021_PORT

SCPI port

5555

Claude Code

After installing the package, add the following to your ~/.claude.json file under the mcpServers key:

{
  "mcpServers": {
    "rigol-dl3021": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "run",
        "--with", "fastmcp",
        "--with", "pyvisa",
        "--with", "pyvisa-py",
        "fastmcp", "run",
        "/path/to/rigol_dl3021_mcp_server/mcp_rigol_dl3021.py"
      ],
      "env": {
        "RIGOL_DL3021_PORT": "5555"
      }
    }
  }
}

Replace /path/to/rigol_dl3021_mcp_server/ with the actual path to this repository.

Cursor

After installing the package, add the following to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-level):

{
  "mcpServers": {
    "rigol-dl3021": {
      "command": "uv",
      "args": [
        "run",
        "--with", "fastmcp",
        "--with", "pyvisa",
        "--with", "pyvisa-py",
        "fastmcp", "run",
        "/path/to/rigol_dl3021_mcp_server/mcp_rigol_dl3021.py"
      ],
      "env": {
        "RIGOL_DL3021_PORT": "5555"
      }
    }
  }
}

Replace /path/to/rigol_dl3021_mcp_server/ with the actual path to this repository.

Usage

Running Directly

python mcp_rigol_dl3021.py

With FastMCP

fastmcp run mcp_rigol_dl3021.py

As Installed Package

rigol-dl3021-mcp

Network Discovery

To find your DL3021 on the network:

python rigol_dl3021/find_dl3021.py

To test a specific IP:

python rigol_dl3021/test_ip.py 192.168.1.100

Project Structure

rigol_dl3021_mcp_server/
├── mcp_rigol_dl3021.py          # MCP server (22 tools)
├── pyproject.toml               # Package configuration
└── rigol_dl3021/
    ├── comm_base.py             # Ethernet-only VISA communication
    ├── dl3021.py                # DL3021 SCPI driver
    ├── find_dl3021.py           # Network auto-discovery
    └── test_ip.py               # Single IP connectivity test

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      Enables AI agents to control Copper Mountain Vector Network Analyzers over TCP/IP SCPI, offering 45 tools for sweep configuration, calibration, measurement, and Touchstone export.
      49
      2
      AGPL 3.0
    • A
      license
      C
      quality
      B
      maintenance
      Enables natural language control of test instruments like spectrum analyzers and power supplies via SCPI commands, with auto-discovery and multi-instrument session support.
      100
      1
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables agentic coding harnesses to control benchtop test equipment — waveform generator, multimeter, oscilloscope, and power supply — over SCPI, with typed tools and raw passthrough for investigating circuits.
      76
      1
      MIT