The BMA Executor Protocol (OpenRPC contract 2.4.0, subprotocols bma.executor.v1.1 and bma.executor.v1) is the outbound WebSocket + JSON-RPC 2.0 contract implemented by bma-executor-sdk for connecting your own machine (hands) or agent runtime (brain) to BMA.
Application backends calling the HTTP /v1 API use bma-sdk API reference. Only executors, local brains and harnesses speak the WebSocket protocol documented here.

Connection & token exchange

Executors never send long-lived credentials on the WebSocket. Exchange your machine token or environment key for a 5-minute JWT over HTTPS, then open an outbound WebSocket carrying that JWT as a Bearer token:

Contract server templates

  • machine: wss://{host}/v1/machines/{machine_id}/channel?channel=control — Machine-scoped executor control channel.
  • environment: wss://{host}/v1/environments/{environment_id}/channel?channel=control — Environment-scoped executor control channel; ?channel=mcp selects the raw MCP channel.
  • control: wss://{host}/v1/executors/channel?channel=control — Deprecated alias of the machine and environment servers; executor control channel.
  • mcp: wss://{host}/v1/executors/channel?channel=mcp&session_id={session_id}&server_key={server_key} — Deprecated alias of the environment server with ?channel=mcp; raw MCP JSON-RPC channel for one environment-origin MCP server.

Endpoint domains

All 51 JSON-RPC 2.0 protocol methods organized by domain:

JSON-RPC 2.0 envelope

Every message on the control channel is a single JSON-RPC 2.0 text frame with named object params:
Request / Response
Notifications omit id and expect no reply. Requests declare x-bma-capability when gated by an advertised executor capability; calling a method whose capability was not advertised returns -32012 (capability_unavailable).

WebSocket close codes

JSON-RPC error codes

SDK implementation

Use bma-executor-sdk (Go, TypeScript, Python) rather than hand-rolling frames — it handles token refresh, heartbeats, resume, tool.result retries and typed handlers.