mhs_demo_server
by sidman76
README.md
# mhs-demo
A demo agent that operates simulated lab hardware (a CO2 incubator and a
centrifuge) through an MCP server, in the pattern described by Anthropic's
[Model Hardware Standard (MHS) research preview](https://www.anthropic.com/news/model-hardware-standard-research-preview).
**This is not Anthropic's real MHS SDK.** As of this writing MHS is a gated
research preview — no public spec, package, or sample code has been released.
This repo reimplements the *pattern* from that announcement (device
discovery + `read`/`write` primitives + natural-language safety-limit
metadata) against two simulated instruments, so the agent-loop shape is ready
to swap onto real MHS drivers once they ship.
## What's here
- `mhs_demo_server.py` — an MCP server exposing three tools over stdio:
- `list_devices` — discover devices, parameters, units, and safety limits
- `read` — get a parameter's current value
- `write` — set a parameter; rejected if unwritable or outside safety limits
(includes a cross-parameter interlock example: the centrifuge door can't
unlock while it's spinning)
- `mhs_demo_agent.py` — a Claude agentic loop that discovers the MCP server's
tools, converts them to Anthropic tool schemas, and calls them to satisfy a
user request end to end.
Simulated devices:
| Device | Parameters |
|---|---|
| `incubator_01` | `temperature_c` (4–45°C), `humidity_pct` (0–100%), `door_open` (read-only) |
| `centrifuge_01` | `speed_rpm` (0–15000), `door_locked` (interlocked with speed) |
## Setup
```bash
pip install -r requirements.txt
export ANTHROPIC_API_KEY=sk-ant-... # or create a .env file with this line
```
## Run
```bash
python mhs_demo_agent.py
# or with a custom prompt:
python mhs_demo_agent.py "Set the incubator to 39C and spin the centrifuge at 20000 RPM"
```
The agent spawns `mhs_demo_server.py` as a subprocess over stdio, discovers
its tools, and runs a tool-use loop with Claude until the model returns a
final answer.
## Model
Uses `claude-opus-4-6` via the Anthropic SDK.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues