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 @sinkush/openmhp 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 @sinkush/openmhp 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 @sinkush/openmhp launcher

License

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openmhp-0.5.0.tar.gz (100.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openmhp-0.5.0-py3-none-any.whl (111.4 kB view details)

Uploaded Python 3

File details

Details for the file openmhp-0.5.0.tar.gz.

File metadata

  • Download URL: openmhp-0.5.0.tar.gz
  • Upload date:
  • Size: 100.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.7

File hashes

Hashes for openmhp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 41d3e7e7060623bda617427e4201a519600b9d98e56612106df06b9544a348fd
MD5 f2f4780b06c983e2b38375ba3e2c4d80
BLAKE2b-256 318967ca954f932b9bda3d8fcb8928adfe426c88632f4a143c207ea06c7210e7

See more details on using hashes here.

File details

Details for the file openmhp-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: openmhp-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 111.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.7

File hashes

Hashes for openmhp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07d7471c4fd1e13a00404f6190544479f5c937de3b38b6497b2ba87e9e07878d
MD5 e53eaf3812e1d9522b51c96dfe7dc73b
BLAKE2b-256 63faa7d54b6e5809088a235866c19c00d0c13a99e687af3a6cedadeaea2d19a5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

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