SuperAPIAI Directory

swarm-x402-mcp

github.com · AI developer platforms

swarm-x402-mcp is an MCP server from SWARM that lets AI agents pay per call to use SWARM's small services via the x402 protocol. Users do not need to register an account or apply for an API key; they simply pay per call in USDC on the Base mainnet, and settlement occurs only after the service is successfully delivered. It provides six tools and can be connected to any MCP client such as Claude Code, Cursor, and Claude Desktop. Configuration requires Node.js 20 or higher and setting the dedicated wallet private key SWARM_WALLET_KEY; a per-call price cap can also be set via SWARM_MAX_USD (default 1 USD). Each call first reads the 402 quote, confirms the network is Base mainnet and the price does not exceed the cap, and then signs the payment; on failure it returns whether a charge occurred and whether it is safe to retry.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsAPI

About this tool

Purpose: swarm-x402-mcp is an MCP server for connecting SWARM's pay-per-call services to AI agents. SWARM is an autonomous agent that sells small services via the x402 protocol. Once connected, your agent can call SWARM's services and pay per call in USDC on the Base mainnet, with no account or API key required, and charges occur only when the service is successfully delivered.

Main capabilities: It provides six tools, each of which makes a network call to SWARM's store and, once a wallet key is configured, pays in USDC, so none of them are read-only tools; each tool declares readOnlyHint: false and openWorldHint: true in its MCP annotations.

Usage: Requires Node.js 20 or higher. Use a dedicated wallet for SWARM_WALLET_KEY containing only a small amount of USDC on Base. It can be added to Claude Code, Cursor, Claude Desktop, or any MCP client; Cursor's config file is located at ~/.cursor/mcp.json, and Claude Desktop is configured via Settings → Developer → Edit Config. SWARM_WALLET_KEY is the private key of the payment wallet; if not set, the tools can still list and quote, stating prices but not paying. SWARM_MAX_USD defaults to 1, and the server will reject any call priced above that cap before signing. It can also be used via AgentCash by adding with npx agentcash add https://swarm-agent.net .

Payment flow: Each call first reads SWARM's 402 quote without paying, checks whether the network is Base mainnet and whether the price is below the cap, and then pays using the official x402 client (@x402/fetch). SWARM verifies the payment, performs the work, and settles only after the work succeeds.

Failure handling: Failed calls are returned as ordinary tool results with isError: true. The first line states whether a charge occurred and whether retrying is safe, for example charged: no; retry: safe. Tools do not retry on their own. charged: no means no settlement occurred (SWARM settles only after the work succeeds), and a retry will sign a new payment; charged: yes means the receipt carries a transaction hash, do not pay again, and you can contact contact@swarm-agent.net with that hash; charged: unknown means the connection was interrupted after signing the payment, and you should check the wallet before calling again. A signed x402 payment can settle only once (based on its EIP-3009 nonce), and SWARM's store also rejects nonces that have already settled, so the same signed payment will not be charged twice.

Use cases and limitations: Suitable for users who want their agents to purchase small services per call and do not want to manage accounts or API keys. You need to prepare your own Base mainnet USDC wallet and keep the private key safe; the material does not provide the specific service content, price details, the names and parameters of the six tools, a complete list of supported MCP clients, or further limitations.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools