@aifinpay/mcp is an MCP server that exposes AiFinPay’s autonomous x402 payment loop as agent-callable tools. Drop it into Claude Desktop (or any MCP-aware runtime) and your agent can buy services on its own — detect an HTTP 402, sign, pay, and retry — without you writing a line of payment code.
AiFinPay is payment infrastructure for AI agents — the Stripe for autonomous agents. It is token-free: there is nothing to buy, hold, or trade to use it. Agents pay real stablecoins per call. mSECCO are non-transferable usage credits, not a tradable asset.
Install
Configure Claude Desktop
Add the server to~/Library/Application Support/Claude/claude_desktop_config.json:
payable_fetch, agent_call, pay_with_split, and the read-only marketplace directory — like any other tool.
First run — generating an agent
IfAIFINPAY_AGENT_SECRET is not set, the server generates an ephemeral keypair and prints it to stderr at startup:
AIFINPAY_AGENT_SECRET in your client config so the agent identity — and any funded Seat — persists across restarts.
Environment variables
Tools
The server exposes 16 tools: 7 for payment and agent identity, and 9 read-only marketplace directory tools.Payment / agent
Marketplace directory (read-only)
Try it in Claude
Once the server is running, drive it in natural language. Claude picks the right tools:1
Fund the agent
Ask Claude for
agent_address(), then send stablecoins to that address so it has a balance to spend.2
Browse the directory
“What AI services can I pay for through AiFinPay?” → Claude calls
list_providers() and provider_info(name).3
Preview before paying
“How much would this 402 endpoint cost?” → Claude calls
agent_quote(url) or quote_cost(...) — no payment is made.4
Pay and fetch
“Fetch this paid endpoint and summarize it” → Claude calls
payable_fetch(url), which pays and retries automatically, staying under AIFINPAY_MAX_USD.How payable_fetch works
- Sends the request unauthenticated.
- On
402, the underlying@aifinpay/agentSDK detects the facilitator flavor (AiFinPay native, Coinbase x402, …). - Signs a payment payload and retries.
- Returns
{ status, ok, headers, body }to the agent.
agent.pay(url) directly — this package just wraps it as an MCP tool surface so LLM agents can call it without writing payment code.
Programmatic use
You can also embed the server in your own MCP host:Works with Claude Desktop, MCP Inspector, and any MCP-aware agent runtime. The server communicates over stdio.