Feature: recognise pay-per-call (x402) results from external MCP tools

Author: dhyabi2Created Sep 25, 2026Updated Sep 25, 2026

Is your feature request related to a problem? Please describe.

A Coze bot can add external MCP servers as tools and call them from a flow. More and more useful MCP tools are pay-per-call: they answer a tool call with HTTP 402 Payment Required carrying an x402 v2 challenge ({price, pay_to, accepts:[...]}) instead of tool output. When a Coze agent calls such a tool today, that raw payment_required JSON is passed straight through to the model as if it were tool output — the model sees no clear "pay this call and retry" step, so the call dead-ends even though the tool is well-formed and the price is trivial.

Describe the solution you'd like

Recognize the x402 payment_required envelope when an external-MCP tool call returns one, the way generic paid-tool clients are starting to:

  1. Detect the envelope (its price, pay_to, accepts[] scheme/network) instead of surfacing raw JSON as output.
  2. Show a confirm-and-pay step quoting the exact price and destination to the bot operator.
  3. On settlement, retry the tool call with the X-PAYMENT proof header, so the agent actually receives the tool result.

No Coze account, server-side wallet or custodial funds are involved: the payment is made by the caller and only the challenge/proof is relayed — the same shape as OAuth connection flows, which proxy credentials without holding them.

Pay-per-call suits the sporadic, low-value-per-call agent use-cases (web extraction, link checks, search) where a subscription or a card fee floor (≈2.9% + $0.30) is larger than the call itself.

Describe alternatives you've considered

  • Relying on every MCP server to offer a free tier with an API key — the pay-per-call rail is precisely for tools that do not want a subscription or account.
  • Letting the model parse the raw 402 JSON and figure out payment itself — fragile and not a first-class flow step.

Additional context

A live, working pay-per-call MCP server that answers exactly this way is running today at https://extract.paypercall.dev/mcp (server name vend): initialize returns HTTP 200; an unpaid tools/call returns payment_required with the x402 v2 challenge and a 0.0001 XNO price. Any Coze user can add it as an external MCP server right now to reproduce the gap. Its /.well-known/x402 manifest lists the endpoints.