CreateWithAIHub

Tool x402 Foundation (Linux Foundation), originated by Coinbase

x402

Open payment standard built on HTTP 402 that lets APIs, sites and MCP servers charge clients and AI agents per request.

Agent payment protocolFreeOpen source
Visit website ↗
Save

What it is

x402 is an open protocol for paying for web resources inside the normal HTTP request flow. A server answers with 402 Payment Required and its payment terms, the client (often an AI agent) signs a payment and retries with a PAYMENT-SIGNATURE header, and a facilitator verifies and settles it, mostly in stablecoins on networks such as Base and Solana. It was started at Coinbase and is now governed by the x402 Foundation under the Linux Foundation. It is for developers who want to sell API calls, content or MCP tool calls per use without accounts or subscriptions.

What it's useful for

Charging $0.10 per call for a paid tool in an MCP server, settled in USDC to your own wallet.

Key features

  • Server middleware for Express, Hono, Fastify and Next.js, and client wrappers for fetch and axios
  • @x402/mcp package for paid tool calls in MCP servers and automatic payment in MCP clients
  • SDKs for TypeScript, Python (pip install x402) and Go
  • Payment schemes exact, upto and batch-settlement across EVM, Solana, Stellar, Aptos and other networks
  • No protocol fees; payments go straight to your wallet address
  • Apache-2.0 licensed, governed by the x402 Foundation (Linux Foundation)

How to use it

Before you start

  • A crypto wallet address to receive payments
  • Node.js, Python or Go
Express server
npm install @x402/core @x402/evm @x402/svm @x402/express
Fetch client
npm install @x402/core @x402/evm @x402/svm @x402/fetch
MCP
npm install @x402/mcp @x402/core @modelcontextprotocol/sdk
Python
pip install x402

Commands are copied from the official documentation. Check the docs for the latest version before running them.

Limitations to know

  • The public x402.org facilitator is for testnet and development; production mainnet needs a facilitator provider, your own facilitator or self-facilitation
  • Payments are mainly onchain (stablecoins); clients need a funded wallet
  • Network fees still apply, and third-party facilitators may set their own terms

Alternatives

Open standard for connecting AI applications to tools, data and workflows through servers that any MCP client can use.

FreeOpen source

Open Agent2Agent protocol that lets independent AI agents discover each other and exchange tasks, now under Linux Foundation governance.

FreeOpen source

MCP servers for this

Square's MCP server (beta) that lets AI assistants call the Square API for payments, orders, catalog, customers and more.

Free plan + paidOpen source

Stripe's hosted MCP server that lets agents search Stripe docs and read or change objects in a Stripe account.

Free

Adapty's hosted MCP server that lets agents manage mobile paywalls, products, A/B tests and read subscription analytics.

Free plan + paid

Related resources

AI Builder that turns a description into a website, web app or game, with hosting, a domain and email included.

FeaturedNewPaid

AWS's managed service for calling 100+ foundation models from Anthropic, OpenAI, Meta, Mistral, DeepSeek, Amazon and others in your AWS account.

Paid

StackBlitz's in-browser AI builder that creates websites, web apps and mobile apps from text prompts.

Free plan + paid

Anthropic's family of proprietary large language models (Opus, Sonnet, Haiku tiers) for reasoning, coding and agents.

Paid

Type to search. Use ↑ ↓ and Enter.