A reference prototype of the runtime layer described in the MCML Runtime Safety specification. It enforces a signed Agentic Governance Card on every MCP tool call, from outside the agent’s runtime, and records linked, tamper-evident evidence.
Status: prototype. Tested in a synthetic clinical environment (see RESULTS.md). Not for production use.
The agent connects only to the gateway, which is an MCP server to the agent and an MCP client to the real tools. For every call, the gateway checks, in order:
argument_schema. Extra or malformed arguments are blocked as security events.Allowed calls are forwarded with a credential only the gateway holds. The tool returns a signed receipt, which the gateway verifies against the arguments it sent. Every decision goes into a hash-chained ledger. Numeric kill-switch triggers from the card are evaluated after every event. When the switch fires, the gateway revokes its own tool credential, so it does not depend on the agent’s cooperation.
reconcile() compares the tool’s receipts with the ledger. Any receipt without a matching gateway decision means something reached the tool another way.
pip install -r gateway/requirements.txt
cd gateway
python -m mcml_gateway scenarios # writes RESULTS.md; exits non-zero on any failure
Seven scenarios: authorized call, approval withdrawn, kill switch, gateway bypass, model provenance injection, payload injection, and evidence integrity.
demo-serve runs the gateway over stdio in front of the synthetic clinical tools, so any MCP client (for example Claude Desktop) can act as the agent. Operator commands run in a separate terminal, outside the agent’s reach.
MCP client configuration:
{
"mcpServers": {
"mcml-gateway": {
"command": "python3",
"args": ["-m", "mcml_gateway", "demo-serve", "--state", "/tmp/mcml-demo"],
"env": { "PYTHONPATH": "/path/to/mcml-standard/gateway" }
}
}
}
Operator terminal:
cd gateway
python -m mcml_gateway approve A-100 --state /tmp/mcml-demo # charge nurse approves a page
python -m mcml_gateway withdraw A-100 --state /tmp/mcml-demo # ...and withdraws it
python -m mcml_gateway kill --state /tmp/mcml-demo --reason "stop" # pull the kill switch
python -m mcml_gateway verify-log /tmp/mcml-demo/evidence.jsonl # check the evidence chain
Suggested script: ask the agent to check vitals for pt-000123 and page the rapid response team. It is blocked until you approve. Approve and it goes through. Withdraw and ask again: blocked. Pull the kill switch: everything stops. Then show evidence.jsonl.
| File | Role |
|---|---|
mcml_gateway/core.py |
Policy engine: checks, approvals, kill switch, provenance, receipts, reconciliation |
mcml_gateway/mcp_front.py |
MCP server for the agent; MCP client to the tools |
mcml_gateway/card.py |
Load, sign and verify Agentic Governance Cards |
mcml_gateway/ledger.py |
Hash-chained evidence log and verification |
mcml_gateway/demo.py |
Synthetic clinical tool server and serving host |
mcml_gateway/scenarios.py |
Scenario harness and report |
GPL-3.0-or-later, with commercial licenses available. See the repository LICENSE.