CryptoAPIs x402 Pay MCP
OfficialClick on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CryptoAPIs x402 Pay MCP Fetch https://api.example.com/v1/alpha and pay if it returns 402."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@cryptoapis-io/mcp-x402-pay
This is the BUYER side of x402 — the tool an agent uses to spend (pay for a resource). Merchants who want to charge for an API use the middleware SDK (
@cryptoapis-io/x402-merchant-sdk), not an MCP tool.
An MCP server that lets an AI agent find and pay x402-gated HTTP endpoints.
x402_pay— fetches a URL and, if the server returns402 Payment Required, authorizes the payment via the CryptoAPIs buyer service, signs locally, retries, and returns the paid response.x402_discover— browses the facilitator's catalogue of x402 resources and their prices, so an agent can find a paid API instead of only calling one it was handed.
Non-custodial: the private key is passed per request and never leaves the process (no HTTP server — stdio only).
Supported today: EVM (eip712, e.g. Base USDC) and Solana. Tron, Bitcoin/UTXO, XRP and Kaspa are
upcoming — wired but not yet enabled; paying on them returns a clear family_not_yet_supported
("coming soon") result.
Run
node dist/cli.js # stdio MCP server (no --api-key at startup; keys are per-tool-call)Related MCP server: @arispay/payagent-mcp
Prerequisite — an agent walletId
x402_pay pays from a CryptoAPIs agent wallet (walletId). Create one ONCE per blockchain+network
before paying — a single POST to the buyer API returns the id (non-custodial: you register only your
PUBLIC address):
curl -X POST https://ai.cryptoapis.io/x402/buyer/wallets \
-H "x-api-key: $CRYPTOAPIS_API_KEY" -H "content-type: application/json" \
-d '{"blockchain":"base","network":"eip155:8453","address":"0xYourAddress"}'
# → { "walletId": "…" }network MUST be the CAIP-2 id (eip155:8453, solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp, …), not a
bare name — and exactly one of address (any chain; required for Solana/Kaspa) or xpub
(xpub-capable chains). A malformed body returns a clear 400 malformed_request. Set the returned id as
X402_WALLET_ID (or pass walletId).
Tool: x402_pay
Input | Required | Description |
| ✓ | the (possibly paywalled) resource |
| ✓ | your CryptoAPIs key (X402_BUYER feature) — only used to call the buyer |
| ✓ | the wallet record id from |
| ✓ | the wallet's EVM key — signs locally, never sent anywhere |
| the request to make | |
| restrict which CAIP-2 networks to pay on | |
| safety cap — refuse if the required atomic-unit amount exceeds it | |
| restrict WHICH SITES may be paid, e.g. |
Returns { status, paid, body, settlement? }. On a 402 with no acceptable option (or over maxAmount),
paid:false with a reason — nothing is signed or paid.
Tool: x402_discover
Browse the x402 "Bazaar" — the registered x402 resources and what each charges (spec §8).
Input | Required | Description |
| filter by resource type, e.g. | |
| page size, 1–100 (default 20) | |
| rows to skip, for paging (default 0) | |
| override the facilitator (QA/local) |
Returns { resources: [{ resource, type, x402Version, accepts, lastUpdated, metadata? }], pagination }.
Public — no API key, no wallet, spends nothing, so it is always safe to call. Note accepts[].amount
is in atomic units (USDC 6-decimals: "10000" = $0.01) — convert before quoting a price to a user.
Pass a chosen resource to x402_pay to actually buy it.
Flow
fetch(url). Not 402 → return it.402 → pick an
acceptsentry (allowlist-aware), authorize via buyer/authorize→ the signing artifact.Sign locally (
@cryptoapis-io/mcp-signerevm_signtyped-data) → build the x402PaymentPayload(wire scheme is alwaysexact; the family is innetwork).Retry with the base64
X-PAYMENTheader; return the paid response + theX-PAYMENT-RESPONSEsettlement.
Security
The private key is a tool parameter and may be logged by MCP clients or stored in conversation
history — use only in trusted local environments. This mirrors @cryptoapis-io/mcp-signer.
Available Tools
3 toolsx402_discoverA
Discover x402-gated APIs you can pay for — browse the facilitator's Bazaar catalogue of registered x402 resources, each with the price and payment terms it accepts. Use this BEFORE x402_pay whenever you need to FIND a paid endpoint rather than call one you were already given: the pay tool only fetches a URL you hand it, so this is the only way to locate a monetized API on your own. Returns { resources: [{ resource, type, x402Version, accepts: [{ scheme, network, amount, asset, payTo }], lastUpdated, metadata? }], pagination: { limit, offset, total } } — amount is in ATOMIC units (USDC 6-decimals: "10000" = $0.01), so convert before quoting a price to the user. PUBLIC: needs no API key, no wallet and spends nothing, so it is always safe to call. Filter with type (e.g. "http") and page with limit/offset. Then pass a chosen resource URL to x402_pay to actually buy it.
Inputs: type, limit, offset, facilitatorBaseUrl.
x402_payA
Fetch an HTTP resource and, if it returns 402 Payment Required, pay it automatically with x402 and return the paid response. On a 402 it: parses the merchant's price, authorizes via the CryptoAPIs buyer /authorize, signs the payment LOCALLY (non-custodial — the key never leaves this process), and retries with the X-PAYMENT header. Returns { status, paid, body, settlement? }. This is for HTTP URLs — to pay a paid MCP TOOL on another server, use x402_pay_tool instead. Supported today: EVM (eip712, e.g. Base USDC) and Solana. Tron, UTXO (bitcoin/ltc/doge/dash/bch/zcash), Kaspa and XRP are UPCOMING — wired but not yet enabled, and paying on them returns a clear coming-soon (family_not_yet_supported) result. Set CRYPTOAPIS_API_KEY + X402_WALLET_ID once, plus the signing key(s) for the chain(s) you pay on: X402_PRIVATE_KEY (EVM hex), X402_SVM_SECRET (base58). A scheme with no configured key errors cleanly (never mis-signs). Env vars keep keys OUT of tool-call logs. Use allowedNetworks to restrict chains, maxAmount as a per-call spend cap, and allowedHosts to restrict WHICH SITES may be paid (a url outside the list is refused before any network call; set X402_ALLOWED_HOSTS in the MCP config to pin it outside the model's reach). SECURITY: this tool holds spending keys — use only in trusted local environments, and prefer pinning allowedHosts + maxAmount via env for unattended runs.
Inputs: url (required), body, apiKey, method, +12 more.
x402_pay_toolA
Call a TOOL on another MCP server and, if that tool requires payment, pay it automatically with x402 and return the paid result. This is the MCP-transport twin of x402_pay: use x402_pay for an HTTP url, and THIS for a paid tool on another MCP server. On a challenge it reads the PaymentRequired (from structuredContent, falling back to content[0].text), authorizes via the CryptoAPIs buyer /authorize, signs LOCALLY (non-custodial — the key never leaves this process), and retries the tool call once with the payment in _meta["x402/payment"] (a raw object, no base64 — MCP carries structured JSON natively). Returns { paid, result, settlement? }; the settlement receipt comes back in _meta["x402/payment-response"]. The upstream server is launched over stdio for the call and shut down afterwards. Same credentials and keys as x402_pay: CRYPTOAPIS_API_KEY + X402_WALLET_ID, plus X402_PRIVATE_KEY (EVM) / X402_SVM_SECRET (Solana). Supported today: EVM (eip712) and Solana; Tron, UTXO, Kaspa and XRP return a clear coming-soon result. Use allowedNetworks and maxAmount as guardrails. SECURITY: this tool holds spending keys and launches the process you name — use only in trusted local environments.
Inputs: server (required), toolName (required), apiKey, tronKey, +10 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: x402_pay for HTTP URLs, x402_pay_tool for paid MCP tools on other servers, and x402_discover for finding paid endpoints. The descriptions explicitly cross-reference each other ('use x402_pay for an HTTP url, and THIS for a paid tool') to eliminate misselection.
All three share a consistent x402_ prefix and snake_case style, which is highly predictable. The only minor deviation is that pay_tool adds a qualifier rather than following a strict verb_noun pattern like the other two, but overall naming is coherent.
Three tools is on the lean side but each earns its place in a narrowly scoped payment domain. The surface is well-scoped with no redundancy, though a small set of supporting tools (e.g. balance/status) could round it out.
Core payment lifecycle is covered: discovery, HTTP payment, and MCP-tool payment, with settlement receipts returned. Minor gaps exist around checking wallet balance, payment history, or supported-network queries, which agents can work around but would strengthen the surface.
Maintenance
Related MCP Connectors
Machine-payable API infrastructure for autonomous agents. Per-call x402 settlement in USDC.
Discover machine-payable APIs, probe x402 payment terms, and run seller operations. Non-custodial.
API discovery and x402 paid execution via MCP. Search by natural-language, call with USDC payment on Arbitrum, Base, BNB, Solana, SEI
Agent x402 Paywall MCP — Coinbase HTTP 402 protocol + on-chain settlement. Agents pay per-call
Related MCP Servers
- AlicenseAqualityBmaintenanceA budget-bound x402 payment wallet for AI agents: it autonomously pays HTTP 402 payment-gated URLs across every major chain (EVM, Solana, and many non-EVM families). Self-custodial and backendless, your key, your RPC, with spend caps enforced before any on-chain send.810MIT

@arispay/payagent-mcpofficial
AlicenseAqualityBmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.7186 npmMIT
@hpp-io/x402-mcp-bridgeofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents to autonomously pay for and discover services using HPP USDC.e over the x402 protocol, without API keys or manual signing.421 npmApache 2.0- AlicenseNot gradedqualityDmaintenanceEnables pay-per-call access control for AI agents using HTTP 402 and on-chain settlement, allowing microtransactions for API usage.45 PyPIMIT