labmcp
Shared foundations for LabMCP, an open-source collection of Model Context Protocol servers that let AI agents operate laboratory instruments. It is built on FastMCP.
Install labmcp directly if you want to build an instrument server or use the labmcp helper CLI. To use an instrument, install its server instead, e.g. uvx labmcp-mettler-toledo.
The labmcp CLI
uvx labmcp list # all instrument servers, by domain
uvx labmcp info mettler-toledo # models, interfaces, tools
uvx labmcp ports # serial ports (and VISA resources with labmcp[visa])
uvx labmcp config ika --address COM3 # MCP client config snippet
Building a server
from labmcp import HAZARD, READ, SAFETY, ConnectContext, InstrumentServer, Limit
def connect(ctx: ConnectContext) -> MyDriver:
return MyDriver(ctx.open_transport(simulator=MySimulator, baudrate=9600,
read_termination="\r\n", write_termination="\r\n"))
server = InstrumentServer("My Hotplate", connect=connect, package="labmcp-my-hotplate",
limits=[Limit("max_temperature_c", 150, "°C", "Hotplate setpoint")])
mcp = server.mcp
@mcp.tool(**READ)
def read_temperature() -> float:
return server.driver.temperature_c()
@mcp.tool(**HAZARD)
def set_temperature(temperature_c: float) -> str:
server.check("max_temperature_c", temperature_c, "setpoint")
server.driver.set_temperature(temperature_c)
return "ok"
@mcp.tool(**SAFETY)
def heater_off() -> str:
server.driver.heater_off()
return "heater off"
def main() -> None:
server.run() # --address, --simulate, --read-only, --limit, --check, --audit-log, ...
What you get:
- Transports: serial (pyserial), raw TCP, VISA (
labmcp[visa]: GPIB/USBTMC/LXI/HiSLIP), and a wire-levelSimulatedTransport. All are thread-safe and share the same line handling and timeouts. - Addresses as URIs:
serial:///dev/ttyUSB0?baudrate=9600,tcp://10.0.0.5:5025,visa://GPIB0::22::INSTR. - Safety: tool kinds (
READ/CONTROL/HAZARD/SAFETY) with MCP annotations,--read-onlymode, safetyLimits checked before sending, and a command audit log. - Built-in tools:
get_connection_info,get_command_log,reconnect. - SCPI helpers:
labmcp.scpi.SCPIDriverandSCPISimulator, with short/long-form matching and error-queue handling. - Testing:
labmcp.testing.simulated_client(server)gives you an in-memory FastMCP client.
See the contributor guide.
License: Apache-2.0.
Metadata
Release files for labmcp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| labmcp-0.1.2.tar.gz | 71.8 kB | With provenance | Details for labmcp-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| labmcp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for labmcp-0.1.2-py3-none-any.whl |
Total release size: 143.5 kB
Release files / labmcp-0.1.2.tar.gz
| Download URL | labmcp-0.1.2.tar.gz |
|---|---|
| Size | 71.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a92399b29c0dc33a0bceae5cd44c6d58b2e8b77841bbcab1b1bbbf76d082644
|
|
BLAKE2b-256 checksum How to use checksums |
4e3ba87edd6ee45272cf25625626b2ae6e3ed14d88d76bb93fea7fccecf0bc8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / labmcp-0.1.2-py3-none-any.whl
| Download URL | labmcp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 71.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae3d9f4eece550db4e4afae49f6a08c12b489889f40ef325caf7a4431528a98f
|
|
BLAKE2b-256 checksum How to use checksums |
62dff5153169e0e3edca947df1f000e59ea9ef392586b7ac3c00147c6d2f28cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logSecurity for labmcp 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for labmcp-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.