Thorlabs Optical Power Meter — Claude Code MCP server: what it does
An MCP server for Thorlabs power meters. Your agent can take readings, log stability over time, and change wavelength, averaging and range over SCPI.
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 thorlabs-power-meter -- uvx labmcp-thorlabs-pmWhat Thorlabs Optical Power Meter does
The server talks to PM100D, PM100A, PM100USB and PM400 consoles over USB, using USBTMC through VISA, and speaks the documented SCPI command set. PM101 and PM5020 share those commands but have not been checked against hardware.
Its tools cover a single power reading, a logged series with mean, standard deviation and drift, sensor head temperature, plus control over correction wavelength, averaging, range and dark zeroing. Three tools come from the shared LabMCP base: get_connection_info, get_command_log and reconnect. Launch with --read-only and readings still work while wavelength, averaging, range and zero changes are blocked.
No meter on the bench? uvx labmcp-thorlabs-pm --simulate --check starts a PM100D simulator. On Windows PyVISA cannot see the Thorlabs driver, so you install the NI-VISA runtime and switch the meter over with Thorlabs Driver Switcher. On Linux the device needs a udev rule for vendor ID 1313. Zeroing only works with the beam blocked and the aperture covered, so the agent asks you to confirm first.
What it helps with
- read laser power without typing SCPI commands by hand
- log a run of readings and see warm-up drift
- match the correction wavelength to the sensor head
- dark-zero the sensor with the beam blocked
- verify the connection before trusting a measurement
Example prompts for the agent
- Connect to the power meter and show which console and sensor head you found
- Log a series of power readings and report stability and drift
- Set the correction wavelength to 632.8 nm and read the power
How to install Thorlabs Optical Power Meter
Platform CLI
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 thorlabs-power-meter -- uvx labmcp-thorlabs-pmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-thorlabs-pm <command>
Platform CLI
codex mcp add thorlabs-power-meter --env LABMCP_ADDRESS=<LABMCP_ADDRESS> --env LABMCP_SIMULATE=<LABMCP_SIMULATE> --env LABMCP_READ_ONLY=<LABMCP_READ_ONLY> --env LABMCP_LIMITS=<LABMCP_LIMITS> -- uvx labmcp-thorlabs-pmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-thorlabs-pm <command>
Config file
{
"mcpServers": {
"thorlabs-power-meter": {
"command": "uvx",
"args": [
"labmcp-thorlabs-pm"
],
"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-thorlabs-pm <command>
Config file
{
"servers": {
"thorlabs-power-meter": {
"type": "stdio",
"command": "uvx",
"args": [
"labmcp-thorlabs-pm"
],
"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-thorlabs-pm <command>
Platform CLI
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> thorlabs-power-meter uvx labmcp-thorlabs-pmReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from labmcp-thorlabs-pm <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Thorlabs Optical Power Meter
How do I install Thorlabs Optical Power Meter in Claude Code?
Run claude mcp add labmcp-thorlabs-pm -- uvx labmcp-thorlabs-pm. To pass environment variables instead, use `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 thorlabs-power-meter -- uvx labmcp-thorlabs-pm`.
What does Thorlabs Optical Power Meter do?
It lets an agent read power from Thorlabs meters, log a series of readings, and adjust instrument settings over SCPI: wavelength, averaging, range and sensor zeroing.
Can I try it without a power meter?
Yes. The --simulate flag starts a PM100D simulator with an S120C photodiode or S302C thermopile, and uvx labmcp-thorlabs-pm --simulate --check runs the check.