mcpField
M
mcp-x402

mcp-x402

Local
github.com/codesparFinance275Updated 4w ago

About mcp-x402

mcp-x402 is an MCP server for the x402 HTTP payment protocol, using USDC on Base or Solana. The package is deprecated, and its README states that the host it calls, api.x402.org, does not resolve in DNS, so no tool currently reaches a service.

Key features

  1. 01Pay for HTTP 402-protected resources
  2. 02Manage x402 paywall configurations
  3. 03Query USDC balance and payment history
  4. 04List supported networks, tokens and facilitators

Use cases

  1. 01Reference the tool interface for x402 payments
  2. 02Point the server at a working endpoint via X402_BASE_URL

MCP support

The server exposes x402 payment and paywall management as MCP tools for MCP clients to call.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-x402": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-x402"
],
"env": {
"X402_API_KEY": "<X402_API_KEY>"
}
}
}
}
Run commandnpx -y @codespar/mcp-x402
Environment variables to set
X402_API_KEYSecretAPI key for x402

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-x4020.1.5

Tools

10

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
urlstringYesURL of the 402-protected resource
networkenumNoBlockchain network (default: base)base | solana
maxAmountstringYesMaximum USDC amount willing to pay (e.g. '0.01')

Details

From the project README

@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)

npm License: MIT

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)

ToolPurpose
pay_requestPay for a 402-protected resource.
verify_paymentVerify if a x402 payment was received and settled on-chain
create_paywallCreate a x402 paywall configuration for an endpoint.
get_paywallGet paywall configuration for a specific URL
list_paywallsList all configured x402 paywalls
delete_paywallRemove a x402 paywall from an endpoint
get_balanceGet available USDC balance for x402 payments
list_paymentsList x402 payment history with optional filters
get_paymentGet details of a specific x402 payment
get_supported_networksList 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

VariableRequiredDescription
X402_API_KEYYesAPI key for x402 facilitator
X402_WALLET_ADDRESSYesWallet address for sending/receiving payments
X402_NETWORKNoBlockchain 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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.