Skip to main content
Discover services and the buyer quickstart cover finding and paying for services over HTTP. If your agent speaks Model Context Protocol instead, it can do both jobs as tool calls: search CDP’s hosted Bazaar MCP server for a service, then pay for it through the same x402 loop, carried in MCP’s wire format rather than HTTP headers.

Discover with the Bazaar MCP server

The Bazaar exposes an MCP server so any MCP-compatible agent can search and call paid x402 endpoints:
Discovery is public. The endpoint is unauthenticated, so no CDP API key is required to connect or search. It exposes three tools: Searching is free. Only proxy_tool_call against a paid resource triggers a payment, and it does so with the standard x402 MCP transport rather than a Bazaar-specific mechanism, so the client setup below covers it.

The payment loop over MCP

The full wire-level detail lives in the x402 Foundation’s MCP transport spec; this is the short version:
  1. The client calls a paid tool with no payment attached.
  2. The server returns a tool result with isError: true and a PaymentRequired payload — MCP’s equivalent of an HTTP 402 status and PAYMENT-REQUIRED header.
  3. The client builds a payment payload and retries the same tool call, this time with it attached at _meta["x402/payment"] — MCP’s equivalent of PAYMENT-SIGNATURE.
  4. The server verifies and settles the payment, then returns the tool’s real result with settlement info attached at _meta["x402/payment-response"] — MCP’s equivalent of PAYMENT-RESPONSE.

Pay for tool calls

Wrap your MCP client so this loop runs transparently around tool calls, paired with a CDP-managed wallet — no private keys or manual scheme registration. The same wrapped client works against any x402 MCP server, including the Bazaar’s proxy_tool_call.
@x402/mcp’s wrapMCPClientWithPayment wraps any MCP SDK Client; every other method stays a direct passthrough. CdpX402Client from the CDP SDK provisions its wallet lazily and signs payments automatically.
Full runnable version, including wallet funding and a payment-approval hook: clients/mcp/simple.ts.

Reference

For exact signatures and every configuration option, see the generated SDK reference. Want a wallet bundled in rather than bringing your own? See Agentic Wallet. Building on AWS Bedrock AgentCore? Its “Coinbase x402 Bazaar” Gateway target wires up this same endpoint — see AgentCore (AWS). Building the other side of this exchange, a paid MCP tool? See Charge over MCP.