x402-agent-mcp
This MCP server lets an agent discover, inspect, and health-check x402-paid APIs, then fetch them with automatic 402 payment using configured wallet keys.
Search the x402 endpoint directory by keyword, category, or chain.
List available endpoint categories with counts.
Describe a service's paths, methods, prices, and discovery files.
Discover a service by URL using
/.well-known/x402,ai-catalog.json, andllms.txt.Batch-discover multiple service URLs in parallel.
Check whether a service is live and responding with HTTP 402.
Crawl x402scan.com to discover and add new x402 services to the local directory.
Fetch any x402 endpoint with GET or POST, automatically handling 402 payment on Base, Solana, or Casper; the agent never handles wallets or payment details directly.
Provides payment integration for x402 endpoints on Solana, enabling agents to autonomously pay for and consume data from Solana-based x402 services using USDC.
Click 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., "@x402-agent-mcp Find a news API and get today's top stories"
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.
x402-agent-mcp
Universal x402 agent MCP — discover and pay for any x402 endpoint on Base, Polygon, Arbitrum, Solana or Casper
What it does
An agent searches the directory, describes a service, then fetches its URL: the server pays the seller's 402 price with the operator's wallet and hands back the data. The agent never sees wallets, private keys or x402 protocol details — no API keys, no subscriptions, just a wallet.
Related MCP server: obolpay-x402-mcp
Quick start
git clone https://github.com/dchu3/x402-agent-mcp.git
cd x402-agent-mcp
npm install
npm run buildPoint your MCP client config at the built server, passing the server's keys through env (only keys that exist in .env.example):
{
"mcpServers": {
"x402": {
"command": "node",
"args": ["/path/to/x402-agent-mcp/dist/index.js"],
"env": {
"X402_NETWORK_MODE": "mainnet",
"SOLANA_PRIVATE_KEY": "<YOUR_SOLANA_PRIVATE_KEY>",
"EVM_PRIVATE_KEY": "<YOUR_EVM_PRIVATE_KEY>",
"CASPER_PRIVATE_KEY": "<YOUR_CASPER_PRIVATE_KEY>",
"MAX_PAYMENT_PER_CALL": "0.50",
"MAX_DAILY_SPEND": "10.00"
}
}
}
}Replace every <PLACEHOLDER> with your own value — never commit real key material. Only the chains you want to pay on need a key. The full annotated key set (RPC URLs with their public fallbacks, devnet mode, the optional cross-chain ceiling, the policy config) is .env.example; copy it to a .env your client loads, or inline the keys in the config block.
Before your first paid call: there is no default network — with a payment key loaded and
X402_NETWORK_MODEunset, every paid call is refused withNETWORK_NOT_CONFIGUREDbefore anything is fetched or signed. SetMAX_PAYMENT_PER_CALLandMAX_DAILY_SPENDto what you can afford, and make your first paid calls with a throwaway key.
Paid routes and prices rotate — confirm the route and price on the seller's GET /.well-known/x402 manifest before fetching.
Tools
Tool | Free/paid | Purpose |
| Free | Search the endpoint directory by keyword, category or chain — ranked live-first, zero network calls. |
| Free | List all endpoint categories with counts. |
| Free | Get one service's paths, prices and schema. |
| Free | Discover an x402 service by URL (well-known files) and add it to the directory. |
| Free | Check a service is live and answering 402. |
| Free | Batch-discover several services in parallel. |
| Free | Crawl x402scan.com for new services and add them to the directory. |
| Free | Evaluate a prospective payment: decision, reason codes, limits, network mode, budget headroom. Never pays. |
| Free | Refresh the recorded 402 liveness probes for the pinned endpoint set. Never pays. |
| Free | Show every budget rail — unit, caps, spent/remaining today, outstanding holds, ledger path, configured USD rate. Read-only. |
| Free | Inspect a 402 challenge or single offer — exact amounts, asset verdict, policy and budget verdicts — without paying or fetching. |
| Endpoint price | Fetch an x402 endpoint and pay the 402 price — the only paying tool. |
Safety and network defaults
The default payment policy is permissive — any x402 endpoint is payable up to the global caps — and every cap fails closed on a malformed value (it disables payments rather than widening them). Tighten via a config file pointed at by
POLICY_CONFIG_PATH, or opt into a shipped profile withX402_POLICY_PROFILE=strict|standard— unset stayspermissive(the behavior-compat default; see the policy engine reference for the three profiles).Polygon and Arbitrum are opt-in (add them to the policy's
networks.allowed); the Ethereum mainnet (eip155:1) is always refused.Payment receipts come from the seller and are not verified on-chain (
receipt_verified: false).There is no default network:
X402_NETWORK_MODEmust be set explicitly before any paid call.
Documentation
Policy engine — decisions, reason codes, rule order, trust levels, the recipients and anomaly gates
Payments and budgets — spend accounting, the ledger and reservations, the payment-intent boundary, trust in receipts
Networks and network mode — the chain matrix, the no-default network mode, devnet, Casper, assets and USD pricing
Operations — usage examples, directory refresh recipes, CI, the security scan, tech stack
Disclaimer and licence
This software is experimental and provided "as is", without warranty of any kind. Use at your own risk. It initiates real cryptocurrency transactions that are irreversible. License: MIT.
Available Tools
8 toolsx402_crawl_directoryA
Crawl x402scan.com resources page to discover new x402 endpoints. Extracts service URLs, probes each for x402 support, and auto-adds confirmed services to the local directory. Returns summary of newly discovered services.
Inputs: max_results.
x402_describeB
Get detailed information about a specific x402 endpoint, including all available paths, methods, prices, and well-known discovery files.
Inputs: name (required).
x402_discover_urlA
Discover any x402 service by URL. Fetches /.well-known/x402 (payment details), /.well-known/ai-catalog.json (capabilities), and /llms.txt (agent summary). Returns a unified discovery object with chains, wallet, endpoints, and prices.
Inputs: url (required).
x402_discover_urlsA
Batch discover multiple x402 services in parallel. Provide a list of URLs, each is probed for /.well-known/x402 and ai-catalog.json. Returns a summary array.
Inputs: urls (required).
x402_fetchA
Fetch any x402-paid endpoint — handles 402 payment challenge automatically on Base, Solana or Casper. The agent never sees wallets or payment details. Just provide a URL and optional body.
Inputs: url (required), body, chain, method.
x402_healthA
Check if an x402 service is live and responding with 402 Payment Required. Verifies the service is operational before an agent pays for it.
Inputs: url, name.
x402_list_categoriesA
List all available x402 endpoint categories with counts.
Inputs: no named parameters.
x402_searchA
Search for x402 endpoints by keyword, category, or chain. Returns matching services with descriptions, prices, and URLs.
Inputs: chain, query, category.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool has a clearly defined role covering category listing, searching, describing, discovering, health-checking, and fetching. The main overlap is between discover_url and discover_urls, which are the same operation in single and batch form, but this is a reasonable convenience rather than a true ambiguity.
All tools share the x402_ prefix and most use a verb or verb_noun pattern (list_categories, search, describe, discover_url, crawl_directory, fetch). The exceptions are health, which is a noun, and two discover verbs with slightly different forms, but the overall convention remains predictable.
Eight tools is well within the ideal range for this domain. Each tool addresses a distinct stage of discovering, evaluating, and consuming x402 services without excessive redundancy or missing core functions.
The toolset covers the full lifecycle from discovery (search, crawl, list categories), to verification (health, describe, discover_url), to interaction (fetch with automatic payment handling). No obvious dead ends or missing capabilities are apparent for an agent needing to work with x402 endpoints.
Maintenance
Related MCP Connectors
x402 pay-per-call APIs over MCP, settled in USDC on Base for autonomous agents and developers.
15 paid AI agent primitives via x402 (USDC on Base). Pay-per-call MCP server.
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Agent-commerce MCP server for x402/USDC payments and affiliate splits on Base.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI agents to search, pay for, and call paid APIs using the x402 protocol, with automatic USDC settlement.2MIT- FlicenseAqualityCmaintenanceMCP server for a live x402 payment gateway on Base (USDC). Lets AI agents discover, preview for free, then pay per call — with prepaid gasless payments, signed receipts, and delta delivery.7-

mpp32-mcp-serverofficial
AlicenseNot gradedqualityDmaintenanceMCP server that allows AI agents to discover and pay for thousands of APIs (x402 on Solana/Base) using a single key, with automatic payment handling and a federated catalog of machine-payable endpoints.221MIT- AlicenseNot gradedqualityDmaintenanceMCP server that provides AI agents with pay-per-call access to a suite of tools (honeypot check, token market, DeFi yields, etc.) via USDC on Base using the x402 protocol.11 npmMIT