Simulated Bench
This tutorial gets you from zero to a working mcpyvisa session using simulated instruments. No GPIB adapters, no physical test equipment, no proprietary VISA drivers. By the end, you will have queried a virtual multimeter, set a voltage on a virtual power supply, and seen exactly what a real session looks like — all backed by YAML definitions that respond like the real hardware.
What you will need
Section titled “What you will need”- Python 3.11+ with uv installed
- Claude Code (or another MCP-compatible client)
That is it. No instruments, no adapters, no cables.
Install mcpyvisa with sim support
Section titled “Install mcpyvisa with sim support”-
Install with the sim extra
The sim backend depends on
pyvisa-sim, which is included in thesimoptional dependency group:Terminal window uv add mcpyvisa[sim]Terminal window pip install mcpyvisa[sim]Terminal window uvx mcpyvisa[sim] -
Get the instrument definitions
The GPIB Instrument Catalog provides
all_instruments.yaml— a pyvisa-sim definition file containing 16 simulated instruments covering multimeters, power supplies, oscilloscopes, signal generators, and more.Clone the catalog (or just grab the YAML file):
Terminal window git clone https://git.supported.systems/warehack.ing/mcgpib.gitThe file lives at
mcgpib/gpib-catalog/sim/all_instruments.yaml. -
Create your configuration
Create
mcpyvisa.tomlin your working directory (or at~/.config/mcpyvisa/config.toml):mcpyvisa.toml [server]log_level = "INFO"[[backend]]name = "sim-bench"type = "sim"sim_file = "./gpib-catalog/sim/all_instruments.yaml"# Give a few instruments friendly names[instruments.dmm]resource = "GPIB0::22::INSTR"backend = "sim-bench"[instruments.psu]resource = "GPIB0::5::INSTR"backend = "sim-bench"[instruments.counter]resource = "GPIB0::3::INSTR"backend = "sim-bench" -
Add to Claude Code
Terminal window claude mcp add mcpyvisa -- uvx mcpyvisa[sim]Terminal window claude mcp add mcpyvisa -- uv run --directory /path/to/mcgpib mcpyvisa
Connect and explore
Section titled “Connect and explore”Start a Claude Code session and try the following.
-
Connect to the sim backend
> Connect to my backend "sim-bench"Claude calls
connect_backend("sim-bench"). The server creates a pyvisaResourceManagerpointing at your YAML definition file and discovers all 16 simulated instruments:Connected to sim-bench (sim)Discovered 16 instrument(s):GPIB0::1::INSTR — FLUKE,8842AGPIB0::2::INSTR — TEKTRONIX,TDS 2024BGPIB0::3::INSTR — HEWLETT-PACKARD,53131A (alias: counter)GPIB0::5::INSTR — HEWLETT-PACKARD,E3631A (alias: psu)GPIB0::7::INSTR — HEWLETT-PACKARD,1660AGPIB0::9::INSTR — HEWLETT-PACKARD,3488AGPIB0::10::INSTR — HEWLETT-PACKARD,33120AGPIB0::16::INSTR — KEITHLEY INSTRUMENTS INC.,MODEL 2000GPIB0::17::INSTR — HEWLETT-PACKARD,4284AGPIB0::18::INSTR — HEWLETT-PACKARD,8566BGPIB0::19::INSTR — HEWLETT-PACKARD,8657BGPIB0::22::INSTR — HEWLETT-PACKARD,34401A (alias: dmm)GPIB0::23::INSTR — HEWLETT-PACKARD,3458AGPIB0::24::INSTR — HEWLETT-PACKARD,3478AGPIB0::25::INSTR — KEITHLEY INSTRUMENTS INC.,MODEL 2400GPIB0::27::INSTR — KEITHLEY INSTRUMENTS INC.,MODEL 6517BThese are classic bench instruments from HP/Agilent, Keithley, Fluke, and Tektronix. Each one responds to its documented SCPI (or legacy) command set.
-
Identify an instrument by alias
> Identify the instrument "dmm"dmm (GPIB0::22::INSTR on sim-bench):Manufacturer: HEWLETT-PACKARDModel: 34401ASerial: 0Firmware: 0 -
Query the simulated multimeter
> What is the DMM reading?Claude calls
instrument_query("dmm", "MEAS:VOLT:DC?"). The simulated HP 34401A returns a randomized voltage reading:+1.23456789E+00Each query returns a different value — pyvisa-sim’s
RANDOM()function generates plausible readings within the configured range. -
Set a voltage on the power supply
> Set the PSU output to 5 volts on channel P6VClaude sends the appropriate SCPI commands:
instrument_write("psu", "INST:SEL P6V") → Sent to psuinstrument_write("psu", "VOLT 5.0") → Sent to psuinstrument_write("psu", "OUTP ON") → Sent to psuThe simulated E3631A accepts these commands just as the real hardware would. Query back to confirm:
> Read the voltage setting backinstrument_query("psu", "VOLT?") → 5.000000E+00 -
Explore other instruments
With 16 instruments on the bus, there is plenty to explore:
> What instruments are on the bus? Identify the signal generator.> Read a frequency from the counter> What does the Keithley 2400 source-measure unit support?
What is next
Section titled “What is next”- First Measurement — the same workflow with a real multimeter connected via AR488
- Configure Backends — sim backend configuration options alongside AR488, pyvisa-py, and system VISA
- Configuration Reference — full documentation of every config field including
sim_file - Architecture — how the sim backend fits into the pyvisa abstraction layer