AgentPays is a hackathon project that enables AI agents to autonomously pay for API calls and other resources using the x402 payment protocol. By integrating Claude with a crypto payment backend and the Model Context Protocol (MCP), this project introduces the first native payment enforcement system embedded directly into MCP.
Each tool or resource can define its own payment requirements, which led to the development of:
- an
x402-enabled MCP server - and a local proxy client for agent-side integration
Experimental server for x402 payments using USDC on Base Sepolia.
Provides payment support for Model Context Protocol (MCP) using the 'exact' payment scheme (EIP-3009).
Can be used with the MCP Inspector or any x402-capable proxy client.
- One endpoint publishes a text file via
pinata, requiring 0.01 test USDC - All other endpoints are free
- The server is publicly accessible without authentication
- Only specific tool calls may require payment
☑️ Launches a local proxy to bridge Claude Mac's STDIO with the x402-enabled SSE server
☑️ Automatically injects signed X-PAYMENT headers into requests
☑️ Designed for Claude Mac, custom shells, or any agent framework
☑️ Connects Claude Mac to:
👉 https://community.flowmcp.org/x402 — public payment-enforced remote server
☑️ Manages payments via proxy with automatic X-PAYMENT headers
{
"globalShortcut": "",
"mcpServers": {
"x402": {
"command": "node",
"args": [
"your/absolute/path/proxyserver.mjs"
],
"env": {
"SERVER_URL": "https://community.flowmcp.org/x402",
"BEARER_TOKEN": "Bearer hal-finney",
"SILENT": "true"
}
}
}
}✅ No login ✅ No setup ✅ Just test it
The AgentPays infrastructure was custom-built for this hackathon. Core modules like x402-core and x402-mcp-middleware were created from scratch. Existing tools like FlowMCP and the community-server were extended to support seamless payment enforcement.
All modules are live and integrated at community.flowmcp.org/x402.
| Module | Description |
|---|---|
x402-core |
🔧 Built from scratch: full client/server logic for EIP-3009-based token payments |
x402-mcp-middleware |
🔧 Built from scratch: enforces x402 payments in Node.js Express-based AI tools |
FlowMCP |
♻️ Extended: tool orchestration & schema-driven agent framework |
community-server |
♻️ Extended: hosts and integrates all modules as a live remote server |
🔗 CustomGPT: x402 Payment Expert Interact with a GPT agent specialized in the x402 payment stack.
LOCAL MACHINE | INTERNET
───────────────────────────────────────────────────┼────────────────────────────────────────────────────────────
┌────────┐ User Input ┌──────────────┐ Tool Call ┌────────────┐ HTTP 402 ┌──────────────┐
│ USER │ ◀────────────────▶│ Claude Mac │ ◀────────────▶│ Proxy Node │ ◀──────────▶ │ MCP Server │
└────────┘ └──────────────┘ │ x402 Client│ │ x402 Gateway │
└────────────┘ └──────────────┘
▲ ▲
│ │
Signed Payment Header JSON Response / Stream
Let me know if you want this exported as a file, turned into a webpage, or styled with custom formatting (like GitHub Pages or Notion).
