@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 withAIFINPAY_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
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:
Agent setup
IfAIFINPAY_AGENT_SECRET is not set, the server generates an ephemeral
keypair and prints it to stderr at startup:
AIFINPAY_AGENT_SECRET so the agent identity (and
any funded Seat) persists across restarts. Call agent_address to find out
where to send funds.
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.agent.pay(url) directly — this package just
wraps it as an MCP tool surface so LLM agents can pay without writing payment
code.