Skip to main content
Glama
lab-mcp

lab-mcp

by risqyy

lab-mcp

Tests

lab-mcp is a Model Context Protocol (MCP) server for laboratory instruments. Its goal is to let an AI assistant find, configure, and read instruments through one MCP connection. The server finds supported instruments automatically. You usually do not need to enter device addresses or ports.

Current capabilities

  • Control supported DC power supplies, digital multimeters, function generators, oscilloscopes, and spectrum analyzers.

  • Find instruments through USB-TMC, LAN (SCPI), and USB serial connections, as supported by each model.

  • Read measurements, waveforms, and status, set supported parameters, and switch outputs on or off.

  • Connect an MCP client through Streamable HTTP or stdio.

Support and test coverage differ by model. Some functions have only simulated tests or protocol checks. LAN operation is not tested on real instruments. Generator support is limited to basic waveforms. Refer to Supported devices for models, tools, test scope, limits, and troubleshooting.

Related MCP server: Instrument MCP Server

Before use

WARNING: An AI assistant can switch instrument outputs on. Disconnect sensitive loads before you use the server. Read the limits and safety notes for your device in Supported devices. The server checks values before it sends them to an instrument. It refuses values outside the permitted range. These checks cannot verify the wiring or the connected load.

CAUTION: For current measurements, use the multimeter current input and connect the instrument in series with the load. If you connect the current input across a voltage source, the multimeter fuse blows. The server cannot detect the position of the test leads.

WARNING: The server has no authentication. Anyone who can connect to it can control the instruments. The default HTTP address accepts connections only from the same computer. Use --host 0.0.0.0 only in a network that you trust.

Get started

Requirements

  • Git

  • Python 3.10 or later

  • Poetry 2.x

  • An MCP client with Streamable HTTP or stdio support

  • A supported instrument and its required interface driver for hardware use

Check the connection and discovery notes and the notes for your device before connection.

Install

Clone the repository and install its dependencies:

git clone https://github.com/risqyy/lab-mcp.git
cd lab-mcp
poetry install

Start the server

Run this command from the project directory:

poetry run lab-mcp

Keep the process running while the HTTP client is connected. The default endpoint is:

http://127.0.0.1:10765/mcp

Option

Default

Function

--port

10765

Set the HTTP port.

--host

127.0.0.1

Set the HTTP address.

--transport

http

Select http or stdio.

Connect an MCP client

For a client with Streamable HTTP support, add the endpoint above as an MCP server. Use the configuration format required by your client. For clients that accept mcpServers entries:

{
  "mcpServers": {
    "lab-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:10765/mcp"
    }
  }
}

For a client with stdio support, use this configuration instead. The client starts the server process; you do not need a separate HTTP server. Replace /path/to/lab-mcp with the absolute project path. On Windows, use forward slashes in the JSON path, for example C:/work/lab-mcp.

{
  "mcpServers": {
    "lab-mcp": {
      "command": "poetry",
      "args": ["-C", "/path/to/lab-mcp", "run", "lab-mcp", "--transport", "stdio"]
    }
  }
}

Find an instrument

Connect and switch on the instrument. Ask the MCP client to call discover_instruments. Check the returned model and serial number before you send commands. If more than one instrument of a type is found, use its connection tool with the serial number to select it. Refer to Supported devices for the applicable tool and operating limits.

Development

Run the software tests with poetry run pytest. The tests use simulated instruments; no hardware is required. Drivers are in src/lab_mcp/instruments/. MCP tools are in src/lab_mcp/tools/. Refer to Extend device support to add an instrument. Follow the repository instructions in AGENTS.md.

License

lab-mcp uses the MIT License. Refer to LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to directly control NI oscilloscopes (e.g., PXIe-5160/5164/5110) through the Model Context Protocol, including waveform acquisition, measurement, and configuration.
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      Enables natural language control of test instruments like spectrum analyzers and power supplies via SCPI commands, with auto-discovery and multi-instrument session support.
      100
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects test and measurement instruments (oscilloscope, logic analyzer, multimeter, power supply) to AI via MCP, enabling natural language control and automated analysis.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables agentic coding harnesses to control benchtop test equipment — waveform generator, multimeter, oscilloscope, and power supply — over SCPI, with typed tools and raw passthrough for investigating circuits.
      76
      1
      MIT