Skip to main content
@aifinpay/mcp is an MCP server that wraps AiFinPay’s autonomous x402 payment loop as agent-callable tools. Drop it into Claude Desktop, MCP Inspector, or any MCP-aware runtime and your agent can pay for services and browse the AiFinPay network without you writing any payment code. It exposes 7 tools that move money or bind identity. AiFinPay is payment infrastructure for AI agents — settlement happens in SOL, USDC, USDT, or POL, and there is no token to buy: mSECCO are non-transferable usage credits, not a tradable asset.
The 7 tools below need a funded agent — see agent setup below. A read-only directory toolset (list_providers, network_stats, leaderboard, …) is on the roadmap and not yet registered in the published server — see Roadmap. Until then, use the public REST discovery endpoints (/api/leaderboard, /.well-known/x402.json) for catalog/stats.

Payment tools

These tools can settle on-chain or bind the agent to an account. Always set a hard spend cap with AIFINPAY_MAX_USD before enabling them.
pay_with_split returns on-chain instructions/invoice; it does not itself broadcast funds. The agent executes the returned instructions with its own chain SDK. chain accepts "solana" or "polygon", and merchant_amount is a string in base units (lamports for Solana, wei for Polygon).

Roadmap: directory tools

These read-only directory tools are planned but not yet registered in the published @aifinpay/mcp server — calling them will fail with “unknown tool”. They are documented here as the intended surface. For catalog/stats today, use the public REST discovery endpoints (/api/leaderboard, /.well-known/x402.json). This section is generated from the roadmap, not from the live tools/list.
When shipped, these will never move funds, never require auth, and return the public AiFinPay network catalog and statistics.

Install

Use with Claude Desktop

Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json, then restart Claude Desktop:
Claude can now call any of the 7 tools above like any other tool.

Agent setup

If AIFINPAY_AGENT_SECRET is not set, the server generates an ephemeral keypair and prints it to stderr at startup:
Save the printed secret to AIFINPAY_AGENT_SECRET so the agent identity (and any funded Seat) persists across restarts. Call agent_address to find out where to send funds.
The secret controls the agent’s funds. Store it like any other private key — never commit it, and keep AIFINPAY_MAX_USD set as a hard per-payment cap.

Environment variables

Programmatic use

How payable_fetch works

1

Send unauthenticated

The tool sends the request with no payment header.
2

Detect the facilitator

On 402, the underlying @aifinpay/agent SDK detects the facilitator flavor (AiFinPay native, Coinbase x402, …).
3

Sign and retry

It signs a payment payload and retries the request.
4

Return the result

Returns { status, ok, headers, body } to the agent.
The flow is identical to calling agent.pay(url) directly — this package just wraps it as an MCP tool surface so LLM agents can pay without writing payment code.
Use payable_fetch (not the host’s generic web-fetch tool) for any URL that might be a paid endpoint — a plain fetch can only see the 402 challenge and cannot sign the x402 payment header to settle it.