Skip to main content

OpenMHP

The open protocol for AI agents to run lab instruments

Install it once. Tell your agent to find your instruments, onboard the rest by interview, rehearse a procedure, and run it within limits the instrument itself enforces.

npm PyPI license docs

Get started · Documentation · Cookbook · Instruments · Specification · Contributing


OpenMHP (Open Model Hardware Protocol) is MCP for lab equipment. It gives any AI agent harness one way to find a physical device among thousands, learn how to use it from the people who own it, operate it safely, and hand it long-running work.

npx openmhp-cli setup

Then, in Claude Code, Codex, OpenClaw, Hermes, Claude Science, Open Science or any MCP client:

You say What happens
"find the instruments on my network" scans for devices that speak MHP and lists them
"onboard my hotplate" the server interviews you, writes the device package itself, validates it, reads you a safety card, adds it. Hand-operated and USB-serial instruments need no code
"run a 30-cycle PCR at 95/58/72 and hold at 4 °C" finds a recipe, rehearses it in plan mode and shows every step, then runs it and reports what it read
"watch the incubator overnight" a background run logs readings and alerts; in the morning, ask what happened

Try it with nothing plugged in: npx openmhp-cli demo adds two simulated instruments.

Why

Every instrument has its own interface, and the knowledge that makes it safe to use lives in manuals and people's heads. OpenMHP takes the shape of MCP and Agent Skills and applies it to hardware:

  • Five primitives. Describe, signals (read), settings (write), actions (jobs), safety.
  • A device package per instrument, shaped like a skill: a card, operating instructions, and detail loaded only when asked. Two thousand devices cost the agent the same handful of tokens as two.
  • Safety enforced in the driver. Limits, interlocks and "ask a person first" are checked on the device side of the wire, whatever the agent asks for. E-stop is always allowed.
  • Bridge, don't replace. SiLA 2, PyLabRobot, MADSci, OPC UA and ROS 2 devices join through adapters in a few lines.
  • Recipes and plan mode. Tested procedures the agent adapts, rehearsed through every gate before anything moves.

The full story is at openmhp.com; the protocol is in SPEC.md.

For developers

pip install "openmhp[all]"                     # runtime; [all] adds mDNS discovery and serial
python examples/pcr_run.py                     # orchestrate a robot arm and a thermocycler
python examples/scale_demo.py                  # 2,000 devices, ~1k tokens
python tests/test_adapters.py && python tests/test_runs.py
mhp serve pkg:openmhp/devices/thermocycler-01 --http 18921     # serve a device package on the LAN
mhp-mcp --http 18800                           # the MCP bridge over HTTP for remote harnesses

A device is a folder:

devices/hotplate-01/
├── DEVICE.md          card (YAML frontmatter) + operating instructions
├── descriptor.yaml    signals, settings with limits, actions, interlocks, safety
├── driver.py          code: a Driver subclass, a BoundDriver, or an adapter
├── sim.py             optional simulated twin
├── references/        SOPs, manual excerpts
└── scripts/           tested mhp_run scripts

Adapters: openmhp.adapters.sila2, .pylabrobot, .madsci, .opcua, .ros2, and BoundDriver for any Python callable. Community packages live in packages/; recipes in openmhp/recipes/; Agent Skills in openmhp/skills/.

Layout

openmhp/driver.py        Driver base class: primitives, six safety gates, jobs (pause/resume), detail tiers, resources
openmhp/package.py       device packages: DEVICE.md frontmatter + body, descriptor.yaml, resources, sim twins
openmhp/directory.py     card index + BM25 search + live state pings; serves directory/*
openmhp/fleet.py         the lab's device list (~/.openmhp/fleet.json); github: targets; in-process hosting
openmhp/discovery.py     mDNS advertise/browse (optional zeroconf) and HTTP probe of /mhp.json
openmhp/onboarding.py    server-side interview -> writes the device package
openmhp/drivers/         no-code drivers: manual (human-operated) and serial_ascii (declared commands)
openmhp/runs.py          runs (background, run_dir, stdout), the run log, plan mode
openmhp/recipes/         tested cross-instrument procedures
openmhp/safety.py        the safety card
openmhp/registry.py      community package index
openmhp/mcp_bridge.py    mhp-mcp: ten tools, elicitation, prompts, logging; stdio or HTTP
openmhp/transport.py     stdio and HTTP(+SSE) device transports; /mhp.json discovery
openmhp/client.py        Device / Lab client SDK
openmhp/cli.py           mhp: lab, validate, skills, serve, serve-directory, device verbs
openmhp/adapters/        BoundDriver; sila2, pylabrobot, madsci, opcua, ros2
openmhp/skills/          Agent Skills: onboard-device, adapt-fleet, operate
openmhp/devices/         bundled simulated thermocycler and arm, as packages
packages/                community packages: ika-c-mag-hs7, opentrons-flex, manual-benchtop-centrifuge
npm/                     the npx openmhp-cli launcher

License

Apache 2.0. See CONTRIBUTING.md to add a device package or a recipe.

Metadata

Release files for openmhp 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openmhp 0.6.0
File Size Uploaded Provenance
openmhp-0.6.0.tar.gz 100.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openmhp 0.6.0
File Interpreter ABI Platform
openmhp-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 211.4 kB

Release files / openmhp-0.6.0.tar.gz

Download URL openmhp-0.6.0.tar.gz
Size 100.0 kB
Tags Source
SHA-256 checksum
How to use checksums
794dd41ea2aef45563d9183ec1cd896be760b8651f29e1ece611c808825c4629
BLAKE2b-256 checksum
How to use checksums
076bc2a5d311fc545371cf1530955d67cead1c22d1f0d6f19a65944f17c87ec2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

Release files / openmhp-0.6.0-py3-none-any.whl

Download URL openmhp-0.6.0-py3-none-any.whl
Size 111.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cf45657e593a126e9a539e9928b35a20257510ba273b1b059537cd9dccfba5a
BLAKE2b-256 checksum
How to use checksums
3b43790de13706007f0d221b8431eebc16ede138ca79c3b8a46aee7f6b09dfe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

Security for openmhp 0.6.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page