Specification · section A

Reference implementation

openmhp is a Python implementation of everything above, with PyYAML as its only dependency: the Driver base class with all six gates and the detail tiers, the device package loader, the live-pinging Directory, stdio and HTTP + SSE transports, the lazy Lab client SDK, the mhp CLI, the eight-tool mhp-mcp bridge over stdio or HTTP, BoundDriver and the five ecosystem adapters, three Agent Skills, two simulated devices, adapter tests against injected fakes, and the 2,000-device scale demo. Writing a new driver is a descriptor plus three hooks.

class MyHotplate(Driver):
    descriptor = {...}                                  # §4
    def on_read(self, name):          return float(self.dev.query("IN_PV_1"))
    def on_write(self, name, value):  self.dev.write(f"OUT_SP_1 {value}")
    def on_invoke(self, job):         self.dev.write("STOP")
    def on_estop(self):               self.dev.write("STOP")
pip install -e .
python examples/pcr_run.py                                          # arm + thermocycler, in-process
python examples/scale_demo.py                                       # 2,000 devices, 1,087 tokens
python tests/test_adapters.py                                       # adapters + live directory, no hardware
mhp serve local:openmhp.devices.sim_thermocycler:SimThermocycler --http 18921
curl localhost:18921/mhp.json
mhp-mcp thermo=http://localhost:18921 arm=local:openmhp.devices.sim_arm:SimArm