X402ai MCP
Pay-per-call embed, summarize and ask tools paid in USDC on Base, plus an x402 inspector
X402ai MCP is an open-source MCP server for finance and payments. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted, macOS
- Runs
- Locally
- Version
- 0.1.3
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"x402ai-mcp": {
"command": "npx",
"args": [
"-y",
"x402ai-mcp"
],
"env": {
"X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"x402ai-mcp": {
"command": "npx",
"args": [
"-y",
"x402ai-mcp"
],
"env": {
"X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"x402ai-mcp": {
"command": "npx",
"args": [
"-y",
"x402ai-mcp"
],
"env": {
"X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"x402ai-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"x402ai-mcp"
],
"env": {
"X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.x402ai-mcp]
command = "npx"
args = ["-y", "x402ai-mcp"]
env = { X402AI_BUYER_PRIVATE_KEY = "<X402AI_BUYER_PRIVATE_KEY>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"x402ai-mcp": {
"command": "npx",
"args": [
"-y",
"x402ai-mcp"
],
"env": {
"X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Or run: gemini mcp add -s user -e X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' x402ai-mcp npx -- -y x402ai-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "x402ai-mcp": { "command": "npx", "args": [ "-y", "x402ai-mcp" ], "env": { "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
X402AI_BUYER_PRIVATE_KEYBuyer wallet private key (hex), used only to sign payments locally. Needed only for the paid tools. Use a wallet holding only what you are willing to lose.X402AI_MAX_SESSION_USDSpending cap per server process in USD (default 0.25).X402AI_DRY_RUNSet to 1 to quote prices without signing or paying.
About X402ai MCP
Each paid call costs a few cents: embedding is $0.01, summarizing $0.02 and a short answer $0.04. The server answers an HTTP 402 payment challenge by signing a USDC authorization with a buyer key you supply, so there is no account and nothing hosted for you. Payments are gasless for the payer, so the wallet needs USDC but no ETH.
Because the key can spend money, the README pushes hard on safeguards. Use a dedicated wallet with a few dollars at most. Before signing, each tool checks the network, token, payment address and route, with a $0.04 per-payment limit, and a session cap defaults to $0.25. A dry-run mode quotes prices without signing, and authorizations expire within 300 seconds.
The free inspect tool takes a URL, decodes its 402 challenge and runs Coinbase's x402 validator, which means the URL is sent to Coinbase. The ask tool has no web access or memory and can be wrong. It needs Node.js 20 or later and is MIT licensed.
Tools this server provides (5)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 2 of 5 tools read data; 3 names don't say.
From the server's own tool labels and tool names; not verified by us.
- embed
- 768-dimension text embedding using nomic-embed-text, $0.01.
- summarizeName suggests: reads
- Summary of input text from a small local model, $0.02.
- ask
- Short two-to-three sentence answer without web access, $0.04.
- health
- Service status plus session spend and remaining cap.
- inspectName suggests: reads
- Decodes a URL's 402 challenge and runs Coinbase's x402 validator and a merchant lookup.
What it does
- Text embeddings
- Returns 768-dimension embeddings from nomic-embed-text for $0.01.
- Summaries and short answers
- Summarizes text for $0.02 or gives a two-to-three sentence answer for $0.04.
- x402 endpoint inspector
- Decodes a URL's 402 challenge and runs a validator and merchant lookup for free.
- Spending caps
- A per-session cap defaults to $0.25 and each payment is limited to $0.04.
- Dry-run mode
- Quotes the price a paid tool would pay without signing anything.
- Local signing
- The buyer key signs authorizations on your machine and redirects are refused.
Good for
- Let an agent embed small texts and pay per call
- Try paid tools with dry run before funding a wallet
- Check whether a URL serves a valid x402 payment challenge
- Summarize short passages without an API subscription
Pricing
Open source
MIT licensed; paid tools cost $0.01 to $0.04 per call in USDC
X402ai MCP FAQ
How are calls paid for?
In USDC on Base through the x402 protocol, signed locally with your buyer key. No account is needed.
Do I need ETH?
No. Payments are gasless for the payer, so the wallet only needs USDC.
How do I test without spending?
Set X402AI_DRY_RUN=1 and paid tools return quotes without signing.
How long do summarize and ask take?
About 5 to 15 seconds because of CPU inference; embed is usually under a second.
How do I add X402ai MCP to Claude Code?
Run this command in your terminal: claude mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcp
What are the best alternatives to X402ai MCP?
The closest alternatives to X402ai MCP are headroom, omniget, next-ai-draw-io, mcp-for-blender and Claude Code Ultimate Guide.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.



