Metadata-Version: 2.4
Name: mcpyvisa
Version: 2026.2.25
Summary: FastMCP server for test equipment via pyvisa — GPIB, USB-TMC, LAN, and more
Project-URL: Documentation, https://mcpyvisa.warehack.ing
Project-URL: Repository, https://git.supported.systems/warehack.ing/mcgpib
Author-email: Ryan Malloy <ryan@supported.systems>
License-Expression: MIT
License-File: LICENSE
Keywords: gpib,ieee-488,mcp,pyvisa,scpi,test-equipment,usb-tmc,visa
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
Requires-Python: >=3.11
Requires-Dist: fastmcp<4,>=3.0.2
Requires-Dist: pydantic>=2.0
Requires-Dist: pyvisa>=1.13
Provides-Extra: all
Requires-Dist: pymeasure>=0.14; extra == 'all'
Requires-Dist: pyserial-asyncio>=0.6; extra == 'all'
Requires-Dist: pyserial>=3.5; extra == 'all'
Requires-Dist: pyusb>=1.2; extra == 'all'
Requires-Dist: pyvisa-ar488; extra == 'all'
Requires-Dist: pyvisa-py>=0.7; extra == 'all'
Requires-Dist: pyvisa-sim>=0.6; extra == 'all'
Requires-Dist: zeroconf>=0.80; extra == 'all'
Provides-Extra: ar488
Requires-Dist: pyserial-asyncio>=0.6; extra == 'ar488'
Requires-Dist: pyserial>=3.5; extra == 'ar488'
Requires-Dist: pyvisa-ar488; extra == 'ar488'
Provides-Extra: pymeasure
Requires-Dist: pymeasure>=0.14; extra == 'pymeasure'
Provides-Extra: pyvisa-py
Requires-Dist: pyusb>=1.2; extra == 'pyvisa-py'
Requires-Dist: pyvisa-py>=0.7; extra == 'pyvisa-py'
Requires-Dist: zeroconf>=0.80; extra == 'pyvisa-py'
Provides-Extra: sim
Requires-Dist: pyvisa-sim>=0.6; extra == 'sim'
Description-Content-Type: text/markdown

# mcpyvisa

MCP server for test equipment. Connects any MCP client (Claude Code, Claude Desktop, etc.)
to instruments via [pyvisa](https://pyvisa.readthedocs.io/) - GPIB, USB-TMC, LAN/VXI-11,
or simulated hardware.

**Docs:** [mcpyvisa.warehack.ing](https://mcpyvisa.warehack.ing)

## Install

```bash
pip install mcpyvisa
# or
uv add mcpyvisa
```

Optional extras for specific backends and features:

```bash
pip install mcpyvisa[ar488]      # GPIB via AR488/Prologix adapters
pip install mcpyvisa[pyvisa-py]  # USB-TMC, LAN/VXI-11
pip install mcpyvisa[pymeasure]  # Validated drivers for 8 instruments
pip install mcpyvisa[sim]        # Simulated instruments (no hardware needed)
pip install mcpyvisa[all]        # Everything
```

## Add to Claude Code

```bash
claude mcp add mcpyvisa -- uvx mcpyvisa
```

The server runs over stdio. Works with any MCP client.

## Configure

Create `mcpyvisa.toml` in the current directory or `~/.config/mcpyvisa/config.toml`:

```toml
[server]
log_level = "INFO"

# AR488/Prologix adapter on serial
[[backend]]
name = "bench"
type = "ar488"
transport = "serial"
port = "/dev/ttyUSB0"
baudrate = 115200

# Give instruments friendly names
[instruments.dmm]
resource = "GPIB0::22::INSTR"
backend = "bench"

[instruments.smu]
resource = "GPIB0::24::INSTR"
backend = "bench"
```

Config search order: `$MCPYVISA_CONFIG`, `./mcpyvisa.toml`, `~/.config/mcpyvisa/config.toml`.

## Backends

| Type | Extra | What it connects to |
|------|-------|---------------------|
| `ar488` | `mcpyvisa[ar488]` | GPIB instruments via AR488 or Prologix adapters (serial or TCP) |
| `pyvisa-py` | `mcpyvisa[pyvisa-py]` | USB-TMC and LAN/VXI-11 instruments |
| `system` | (none) | NI-VISA or Keysight IO Libraries |
| `sim` | `mcpyvisa[sim]` | Simulated instruments from YAML definitions |

Multiple backends can be active simultaneously. A GPIB bus on serial and a LAN scope
work side-by-side through the same server.

## Tools (22)

**Universal** - `server_status`, `connect_backend`, `disconnect_backend`,
`discover_instruments`, `instrument_query`, `instrument_write`,
`instrument_identify`, `instrument_reset`

**GPIB** - `instrument_clear`, `serial_poll`, `check_srq`, `bus_trigger`,
`interface_clear`, `instrument_local`, `instrument_remote`

**AR488** - `ar488_command`, `ar488_diagnostic`, `configure_ar488`

**pymeasure** (when installed) - `instrument_inspect`, `instrument_get`,
`instrument_set`, `instrument_call`

## What a session looks like

```
You:    Connect to the bench backend and see what's on the bus.

Claude: [connect_backend("bench")] Connected.
        [discover_instruments("bench")] Found 3 instruments:
          GPIB0::5::INSTR   - HP 34401A multimeter
          GPIB0::22::INSTR  - Keithley 2400 SourceMeter
          GPIB0::10::INSTR  - HP 33120A function generator

You:    Measure DC voltage on the DMM.

Claude: [instrument_query("dmm", "MEAS:VOLT:DC?")] -0.00342 V
```

## Try without hardware

Install the sim backend and point it at the included instrument catalog:

```toml
[[backend]]
name = "virtual-bench"
type = "sim"
sim_file = "gpib-catalog/sim/all_instruments.yaml"
```

This gives you 16 simulated instruments that respond to `*IDN?` and basic SCPI.

## pymeasure drivers

When `mcpyvisa[pymeasure]` is installed, 4 additional tools let you interact
with instruments through validated, property-based drivers instead of raw SCPI.
Supported instruments:

HP 33120A, HP 34401A, HP 3478A, HP 8657B, Agilent 4284A,
Keithley 2000, Keithley 2400, Keithley 6517B

## Requirements

- Python 3.11+
- pyvisa >= 1.13
- fastmcp >= 3.0

## Links

- **Docs:** [mcpyvisa.warehack.ing](https://mcpyvisa.warehack.ing)
- **Repository:** [git.supported.systems/warehack.ing/mcgpib](https://git.supported.systems/warehack.ing/mcgpib)
- **pyvisa-ar488:** Standalone pyvisa backend included in this repo

## License

MIT
