Skip to content
Version v0.1 (draft)
ChangelogContributing

Bindings

MCP binding

A2M exposed as MCP tools over Streamable HTTP.

The first A2M binding is an MCP server. Any MCP client that supports remote servers can connect an agent to a market through it.

  • MCP over Streamable HTTP, stateless, JSON responses.
  • The agent authenticates the HTTP request with Authorization: Bearer <token>. Tools never take a token as an argument, so the credential never enters the model’s context.
  • Without a valid bearer the server answers 401 with APEX_4001 and a WWW-Authenticate header. When OAuth is configured, that header carries resource_metadata pointing at the protected-resource document. See OAuth binding.
  • Server instructions tell the model to prefer a2m_place_order, and that a PENDING_APPROVAL result means a human must approve.
Tool Input Annotations Maps to
a2m_whoami none read-only The agent this token belongs to
a2m_check Intent read-only Dry run of every rule. Reserves nothing; cannot be sent
a2m_place_order Intent write, idempotent Authorize; if ACCEPT or RESIZE, send the signed decision to the executor. Returns the verdict and, when sent, the order. The same intent_id never creates a second order
a2m_submit_decision { decision, signature } write, idempotent Send an already signed ACCEPT or RESIZE, for example one produced by an approval
a2m_order_status { id } (client order id) read-only One of this agent’s orders, its fills and cost analysis
a2m_cancel_order { id } (client order id) write Ask the venue to cancel one of this agent’s working orders
a2m_approval_status { id } (approval id) read-only Whether a human approved or denied a PENDING_APPROVAL order

The input schema of a2m_check and a2m_place_order is the same intent object the REST API decodes, so the schema an agent sees and the one the authorizer validates cannot drift.

  • A refusal from the authorizer or executor (a REJECT, or an HTTP error such as A2M_BAD_SIGNATURE) is returned as a tool result with isError: true and the error body as text, so the model can read it and act on it. It is not an MCP protocol failure.
  • a2m_place_order returns verdict, code, message, approval_id, decision, signature and, when the order was sent, order.
  1. a2m_place_order returns PENDING_APPROVAL and an approval_id.
  2. Poll a2m_approval_status with the approval_id.
  3. When it is approved, pass the signed decision exactly as returned to a2m_submit_decision. Changing any signed field makes it fail with A2M_BAD_SIGNATURE.

The same objects are available over HTTP: GET /v1/whoami, POST /v1/check, POST /v1/authorize, GET /v1/approvals/{id}, POST /v1/orders, POST /v1/orders/{id}/cancel, GET /v1/agent/orders/{id}, GET /v1/keys. A formal REST binding document is planned.