# scope-mcp

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

An MCP server for controlling a Keysight/Agilent oscilloscope over Ethernet from Claude Code.

## Tested with

- Agilent MSOX2024A (firmware 02.43.2018020635)

## Install

```bash
git clone https://github.com/NetlistStudio/scope-mcp
cd msox2024a-scope
python -m venv .venv
.venv/bin/pip install fastmcp pyvisa pyvisa-py numpy
```

Add to Claude Code (replace with your scope's IP):

```bash
claude mcp add scope -- /path/to/.venv/bin/python /path/to/scope_server.py --host 192.168.1.100
```

Or use an environment variable:

```bash
export SCOPE_IP=192.168.1.100
claude mcp add scope -- /path/to/.venv/bin/python /path/to/scope_server.py
```

Test your connection:

```bash
.venv/bin/python connect.py --host 192.168.1.100
```

## Example usage

Once added to Claude Code, just describe what you want in natural language:

> *"Autoscale and take a screenshot"*

> *"Measure the frequency and Vpp on channel 1"*

> *"Set channel 2 to 500 mV/div with DC coupling and trigger on its rising edge at 1.5 V"*

> *"Decode UART at 115200 baud on channel 1 and show me the frames"*

> *"Download the waveform from channel 1 and calculate the RMS voltage"*

## Available tools

| Tool | Description |
|---|---|
| `scope_idn` | Identify the scope |
| `scope_autoscale` | Auto-configure all channels and timebase |
| `scope_run` / `scope_stop` / `scope_single` | Acquisition control |
| `scope_set_timebase` | Set time/div and delay |
| `scope_set_channel` | Set V/div, offset, coupling, BW limit |
| `scope_set_trigger` | Configure edge trigger |
| `scope_measure` | Single measurement (frequency, Vpp, rise time, …) |
| `scope_measure_all` | All measurements for a channel at once |
| `scope_waveform` | Download digitized waveform data |
| `scope_serial_setup_uart` | Configure UART serial decode |
| `scope_serial_trigger` | Trigger on UART events |
| `scope_serial_read` | Read decoded serial frames |
| `scope_screenshot` | Capture scope display as PNG |
| `scope_state` | Full snapshot of current configuration |

---

*Built with [Claude Code](https://claude.ai/claude-code)*
