MCP and x402 Interoperability

A machine-first purchase flow that keeps discovery and quoting free while charging only for deterministic execution.

Public MCP transport

The stateless Streamable HTTP endpoint is https://agent-economy.kgninja.dev/mcp. A client can call tools/list without authentication. The free tools are describe_verify_evidence, quote_verify_evidence, and prepare_verify_evidence_purchase. The paid tool is verify_evidence.

Paid tool sequence

  1. Call verify_evidence with a unique idempotency key and complete request.
  2. An unpaid call returns an MCP tool error whose _meta["x402/error"] contains an x402 v2 PaymentRequired document.
  3. Validate the scheme, CAIP-2 network, asset contract, atomic amount, receiving address, expiry, and Bazaar metadata against local policy.
  4. Sign a supported requirement with an x402-capable client.
  5. Retry the identical tool call with the encoded payment in _meta["x402/payment"].
  6. Preserve _meta["x402/payment-response"] and verify the signed evidence.

The HTTP route https://agent-economy.kgninja.dev/verify-evidence can create its own quote and return PAYMENT-REQUIRED directly; the paid retry recovers that quote from the signed payment payload. Calling https://agent-economy.kgninja.dev/quote first remains available for explicit economic preflight. Both modes use the equivalent PAYMENT-SIGNATURE and PAYMENT-RESPONSE headers.

Discovery surfaces

The x402 Bazaar extension is present in live payment requirements. Bazaar indexing is controlled by the ecosystem facilitator and occurs only after a successful settled payment; publishing metadata alone is not a claim that indexing has occurred.

A2A quote preparation

The A2A 1.0 JSON-RPC endpoint implements synchronous SendMessage. Send Content-Type: application/json and A2A-Version: 1.0, with exactly one structured data part containing idempotency_key and the same verification request used by HTTP or MCP. Repeating the same idempotency key and request reuses the quote. The response is a direct agent Message containing the validated quote and exact purchase instructions. It does not authorize payment or execute paid work; the calling agent must independently evaluate and satisfy the later x402 challenge.

This adapter deliberately creates no A2A Task records. ListTasks therefore returns an empty collection, while GetTask, CancelTask, and a SendMessage containing taskId return TaskNotFoundError. Streaming, push notifications, and extended Agent Cards are declared unsupported and return the corresponding A2A capability errors instead of pretending those features exist.

Browser agents

The landing page loads a same-origin, feature-detected WebMCP bridge. In browsers that expose document.modelContext or navigator.modelContext, it maps the live MCP tools/list result to browser tools and proxies calls back to the same MCP endpoint. In other browsers it is a safe no-op.