X402 MCP Server

DeFi data API for AI agents — pay-per-call via x402/USDC on Base

Local serverstdio

What is the X402 MCP server?

DeFi data API for AI agents — pay-per-call via x402/USDC on Base. Exposed over MCP by the x402 mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

Just run it — any 402 responses will return human-readable payment instructions:

Adding it to your client

The server ships on npm as @x402-api/mcp-server, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

Its toolset

Everything the assistant can do here goes through one of these:

  • get_crypto_prices — GET /api/price-feed
  • get_gas_prices — GET /api/gas-tracker
  • get_dex_quotes — GET /api/dex-quotes
  • scan_token — GET /api/token-scanner
  • track_whales — GET /api/whale-tracker
  • scan_yields — GET /api/yield-scanner
  • get_funding_rates — GET /api/funding-rates
  • profile_wallet — GET /api/wallet-profiler

Configuration

You will need 2 environment variables: X402_WALLET_PRIVATE_KEY, X402_API_BASE_URL. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the x402 mcp server does with a few real requests.

When to reach for it

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. X402's toolset — get_crypto_prices, get_gas_prices, get_dex_quotes and 5 more — is a fair guide to whether it matches your workflow. It is maintained by fernsugi; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Available tools

ToolWhat it does
get_crypto_pricesGET /api/price-feed
get_gas_pricesGET /api/gas-tracker
get_dex_quotesGET /api/dex-quotes
scan_tokenGET /api/token-scanner
track_whalesGET /api/whale-tracker
scan_yieldsGET /api/yield-scanner
get_funding_ratesGET /api/funding-rates
profile_walletGET /api/wallet-profiler

How to install the X402 MCP server

### With auto-pay

```json
{
  "mcpServers": {
    "x402-api": {
      "command": "npx",
      "args": ["@x402-api/mcp-server"],
      "env": {
        "X402_WALLET_PRIVATE_KEY": "0x<your_private_key>"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
X402_WALLET_PRIVATE_KEYCredential the server authenticates with.Yes
X402_API_BASE_URLEndpoint or connection string the server talks to.Yes

Example prompts to try

  • Use X402 to get crypto prices.
  • Use X402 to get gas prices.
  • Use X402 to get dex quotes.

Frequently asked questions

It connects X402 to MCP-compatible AI assistants such as Claude and Cursor, exposing 8 tools (get_crypto_prices, get_gas_prices, get_dex_quotes, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with X402 directly.