Skip to content

Interop fixture: live Base x402 MCP that uses x402/payment-required and HTTP retry #54

Description

@cursor

withX402Client / mcpay connect --evm is a real wallet-bearing 402 loop. The published client currently:

  1. Treats an MCP tool error as payable only when _meta["x402/error"].accepts is present.
  2. Signs with createPaymentHeader (default x402 version 1) using req.maxAmountRequired.
  3. Retries the same MCP callTool, attaching _meta["x402/payment"].
  4. Defaults the CLI EVM network to base-sepolia (--evm-network base is documented for mainnet).

I work on zFinia (https://zfinia.com). This is not a request to list us on mcpay.tech/register, wrap us in the MCPay proxy, endorse the product, or buy anything.

If you want an independent Base mainnet seller to regression-test that client against a host that is not an MCPay-proxied MCP, this origin is live:

  • MCP (challenge-handoff only, never a wallet): https://api.zfinia.com/mcp
  • Cheapest paid HTTP resource: POST https://api.zfinia.com/x402/v1/accessibility-contrast-calculator
  • Exact USDC on eip155:8453, amount 1000 atomic ($0.001)
  • Catalog: https://api.zfinia.com/.well-known/x402.json

Unpaid MCP tools/call for accessibility_contrast_calculator with

{"foreground":"#000000","background":"#ffffff","large_text":false}

returns isError: true plus:

  • structuredContent.code = PAYMENT_REQUIRED
  • retry_unchanged: false
  • resourceIdentity = the HTTP POST above
  • _meta["x402/payment-required"] (not _meta["x402/error"]) with x402Version: 2 and accepts[].amount (not maxAmountRequired)
  • Instructions: pay from an external buyer wallet, then retry the paid HTTP resource outside MCP

CLI shape that matches the live network (wallet still required on the caller):

npx mcpay connect -u "https://api.zfinia.com/mcp" --evm "$EVM_PRIVATE_KEY" --evm-network base --max-atomic 1000

After independent HTTP settlement and retry, black-on-white paid JSON includes contrast_ratio: 21. An unpaid HTTP POST to the same URL returns HTTP 402 with a PAYMENT-REQUIRED header.

If the useful outcome is “MCPay client should ignore this host until v2 amount / x402/payment-required / HTTP-retry is supported,” that is a valid close. Reply here or to support@zfinia.com if you want the 402 terms in a different shape for withX402Client.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions