# SRS Lock-in Amplifier

Lets an agent drive Stanford Research Systems lock-ins: read X/Y/R/θ, set frequency, phase and sensitivity, run frequency sweeps.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 23
- Author: K-Dense-AI
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/K-Dense-AI/lab-instrument-mcps/tree/HEAD/servers/physics/srs-lockin
- Updated: 2026-09-26
- HTML: https://affpapa.org/en/nevibecode/mcp/srs-lock-in-amplifier

## What it does

This server talks to Stanford Research Systems DSP lock-in amplifiers, covering the older SR810/SR830 and the newer SR860/SR865A. An agent can pull X, Y, R and θ as one snapshot, adjust the reference frequency, harmonic and phase, set the drive level, sensitivity and time constant, and fire off auto phase or auto range. A separate tool steps the reference from a start to a stop frequency, waits for the output filter to settle at each step, and writes X/Y/R/θ into a fresh CSV file.

Connections go over GPIB (VISA) or RS-232, and the SR86x adds USB (USBTMC) and Ethernet (VXI-11). The model is read from `*IDN?` and can be forced with `--option model=`. GPIB needs a VISA backend: pyvisa-py covers most USB-GPIB adapters, NI-VISA is selected with `?backend=@ivi`. On RS-232 the SR830 terminates replies with CR while the SR86x uses LF, so an SR86x on that port wants `--option model=sr860` or its transmit terminator switched to CR.

You can try it with no hardware at all: `--simulate` starts a simulator, and a sweep from 9 to 11 kHz there shows a resonance peak. The `--read-only` flag permits reading outputs and settings but blocks every change and the sine output. A drive level above the `max_amplitude_v` limit is refused, and `set_amplitude_minimum` only takes the SR810/SR830 down to 4 mV rms — it cannot reach zero, so unplug the cable when the sample must see no drive.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `LABMCP_ADDRESS`, `LABMCP_SIMULATE`, `LABMCP_READ_ONLY`, `LABMCP_LIMITS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env LABMCP_ADDRESS=<LABMCP_ADDRESS> --env LABMCP_SIMULATE=<LABMCP_SIMULATE> --env LABMCP_READ_ONLY=<LABMCP_READ_ONLY> --env LABMCP_LIMITS=<LABMCP_LIMITS> --transport stdio srs-lockin -- uvx labmcp-srs-lockin
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-srs-lockin <command>

### Codex

**Platform CLI**
```bash
codex mcp add srs-lockin --env LABMCP_ADDRESS=<LABMCP_ADDRESS> --env LABMCP_SIMULATE=<LABMCP_SIMULATE> --env LABMCP_READ_ONLY=<LABMCP_READ_ONLY> --env LABMCP_LIMITS=<LABMCP_LIMITS> -- uvx labmcp-srs-lockin
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-srs-lockin <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "srs-lockin": {
            "command": "uvx",
            "args": [
                "labmcp-srs-lockin"
            ],
            "env": {
                "LABMCP_ADDRESS": "<LABMCP_ADDRESS>",
                "LABMCP_SIMULATE": "<LABMCP_SIMULATE>",
                "LABMCP_READ_ONLY": "<LABMCP_READ_ONLY>",
                "LABMCP_LIMITS": "<LABMCP_LIMITS>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-srs-lockin <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "srs-lockin": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "labmcp-srs-lockin"
            ],
            "env": {
                "LABMCP_ADDRESS": "<LABMCP_ADDRESS>",
                "LABMCP_SIMULATE": "<LABMCP_SIMULATE>",
                "LABMCP_READ_ONLY": "<LABMCP_READ_ONLY>",
                "LABMCP_LIMITS": "<LABMCP_LIMITS>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-srs-lockin <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e LABMCP_ADDRESS=<LABMCP_ADDRESS> -e LABMCP_SIMULATE=<LABMCP_SIMULATE> -e LABMCP_READ_ONLY=<LABMCP_READ_ONLY> -e LABMCP_LIMITS=<LABMCP_LIMITS> srs-lockin uvx labmcp-srs-lockin
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-srs-lockin <command>

## When to use it
- capture X, Y, R and θ in one coherent snapshot
- set the reference frequency, harmonic and phase shift
- pick a sensitivity that fits the current signal
- log a frequency sweep to CSV and find a resonance
- switch the input to A-B or current mode with the right coupling

## Example prompts
- Connect to the lock-in and show me the current X, Y, R and θ
- Set the reference to 10 kHz and run auto phase
- Sweep from 9 to 11 kHz and save the result to a new CSV

## Similar
- [OpenReadout](https://affpapa.org/en/nevibecode/mcp/openreadout.md) — MCP server · ★ 8
- [ads-snapchat](https://affpapa.org/en/nevibecode/skills/ads-snapchat.md) — skill · 564 installs
- [product-capability](https://affpapa.org/en/nevibecode/skills/product-capability.md) — skill · 4600 installs
- [reimagine-it-lock](https://affpapa.org/en/nevibecode/skills/reimagine-it-lock.md) — skill · ★ 212
- [Departi – Travel Compliance & Curated Booking](https://affpapa.org/en/nevibecode/mcp/departi-travel-compliance-curated-booking.md) — MCP server
- [content-amplifier](https://affpapa.org/en/nevibecode/skills/content-amplifier.md) — skill · 1100 installs

From the same set: [k-dense-ai/lab-instrument-mcps](https://affpapa.org/en/nevibecode/by/k-dense-ai/lab-instrument-mcps.md) — 15 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
