X402

Finance and commerce

DEPRECATED: no live endpoint (api.x402.org does not resolve).

Your AI app calls the X402 MCP server, which does the finance and commerce work and sends the result back to the chat.

About X402

X402 is a community MCP server from codespar, filed in our directory under finance and commerce. DEPRECATED: no live endpoint (api.x402.org does not resolve).

X402 runs on your own machine: your AI app starts it with the command npx -y @codespar/mcp-x402@0.1.5 and talks to it over standard input and output. It needs X402_API_KEY set before X402 starts.

X402 is listed in the official MCP registry as io.github.codespar/mcp-x402, version 0.1.5.

At a glance

Publisher
codespar (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @codespar/mcp-x402
Written in
TypeScript
License
MIT
GitHub stars
278
Official MCP registry
io.github.codespar/mcp-x402

How to set up X402

  1. Install Node.js on the machine that runs your AI app, because X402 starts with npx and downloads its package on first run.
  2. Create X402_API_KEY for X402 in the connected service's own settings, scoped to the smallest permissions the job needs.
  3. Add X402 to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the X402 tools to confirm the connection.
  5. Run one read-only task with X402 first, and keep your app asking before each tool call until the results look right.

X402 compared with similar servers

  • Xero (codespar) by codespar has fewer GitHub stars than X402 (278 against 278); both are community servers, and both run locally.
  • Worldpay by codespar has fewer GitHub stars than X402 (278 against 278); both are community servers, and both run locally.
  • Z API by codespar has fewer GitHub stars than X402 (278 against 278); both are community servers, and both run locally.

Before you connect X402

  • Give X402 its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each X402 tool call until you trust what it does with them.
  • Treat text that X402 fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for X402 on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for X402

How marketing and sales teams put X402 to work, by company size. Pick the size closest to yours and start X402 on one use case.

Small business

  • A small business can ask X402 which products and customers drive margin, then plan promotions around them.
  • Owners can use X402 to check refunds, failed payments and churn reasons without opening three dashboards.
  • X402 runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Ecommerce teams can connect X402 to tie campaigns to orders and revenue, not just clicks.
  • Marketing and finance can use X402 to check spend against budget each week and move money to what's working.
  • Start X402 on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should keep X402 read-only for agents, with any money movement handled by people and existing approvals.
  • Large commerce teams can use X402 to answer revenue questions by channel and region with figures finance signs off on.
  • X402 is a community server, so have security review the code and pin a version before X402 touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

X402 README

From codespar/mcp-dev-latam on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

@codespar/mcp-x402

Deprecated: no live endpoint. Measured on 2026-09-27 against two public DNS resolvers (8.8.8.8 and 1.1.1.1): api.x402.org, the only host this server calls, does not resolve in DNS. x402 has no central API: it is an HTTP 402 protocol, and each seller picks the facilitator that verifies payment. No tool in this server reaches a service. The package is deprecated on npm and stays in this repository for reference only. If you have a working endpoint, point the server at it with X402_BASE_URL. To bring the package back, open an issue in mcp-dev-latam with the provider's documented base URL.

MCP server for x402, HTTP-native micropayments protocol by Coinbase (USDC on Base/Solana)

What is x402?

x402 is an open protocol that enables machine-to-machine micropayments at the HTTP layer. When an AI agent requests a resource and receives HTTP 402 Payment Required, it automatically sends a USDC payment on-chain and retries, no checkout UI, no merchant integration, pure HTTP.

This is the payment rail purpose-built for agentic commerce.

Quick Start

Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json:

{
  "mcpServers": {
    "x402": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-x402"],
      "env": {
        "X402_API_KEY": "your-key",
        "X402_WALLET_ADDRESS": "your-wallet-address"
      }
    }
  }
}
Claude Code
claude mcp add x402 -- npx @codespar/mcp-x402
Cursor / VS Code

Add to .cursor/mcp.json or .vscode/mcp.json:

{
  "servers": {
    "x402": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-x402"],
      "env": {
        "X402_API_KEY": "your-key",
        "X402_WALLET_ADDRESS": "your-wallet-address"
      }
    }
  }
}

Tools (10)

Tool Purpose
pay_request Pay for a 402-protected resource.
verify_payment Verify if a x402 payment was received and settled on-chain
create_paywall Create a x402 paywall configuration for an endpoint.
get_paywall Get paywall configuration for a specific URL
list_paywalls List all configured x402 paywalls
delete_paywall Remove a x402 paywall from an endpoint
get_balance Get available USDC balance for x402 payments
list_payments List x402 payment history with optional filters
get_payment Get details of a specific x402 payment
get_supported_networks List supported blockchain networks, tokens, and facilitators for x402 payments

Authentication

x402 uses a Bearer API key from a registered facilitator.

Get your credentials
  1. Visit the x402 documentation
  2. Set up a facilitator or use Coinbase's hosted facilitator
  3. Generate an API key
  4. Get your wallet address (Base or Solana)
  5. Set the environment variables

Environment Variables

Variable Required Description
X402_API_KEY Yes API key for x402 facilitator
X402_WALLET_ADDRESS Yes Wallet address for sending/receiving payments
X402_NETWORK No Blockchain network: base (default) or solana

Use Cases

  • Agent accessing premium APIs, AI agent pays per-request for data feeds, LLM APIs, or premium content
  • Micropayment monetization, Protect your API endpoints with sub-cent paywalls
  • Machine-to-machine commerce, Agents autonomously purchasing compute, data, or services

Roadmap

v0.2 (planned)
  • create_subscription, Set up recurring micropayments for an endpoint
  • estimate_cost, Estimate cost before paying for a resource
  • batch_pay, Pay for multiple resources in a single transaction
v0.3 (planned)
  • Multi-token support (ETH, SOL beyond USDC)
  • Streaming payments for long-running agent tasks

Want to contribute? Open a PR or request a tool.

Links

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Questions about X402

What is the X402 MCP server?

DEPRECATED: no live endpoint (api.x402.org does not resolve). X402 is maintained by codespar on GitHub at codespar/mcp-dev-latam, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the X402 MCP server?

Add X402 to your AI app's MCP config with the command npx -y @codespar/mcp-x402@0.1.5. In Claude Code, run claude mcp add --transport stdio codespar-x402 -- npx -y @codespar/mcp-x402@0.1.5. To run X402 this way you need Node.js installed.

Does X402 need an API key?

Yes. X402 expects X402_API_KEY to be set. Create the key for X402 in the connected service's own settings, give it the smallest permissions the job needs, and keep it out of shared config files.

Is X402 an official MCP server?

No. X402 is a community server maintained by codespar. Community servers can be excellent; read the code and the open issues before you give X402 access to company data.

What license is X402 under?

X402 is released under the MIT license, according to its GitHub repository. The license covers the code of X402; the service it connects to has its own terms.