MCP binding
The orchestrator speaks Model Context Protocol over a single JSON-RPC 2.0 endpoint, so an agent can drive the whole cart-to-checkout lifecycle as tool calls instead of hand-rolling REST.
POST /api/v1/mcp/message
Everything on this page runs through the same OrchestratorFacade as the REST and A2A surfaces: identical policy, idempotency, provider calls, and metrics. MCP is a transport, not a second implementation.
Transport
| Property | Value |
|---|---|
| Endpoint | POST /api/v1/mcp/message (advertised as orchestrator.mcp_endpoint in /.well-known/ucp; this is the orchestrator’s own tool server. UCP’s MCP binding is at /api/v1/ucp/mcp and ACP’s at /api/v1/acp/mcp, see UCP’s and ACP’s sections) |
| Payload | JSON-RPC 2.0 request object (jsonrpc, id, method, params) |
| Auth | Same as every other API route: Authorization: Bearer <token> |
| Version header | MCP-Protocol-Version |
Request headers (2026-07-28) | Mcp-Method on every request; Mcp-Name on tools/call, resources/read and prompts/get |
| Browser origins | An Origin header, when sent, must be listed in MCP_ALLOWED_ORIGINS |
| Content type | application/json |
GET / DELETE | 405 Method Not Allowed (no SSE stream, no sessions) |
There is no SSE or stdio transport. One request, one response.
Streamable HTTP rules
Every MCP endpoint the orchestrator serves (/api/v1/mcp/message, /api/v1/ucp/mcp, /api/v1/acp/mcp) applies the MCP 2026-07-28 Streamable HTTP rules through one shared check, before authentication and before the endpoint reads the message.
flowchart TD
P[POST] --> O{Origin header?}
O -->|absent| V
O -->|listed in MCP_ALLOWED_ORIGINS| V
O -->|anything else| F["403, JSON-RPC error without id"]
V{MCP-Protocol-Version} -->|unsupported value| U["400, -32022 supported / requested"]
V -->|absent, but _meta names a version| H["400, -32020"]
V -->|absent, 2025-11-25 or 2024-11-05| L[Legacy: served as before]
V -->|2026-07-28| M{"Mcp-Method = body method?<br/>Mcp-Name = params.name / uri?<br/>header = _meta version?"}
M -->|no| H
M -->|yes| D[Dispatch]
D --> R["result: resultType, ttlMs, cacheScope<br/>unknown method: 404, -32601<br/>notification: 202, no body"]
Origin (DNS-rebinding protection). A request without an Origin header is served: agents calling from servers send none, and refusing them would break every non-browser client. A request with an Origin is served only when that origin is listed in MCP_ALLOWED_ORIGINS (comma-separated scheme://host[:port], compared after lower-casing and dropping default ports). The default list is empty, so a web page that gets a browser to call a local or internal deployment is refused with 403. Same-origin is not accepted implicitly: under DNS rebinding the attacker’s page and the Host header carry the same attacker-controlled name, so only an explicit list protects. List the origins of browser-based clients (the MCP Inspector runs at http://localhost:6274), or set MCP_ALLOWED_ORIGINS=* when a gateway in front already enforces an origin policy.
Headers. Under 2026-07-28:
MCP-Protocol-Versionmust be a supported version (else400,-32022, withdata.supportedanddata.requested) and must matchparams._meta["io.modelcontextprotocol/protocolVersion"]when that is present (else400,-32020). A body that names a version in_metawithout sending the header is also400,-32020.Mcp-Methodmust equal the body’smethodon every request.Mcp-Namemust equalparams.namefortools/callandprompts/get, andparams.uriforresources/read. Values in the=?base64?…?=form are decoded before comparing.- A missing or different value is
400with-32020(HeaderMismatch), answering the request’sid. The revision does not define headers for notifications, so a notification is held only to the headers it sends.
Responses. Under 2026-07-28 an unknown method is HTTP 404 with -32601; every result carries resultType: "complete"; server/discover, tools/list and the other list methods carry ttlMs: 300000 and cacheScope: "private" (results depend on the caller’s credentials), and resources/read carries ttlMs: 0. Notifications get 202 with no body. No Mcp-Session-Id is issued, and one sent by a client is ignored.
Back-compat. A request whose MCP-Protocol-Version is 2025-11-25 or 2024-11-05, or that carries no version at all (clients older than 2025-06-18, which the spec lets a server treat as legacy), is served exactly as before: no Mcp-Method/Mcp-Name requirement, unknown methods stay HTTP 200, results are not decorated, and initialize works. Only the Origin check applies to every client.
Authentication and tenancy
The bearer token resolves to an AuthContext (caller, tenant, scopes) before dispatch. Tool arguments never carry tenancy: a tenant_id in a tool call is used for lookups scoped to the caller’s own tenant, never to cross into another one. execute_checkout additionally requires the checkout:execute scope.
Signatures
If the deployment configures agent keys (UCP_AGENT_JWKS or UCP_AGENT_KEYS), requests to /api/v1 — including /api/v1/mcp/message — must carry valid RFC 9421 Signature-Input/Signature headers and a matching Content-Digest, and responses are signed back. See message signing.
Version negotiation
The server is dual-era: it supports the modern discovery handshake and the legacy initialize handshake at once.
| Version | Era | Handshake |
|---|---|---|
2026-07-28 | modern | server/discover, then a version on every request |
2025-11-25 | legacy | initialize |
2024-11-05 | legacy | initialize |
Modern clients declare the version per request, either as the MCP-Protocol-Version header or in params._meta:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": { "name": "my-agent", "version": "1.0" }
}
}
}
Rules the server enforces (the header checks are in Streamable HTTP rules):
- If both the header and
_metacarry a version and they disagree, the request is rejected with HTTP400,-32020. - An unsupported version returns HTTP
400,-32022withdata.supportedlisting what is accepted, anddata.requestedechoing what you sent. - Under
2026-07-28, every result carries_metawithio.modelcontextprotocol/serverInfoandio.modelcontextprotocol/protocolVersion. - Under
2026-07-28,initializeis rejected with-32601: callserver/discoverinstead. - A request with no version at all is treated as
2024-11-05for backward compatibility, exceptserver/discover, which implies the modern version.
flowchart TD
R[Request] --> V{Version declared?}
V -->|header or _meta| S{Supported?}
V -->|no, server/discover| M[2026-07-28]
V -->|no, anything else| L[2024-11-05]
S -->|yes| U[Use it]
S -->|no| E["-32022 with supported list"]
U --> C{header vs _meta agree?}
C -->|no| E2["400, -32020"]
C -->|yes| D[Dispatch]
Methods
| Method | Purpose |
|---|---|
server/discover | Modern handshake: supported versions, capabilities, server info |
initialize | Legacy handshake; rejected under 2026-07-28 |
notifications/initialized | Legacy no-op acknowledgement |
tools/list | Tool catalogue with JSON Schema inputs |
tools/call | Invoke a tool by name with arguments |
resources/list | Readable resource URI templates |
resources/read | Read one resource by uri |
Tools
Seventeen tools cover the lifecycle. Every one maps to a facade operation that the REST API also exposes.
Cart
| Tool | Required arguments | Notes |
|---|---|---|
create_cart | merchant_id, currency | Tenancy comes from the bearer token |
add_item | cart_id, item_id, quantity | |
update_item_qty | cart_id, line_id, quantity | |
remove_item | cart_id, line_id | |
apply_adjustment | cart_id, code | Priced by your pricing provider; an unknown code changes nothing |
set_fulfillment_selection | cart_id, method_type, destination | Quotes options, and selects one if selected_option_id is given |
get_cart | cart_id |
Checkout and orders
| Tool | Required arguments |
|---|---|
start_checkout | cart_id, cart_version |
execute_checkout | tenant_id, merchant_id, cart_id, cart_version, currency, payment_intent, idempotency_key |
get_order | order_id |
list_orders | tenant_id |
MPP payments on execute_checkout
With MPP_CHALLENGE_SECRET set, an execute_checkout call whose payment_intent.payment_method_type is mpp is paid through the MPP MCP transport, the JSON-RPC form of the Payment authentication scheme the REST checkout uses (consumption guide):
-
Call without a credential. The answer is HTTP
200with JSON-RPC error-32042Payment Required:{ "jsonrpc": "2.0", "id": 9, "error": { "code": -32042, "message": "Payment Required", "data": { "httpStatus": 402, "challenges": [{ "id": "…", "realm": "shop.example.com", "method": "tempo", "intent": "charge", "request": "<base64url JSON>", "expires": "2026-12-01T12:05:00Z", "digest": "sha-256=:…:", "opaque": "…" }], "problem": { "type": "https://paymentauth.org/problems/payment-required", "title": "Payment Required", "status": 402, "detail": "…" } } } }requestdecodes to{"amount": "<amount_minor>", "currency": "<lowercase ISO 4217>"}.digestis the RFC 9530 digest of the JCS-canonical (RFC 8785)argumentsobject, so the retry must send the same arguments. -
Pay, then call again with the same
argumentsand the credential as a JSON object inparams._meta["org.paymentauth/credential"]:{ "challenge": { …echoed… }, "payload": { …method-specific proof… }, "source": "…" }. -
On success the result is the transaction result with
_meta["org.paymentauth/receipt"]:{ "status": "success", "method", "timestamp", "reference", "challengeId" }. Under2026-07-28it sits beside the server’s own_metakeys.
The credential is checked and claimed exactly as over HTTP, then handed to the payment provider base64url-encoded in token_or_reference, the same bytes a REST Payment-Authorization credential carries. Refusals carry a fresh challenge:
| Code | Problem type (under https://paymentauth.org/problems/) | Cause |
|---|---|---|
-32042 | malformed-credential | The _meta credential is not the draft’s JSON shape |
-32042 | invalid-challenge | Not issued by this deployment for these arguments, edited (amount, realm, …), or already used |
-32042 | payment-expired | The challenge’s expires has passed |
-32043 | verification-failed | The payment provider did not accept the proof (Payment Verification Failed) |
Other tools, other payment methods and deployments without MPP_CHALLENGE_SECRET are not challenged, and a _meta credential sent to them is ignored. server/discover and tools/list do not advertise MPP, because no MPP MCP transport source defines a key for it; the -32042 challenge is the signal. UCP’s and ACP’s MCP bindings do not take MPP: their complete_checkout tools pay through the protocol’s own payment handlers, and neither protocol defines an MPP handler.
sequenceDiagram
participant Agent
participant Orchestrator
participant PSP as Payment provider
Agent->>Orchestrator: tools/call execute_checkout (payment_method_type=mpp)
Orchestrator-->>Agent: error -32042, data.challenges (bound to the arguments)
Agent->>Agent: pay with the method, build credential
Agent->>Orchestrator: same arguments + _meta org.paymentauth/credential
Orchestrator->>Orchestrator: verify binding, expiry and digest, then claim the id once
Orchestrator->>PSP: authorize (credential as token_or_reference)
alt proof accepted
Orchestrator-->>Agent: result + _meta org.paymentauth/receipt
else proof refused
Orchestrator-->>Agent: error -32043 + fresh challenge
end
Payments
capture_payment, void_payment, and refund_payment all take tenant_id, merchant_id, transaction_id, amount_minor, idempotency_key and return { success, reference }.
Catalog
lookup_catalog_item (item_id), lookup_catalog_items (item_ids), and search_catalog_items (optional query).
Fulfillment selection
set_fulfillment_selection covers the UCP dev.ucp.shopping.fulfillment extension. It takes the same flat destination shape as POST /api/v1/ucp/cart/:id/fulfillment, so an agent learns one contract for both transports.
Omit selected_option_id to quote without committing:
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "set_fulfillment_selection",
"arguments": {
"cart_id": "6f1c…",
"method_type": "shipping",
"destination": {
"id": "dest_1",
"street_address": "1 Market St",
"address_locality": "San Francisco",
"address_region": "CA",
"address_country": "US",
"postal_code": "94105"
}
}
}
}
The result is the cart projection; quoted options live under fulfillment.methods[].groups[].options[], and fulfillment_minor stays 0 until something is selected. Call again with selected_option_id to commit, which adds the option’s amount to the cart total and triggers a reprice and geo re-check against the new destination.
For pickup, send "method_type": "pickup" and include name on the destination for the retail location.
selected_option_id must be an id the merchant actually quoted for this cart. Anything else is an error — an agent cannot invent a shipping price.
Resources
| URI template | Content |
|---|---|
order://{id} | Order as JSON |
cart://{id} | Cart projection as JSON |
resources/read returns contents[0].text holding the JSON document, with mimeType: application/json.
Errors
Tool and dispatch failures come back as JSON-RPC errors with HTTP 200; transport-rule failures carry their own HTTP status.
| HTTP | Code | Meaning |
|---|---|---|
404 (2026-07-28), 200 (legacy) | -32601 | Unknown method, or initialize under 2026-07-28 |
400 | -32020 | A required header (MCP-Protocol-Version, Mcp-Method, Mcp-Name) is missing or disagrees with the body |
400 | -32022 | Unsupported protocol version; data.supported lists what works |
403 | -32600 | Origin not allowed (the error has no id) |
400 | -32700 / -32600 | Body is not JSON / not a JSON-RPC request |
200 | -32603 | Tool failure: unknown tool, missing argument, or a facade error such as a rejected fulfillment option or a failed provider call |
200 | -32042 / -32043 | MPP payment required / payment verification failed on execute_checkout (MPP payments) |
Other transport-level problems (a missing or invalid bearer token, a missing or stale signature) are ordinary HTTP errors and never reach the JSON-RPC layer.
Observability
Every message records orchestrator_operation_calls_total{operation="mcp_tool_call"} and the matching latency histogram, split by success/error, plus a per-tool counter and a counter for the negotiated protocol version. Unsupported version requests increment mcp_version_unsupported_total.
MPP on execute_checkout counts the shared mpp_challenge_issued_total, mpp_receipt_issued_total and mpp_credential_rejected_<problem>_total, and the same counters with an mpp_mcp_ prefix for this transport alone; orchestrator_operation_calls_total{operation="mpp_mcp_credential_check"} and its histogram time the credential check, split by accepted/challenged/error.
Requests refused by the Streamable HTTP rules, on any MCP endpoint, increment mcp_transport_rejected_<reason>_total with reason origin, unsupported_protocol_version or header_mismatch.
MCP registry metadata
server.json at the repository root describes this server in the format of the MCP Registry (schema 2025-12-11), as io.github.AncientiCe/commerce-orchestrator:
- OCI package: the published image
ghcr.io/ancientice/commerce-orchestrator-api, reached athttp://localhost:8080/api/v1/mcp/messageonce it runs. Without configuration it starts in development mode against mock providers. The image carries theio.modelcontextprotocol.server.namelabel the registry uses to check ownership. - Remote:
https://{orchestrator_host}/api/v1/mcp/messagewith a bearer token, because every merchant runs its own deployment and there is no shared hosted endpoint.
The registry lists the transport as streamable-http: one POST, one application/json response, and 405 for GET and DELETE, following the Streamable HTTP rules. The OCI package lists MCP_ALLOWED_ORIGINS for clients that run in a browser.
UCP’s MCP binding
UCP defines its own MCP transport for the shopping service (services/shopping/mcp.openrpc.json). The orchestrator serves it on a separate endpoint:
POST /api/v1/ucp/mcp
It is separate because both servers define create_cart, get_cart and get_order with different arguments. A UCP platform finds it in /.well-known/ucp:
"dev.ucp.shopping": [
{ "version": "2026-08-25", "transport": "rest", "endpoint": "https://orchestrator.example.com/api/v1/ucp", ... },
{
"version": "2026-08-25",
"spec": "https://ucp.dev/2026-08-25/specification/overview",
"transport": "mcp",
"schema": "https://ucp.dev/2026-08-25/services/shopping/mcp.openrpc.json",
"endpoint": "https://orchestrator.example.com/api/v1/ucp/mcp"
}
]
Tools run the same code as the UCP REST binding (/api/v1/ucp/*), so a checkout created over MCP can be read over REST and vice versa. Auth, tenancy and RFC 9421 signatures work as on every other /api/v1 route.
sequenceDiagram
participant Agent as UCP platform (MCP client)
participant MCP as POST /api/v1/ucp/mcp
participant Core as run_ucp_* (shared with REST)
participant Facade as OrchestratorFacade
Agent->>MCP: tools/call create_checkout {meta, checkout}
MCP->>MCP: meta.ucp-agent.profile is a URL?
opt UCP_PROFILE_NEGOTIATION lenient or strict
MCP->>MCP: fetch or reuse platform profile, intersect capabilities
end
MCP->>Core: run_ucp_create_checkout
Core->>Facade: create cart, add lines, start checkout
Facade-->>Core: projection
Core-->>MCP: UCP checkout
MCP-->>Agent: result {structuredContent: checkout, content: [text]}
Agent->>MCP: tools/call complete_checkout {meta + idempotency-key, id, checkout.payment}
MCP->>Facade: execute_checkout (key = idempotency-key)
Facade-->>MCP: transaction + order
MCP-->>Agent: checkout {status: completed, order {id, permalink_url}}
Tools
tools/list is generated from the official OpenRPC file: each tool’s inputSchema is the method’s params (with the meta schema inlined) and its outputSchema is the method’s result schema.
| Tool | Arguments | Result |
|---|---|---|
create_checkout | meta, checkout (currency, line_items[]; optional merchant_id, see below) | Checkout (ready_for_complete when it has lines) |
get_checkout | meta, id | Checkout |
update_checkout | meta, id, checkout (full replacement of line_items[]; lines keep their id) | Checkout |
complete_checkout | meta with idempotency-key, id, checkout.payment.instruments[0] (handler_id, credential.token), optional checkout.buyer | Checkout with status: completed and order { id, permalink_url } |
cancel_checkout | meta with idempotency-key, id | Checkout with status: canceled |
create_cart | meta, cart (currency, line_items[]; optional merchant_id) | Cart |
get_cart | meta, id | Cart |
update_cart | meta, id, cart | Cart |
cancel_cart | meta with idempotency-key, id | Cart with status: canceled |
get_order | meta, id | Order |
search_catalog | meta, catalog (query, optional context.currency) | Search response: products[] |
lookup_catalog | meta, catalog (ids[], optional context.currency) | Lookup response: products[], each variant with inputs[]; ids that match nothing are not_found warnings in messages[] |
get_product | meta, catalog (id, optional context.currency) | product, or a not_found error response |
Merchant. UCP has no merchant field, so a cart or checkout is created for the body’s merchant_id when it has one (an orchestrator extension), else for UCP_DEFAULT_MERCHANT_ID. With neither, the result is a UCP error response with code merchant_required (REST: 400 MERCHANT_REQUIRED).
Catalog currency. Each catalog item becomes a UCP product with one variant whose price is the item’s minor-unit amount. The catalog provider returns no currency, so prices are given in the request’s context.currency when present, else UCP_CATALOG_CURRENCY. With neither, the result is a UCP error response with code currency_required; a context.currency that is not a three-letter code gets invalid_currency. Search filters and pagination are not applied: every match is returned.
Every request carries meta:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "complete_checkout",
"arguments": {
"meta": {
"ucp-agent": { "profile": "https://platform.example/profiles/shopping-agent.json" },
"idempotency-key": "550e8400-e29b-41d4-a716-446655440000"
},
"id": "6d1f3c6e-8a5e-4a43-9a43-6a1d3f1f2b10",
"checkout": {
"payment": {
"instruments": [{
"id": "pi_1", "handler_id": "card", "type": "card",
"credential": { "type": "token", "token": "tok_visa" }
}]
}
}
}
}
}
With UCP_PROFILE_NEGOTIATION set to lenient or strict, the platform profile is fetched (HTTPS only), cached, and negotiated exactly as on the REST binding: the result’s ucp.capabilities lists only capabilities in the intersection. With the default off, the profile URL is checked for shape only and not fetched. See Platform profile negotiation.
Results
A result holds the UCP payload twice: as structuredContent, and serialized as content[0].text for clients without structured content.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"structuredContent": { "ucp": { "version": "2026-08-25", ... }, "id": "...", "status": "completed", "order": { ... } },
"content": [{ "type": "text", "text": "{\"ucp\":{...},...}" }]
}
}
Idempotency
complete_checkout, cancel_checkout and cancel_cart require meta["idempotency-key"], a UUID.
- Retrying
complete_checkoutwith the same key returns the first outcome; the payment is not taken twice. - Using a key already spent on another checkout is a conflict: HTTP
409,-32000. - Cancelling something already canceled returns it unchanged.
Errors
| Situation | Response |
|---|---|
| Unknown checkout, cart or order | Result; structuredContent is a UCP error response: ucp.status: error, messages[0].code: not_found, severity: unrecoverable |
| Validation or payment failure | Result with a UCP error response, severity: recoverable (payment_failed, validation_error, …) |
meta["ucp-agent"].profile missing or not a URL | HTTP 400, -32001, data.code: invalid_profile_url |
| Negotiation enabled, profile not HTTPS or resolving to a private address | HTTP 400, -32001, data.code: invalid_profile_url (strict only) |
| Negotiation enabled, profile cannot be fetched | HTTP 424, -32001, data.code: profile_unreachable (strict only) |
| Negotiation enabled, profile is not a valid platform profile | HTTP 422, -32001, data.code: profile_malformed (strict only) |
Negotiation enabled, platform’s ucp.version not supported | HTTP 422, -32001, data.code: version_unsupported (strict only) |
| Negotiation enabled, the tool’s capability is not in the intersection | Result; structuredContent is a UCP error response with code: capabilities_incompatible (strict only) |
| Missing argument, missing or non-UUID idempotency key, unknown tool | -32602 |
| No or invalid bearer token | HTTP 401, -32000 |
| Another tenant’s cart, checkout or order | HTTP 403, -32000, data.code: TENANT_MISMATCH (FORBIDDEN for orders) |
| Idempotency key reused for another checkout | HTTP 409, -32000, data.code: IDEMPOTENCY_CONFLICT |
| Server or provider fault | HTTP 5xx, -32603 |
| Unknown method | -32601 (HTTP 404 under 2026-07-28) |
Unsupported MCP-Protocol-Version header | HTTP 400, -32022, data.supported |
Missing or mismatched Mcp-Method, Mcp-Name or version header | HTTP 400, -32020 |
Lifecycle
initialize answers with the requested protocolVersion when it is one of 2026-07-28, 2025-11-25, 2024-11-05 (else 2025-11-25); ping, server/discover, tools/list and tools/call work without it. Notifications such as notifications/initialized get HTTP 202 with no body. Responses are single JSON bodies; there is no SSE stream. The Streamable HTTP rules (Origin, Mcp-Method, Mcp-Name) apply as on the native endpoint.
Metrics
Each tool call records orchestrator_operation_calls_total and orchestrator_operation_latency_seconds with operation="ucp_mcp_<tool>" and status set to success or the error kind (not_found, tenant_mismatch, invalid_params, invalid_profile_url, profile_unreachable, version_unsupported, idempotency_conflict, …). Negotiation itself is recorded as operation="ucp_negotiation_mcp" (see the consumption guide). Counters ucp_mcp_tools_list_total, ucp_mcp_initialize_total, ucp_mcp_idempotency_conflict_total, ucp_mcp_parse_error_total and the shared mcp_transport_rejected_<reason>_total cover the rest. Tool calls also increment the same ucp_cart_* / ucp_checkout_* / ucp_order_* counters as the REST binding.
ACP’s MCP binding
ACP 2026-04-17 defines an MCP transport for checkout (spec/2026-04-17/openrpc/openrpc.agentic_checkout.json, binding). The orchestrator serves it on its own endpoint:
POST /api/v1/acp/mcp
It is separate from the native and UCP servers because ACP has its own error model (every ACP error is -32000 with the ACP Error object in data) and an ACP agent should see exactly the five ACP tools. ACP passes the endpoint URL out of band: /.well-known/acp.json lists "transports": ["rest", "mcp"] but carries no URL, so give agents https://<host>/api/v1/acp/mcp.
The tools run the same run_acp_* code as the ACP REST binding (/api/v1/acp/checkout_sessions, which takes the same 2026-04-17 bodies), so a session created over MCP can be read over REST. Auth, tenancy, RFC 9421 signatures and the Streamable HTTP rules work as on every other MCP endpoint.
sequenceDiagram
participant Agent as ACP agent (MCP client)
participant MCP as POST /api/v1/acp/mcp
participant Core as run_acp_* (shared with REST)
participant Facade as OrchestratorFacade
Agent->>MCP: tools/call create_checkout_session {meta.api_version, payload}
MCP->>MCP: api_version supported? payload valid against the ACP schema?
MCP->>Core: run_acp_create_session
Core->>Facade: create cart, add items
Facade-->>MCP: projection
MCP-->>Agent: result = CheckoutSession (+ structuredContent, content)
Agent->>MCP: tools/call complete_checkout_session {meta.idempotency_key, id, payload.payment_data}
MCP->>Core: run_acp_complete_session (start checkout if draft)
Core->>Facade: execute_checkout (key = idempotency_key)
Facade-->>MCP: transaction + order
MCP-->>Agent: CheckoutSessionWithOrder {status: completed, order}
Tools
tools/list is generated from the official OpenRPC file. Each tool’s inputSchema holds meta, id and payload as the OpenRPC params define them, with every referenced ACP schema bundled into the tool’s own $defs (the binding requires $ref targets to be resolved), and its outputSchema is the method’s result schema.
| Tool | Arguments | Result |
|---|---|---|
create_checkout_session | meta, payload (CheckoutSessionCreateRequest: currency, line_items[] of { id }, capabilities) | CheckoutSession |
get_checkout_session | meta, id | CheckoutSession |
update_checkout_session | meta, id, payload (CheckoutSessionUpdateRequest; line_items[] replaces the session’s items) | CheckoutSession |
complete_checkout_session | meta, id, payload (CheckoutSessionCompleteRequest: payment_data.handler_id, payment_data.instrument.credential.token, optional buyer) | CheckoutSessionWithOrder (status: completed, order { id, checkout_session_id, permalink_url }) |
cancel_checkout_session | meta, id, optional payload (CancelSessionRequest) | CheckoutSession with status: canceled |
ACP’s delegate payment API is out of scope for the binding (the ACP spec leaves it to a later proposal); it stays on REST at /api/v1/acp/delegate_payment.
meta. meta.api_version (the API-Version header) is required and must be 2026-04-17. meta.idempotency_key keys complete_checkout_session. Other meta fields are accepted and ignored, except merchant_id, below.
Merchant. ACP payloads name no merchant, so a session belongs to meta.merchant_id when sent, else to UCP_DEFAULT_MERCHANT_ID. With neither, the call fails with merchant_required.
Items. An ACP Item carries no quantity: each line_items[] entry is one unit, so [{ "id": "sku-1" }, { "id": "sku-1" }] is a line with quantity 2. Fields of the payload the orchestrator has no backend for (fulfillment_details, selected_fulfillment_options, discounts, intent_trace, …) are validated and then ignored. Purchase-order payments (payment_data.purchase_order_number) are refused with unsupported_payment_method.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "create_checkout_session",
"arguments": {
"meta": { "api_version": "2026-04-17", "idempotency_key": "idem_1" },
"payload": { "currency": "usd", "line_items": [{ "id": "demo-tee" }], "capabilities": {} }
}
}
}
Results
ACP returns the CheckoutSession itself as the JSON-RPC result. MCP clients read tool output from structuredContent and content[], so the result carries both views as well:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "cs_...", "protocol": { "version": "2026-04-17" }, "status": "ready_for_payment",
"currency": "usd", "line_items": [...], "totals": [...], "capabilities": {},
"fulfillment_options": [], "messages": [], "links": [],
"structuredContent": { "id": "cs_...", ... },
"content": [{ "type": "text", "text": "{\"id\":\"cs_...\",...}" }]
}
}
Without the two MCP members the result validates against ACP’s CheckoutSession / CheckoutSessionWithOrder schema, and structuredContent always does. A session with items is ready_for_payment (complete starts checkout itself), one without is not_ready_for_payment.
Idempotency
complete_checkout_sessionreplays its first outcome for the samemeta.idempotency_key; the payment is not taken twice.- Without a key the session itself is the key (a session can be paid for once), so a retried complete still replays.
- A key already spent on another session is
invalid_request/idempotency_conflict. - Cancelling a canceled session is
invalid_request/session_not_cancelable(REST answers405).
Errors
| Situation | Response |
|---|---|
| Unknown or malformed session id | -32000, data.type: invalid_request, data.code: session_not_found, data.param: $.id |
| Payload that breaks the ACP schema | -32000, invalid_request, invalid_payload, data.param a JSONPath into $.payload |
Missing or unsupported meta.api_version | -32000, invalid_request, missing_api_version / unsupported_api_version with data.supported_versions |
| No merchant | -32000, invalid_request, merchant_required |
| Another tenant’s session | -32000, invalid_request, forbidden |
| Session already canceled | -32000, invalid_request, session_not_cancelable |
| Idempotency key spent on another session | -32000, invalid_request, idempotency_conflict |
| Declined payment | -32000, processing_error, payment_declined |
| Provider unavailable / server fault | -32000, service_unavailable / processing_error |
Missing meta, id or payload argument, unknown tool | -32602 |
| No or invalid bearer token | HTTP 401 from the MCP server, outside the ACP error model |
data is always a valid ACP Error (type, code, message, optional param), and the JSON-RPC message repeats data.message.
Metrics
Each tool call records orchestrator_operation_calls_total and orchestrator_operation_latency_seconds with operation="acp_mcp_<tool>" and status set to success or the ACP error code (session_not_found, invalid_payload, forbidden, idempotency_conflict, …; invalid_params for malformed calls). Counters acp_mcp_tools_list_total, acp_mcp_initialize_total and acp_mcp_parse_error_total cover the rest, and tool calls increment the same acp_checkout_session_*_total counters as the REST binding.
See also
- Consumption guide — REST shapes, config, message signing
- Consumer integration — auth and client setup
- Conformance matrix — protocol coverage and gaps