Quick Start
This guide will help you get started with InstrMCP in minutes.
Starting the MCP Server in JupyterLab
InstrMCP runs as an IPython extension within JupyterLab. Here’s how to start it:
Launch JupyterLab:
jupyter lab
Load the InstrMCP extension in a notebook cell:
%load_ext instrmcp
Start the MCP server:
%mcp_start
The server will start on port 8123 by default and provide MCP tools to connected clients.
Server Management
Check server status:
%mcp_status
Stop the server:
%mcp_stop
Restart the server:
%mcp_restart
Safe vs Unsafe Mode
InstrMCP operates in two modes:
- Safe Mode (Default)
Read-only access to instruments and notebooks. Cannot execute code or modify cells.
- Unsafe Mode
Full access including code execution and cell manipulation.
Switch between modes:
# Enable unsafe mode
%mcp_unsafe
# Return to safe mode
%mcp_safe
# Restart required for changes to take effect
%mcp_restart
Warning
Unsafe mode allows LLMs to execute arbitrary code in your notebook. Only enable when needed.
Optional Features
InstrMCP supports optional features that can be enabled:
MeasureIt Integration:
%mcp_option measureit
%mcp_restart
This provides measurement templates and code generation resources.
Database Integration:
%mcp_option database
%mcp_restart
This enables read-only access to QCodes databases with query tools.
Check current options:
%mcp_option
Connecting Claude Desktop/Code
After starting the MCP server in JupyterLab, connect Claude Desktop or Claude Code:
The server runs on
http://127.0.0.1:8123Configure your MCP client to connect to this endpoint
Use the launcher scripts in
agentsetting/claudedesktopsetting/oragentsetting/codexsetting/
Example configuration for Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"instrMCP": {
"command": "python",
"args": ["/path/to/instrMCP/agentsetting/claudedesktopsetting/claude_launcher.py"]
}
}
}
Using QCodes Instruments
Once connected, Claude can interact with your QCodes instruments:
List available instruments:
Ask Claude: “What instruments are available?”
Read instrument parameters:
Ask Claude: “What is the current voltage of the DAC channel 1?”
Get instrument information:
Ask Claude: “Show me details about the SR830 lock-in amplifier”
Example Workflow
Here’s a complete example workflow:
Start JupyterLab and create a new notebook
Initialize QCodes instruments:
import qcodes as qc
from qcodes.instrument_drivers.stanford_research.SR830 import SR830
# Create a mock instrument for testing
lockin = SR830("lockin", "GPIB0::8::INSTR")
Start InstrMCP:
%load_ext instrmcp
%mcp_start
Connect Claude Desktop/Code using the launcher script
Interact with instruments through Claude:
“What instruments do we have?”
“Read the X voltage from the lock-in”
“Show me all parameters of the lockin instrument”
Enable database access (optional):
%mcp_option database
%mcp_restart
Query measurement history through Claude:
“Show me the last 5 measurements”
“What datasets were created today?”
Next Steps
Learn about the Architecture of InstrMCP
Explore available MCP Tools Reference
Read about Jupyter Integration
Check out Database Integration for measurement history access