ClawPay-mcp
Non-custodial x402 MCP payment layer for AI agents ā the open-source alternative to Vercel x402-mcp
README
AgentPay MCP
Formerly ClawPay MCP ā Non-custodial x402 payment layer for AI agents on Base network.
Migration notice: The npm package has been renamed from
clawpay-mcptoagentpay-mcp. Install withnpm install -g agentpay-mcp. The old package name will continue to redirect but receives no further updates.
What is AgentPay MCP?
AgentPay MCP is a Model Context Protocol server that wraps the Agent Wallet SDK (agentwallet-sdk) ā enabling any MCP-compatible AI client (Claude Desktop, Cursor, Windsurf, etc.) to make on-chain payments with built-in spend limit enforcement.
Key properties:
- š Non-custodial ā You hold your keys. The wallet is a smart contract you own via NFT.
- šø Spend-limited ā On-chain limits cap what agents can spend per-tx and per-period. Over-limit transactions queue for your approval.
- ā” x402-native ā Automatic HTTP 402 payment handling (pay-per-API-call, pay-per-token, etc.)
- š Base network ā Fast, cheap, EVM-compatible (Mainnet + Sepolia testnet)
Part of the Agent Wallet ecosystem.
Quick Start
1. Install
npm install -g agentpay-mcp
2. Configure environment
Create a .env file (or set env vars for your MCP client):
# Required
AGENT_PRIVATE_KEY=0x... # Agent hot wallet private key
AGENT_WALLET_ADDRESS=0x... # Your deployed AgentAccountV2 address
# Optional (defaults shown)
CHAIN_ID=8453 # 8453 = Base Mainnet, 84532 = Base Sepolia
RPC_URL=https://mainnet.base.org
Security note:
AGENT_PRIVATE_KEYis the agent's hot wallet signing key ā not the owner key. On-chain spend limits protect your funds. Even if the key is compromised, the agent can only spend within your configured limits.
3. Add to Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"agentpay": {
"command": "agentpay-mcp",
"env": {
"AGENT_PRIVATE_KEY": "0x...",
"AGENT_WALLET_ADDRESS": "0x...",
"CHAIN_ID": "8453"
}
}
}
}
Then restart Claude Desktop. You'll see the š§ AgentPay tools available in your conversation.
Tools Reference
1. deploy_wallet
Deploy a new AgentAccountV2 wallet via the factory contract.
Input:
{
"token_id": "1",
"factory_address": "0x...",
"nft_contract_address": "0x..."
}
Output:
ā
Agent Wallet deployed successfully!
š Wallet Address: 0xabc...
š Explorer: https://basescan.org/address/0xabc...
š Transaction: 0xdef...
š Owner NFT: 0xnft... #1
š Chain: Base Mainnet
ā¹ļø Next steps:
1. Set AGENT_WALLET_ADDRESS=0xabc... in your .env
2. Use set_spend_policy to configure spending limits
3. Fund the wallet with ETH or USDC
2. get_wallet_info
Get wallet address, balance, spend limits, and remaining allowance.
Input:
{
"token": "0x0000000000000000000000000000000000000000"
}
token is optional ā omit for native ETH.
Output:
š Agent Wallet Info
š Address: 0xabc...
š Chain: Base Mainnet
š° ETH Balance: 0.5 ETH
š Spend Limits (ETH)
Per-tx limit: 0.01 ETH
Period limit: 0.1 ETH
Period spent: 0.03 ETH
Remaining: 0.07 ETH
Utilization: 30% š¢ Healthy
Period length: 24h
Resets in: 18h 22m
3. send_payment
Send ETH or ERC20 tokens within spend limits.
Input:
{
"to": "0xrecipient...",
"amount_eth": "0.001",
"memo": "Payment for API access"
}
For ERC20 (e.g. USDC):
{
"to": "0xrecipient...",
"amount_eth": "5.00",
"token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"token_decimals": 6
}
Output:
ā
Payment Sent
To: 0xrecipient...
Amount: 0.001 ETH
Network: Base Mainnet
TX Hash: 0xabc...
š https://basescan.org/tx/0xabc...
š Memo: Payment for API access
If the payment exceeds spend limits, it's automatically queued for your approval. Use
queue_approvalto manage the queue.
4. check_spend_limit
Check if a proposed payment is within autonomous limits before sending.
Input:
{
"amount_eth": "0.005"
}
Output:
š Spend Limit Check
Token: ETH
Amount: 0.005 ETH
Per-tx limit: 0.01 ETH
Within per-tx: ā
Yes
Remaining period: 0.07 ETH
Within period: ā
Yes
Resets in: 18h 22m
ā
APPROVED ā This payment can execute autonomously.
5. queue_approval
Manage over-limit transactions queued for owner review.
List pending:
{ "action": "list" }
Approve:
{ "action": "approve", "tx_id": "0" }
Cancel:
{ "action": "cancel", "tx_id": "0" }
6. x402_pay
Fetch a URL and automatically handle HTTP 402 Payment Required responses.
Input:
{
"url": "https://api.example.com/premium-data",
"max_payment_eth": "0.001",
"timeout_ms": 15000
}
7. get_transaction_history
Retrieve on-chain transaction history from event logs.
Input:
{
"limit": 10,
"event_type": "execution"
}
Security Model
Non-Custodial Architecture
AgentPay MCP wraps AgentAccountV2 ā a smart contract wallet that you own via an NFT. The security model:
- You own the NFT ā You own the wallet. If you transfer the NFT, the new holder controls the wallet.
- Agent hot key ā
AGENT_PRIVATE_KEYis a limited operator key. It can execute transactions only within the on-chain spend limits you set. - On-chain spend limits ā Set via
setSpendPolicy. Caps per-transaction and per-period spending. Even if the agent key is compromised, the attacker is limited to your configured spend limits. - Approval queue ā Over-limit transactions are queued on-chain for your explicit approval. The agent cannot bypass this.
Threat Model
| Threat | Mitigation |
|---|---|
| Compromised agent private key | On-chain spend limits cap exposure |
| Runaway agent (infinite payment loop) | Period limits + queue-on-exceed |
| x402 price manipulation | max_payment_eth cap parameter |
| Over-spending a single service | x402 per-service budget controls |
| Lost private key | Owner (NFT holder) remains in control |
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
AGENT_PRIVATE_KEY |
ā | ā | Agent hot wallet private key (0x-prefixed hex) |
AGENT_WALLET_ADDRESS |
ā | ā | Deployed AgentAccountV2 contract address |
CHAIN_ID |
⬠| 8453 |
Chain ID (8453 = Base Mainnet, 84532 = Base Sepolia) |
RPC_URL |
⬠| Public Base RPC | Custom RPC endpoint (recommended for production) |
FACTORY_ADDRESS |
⬠| ā | Required for deploy_wallet only |
NFT_CONTRACT_ADDRESS |
⬠| ā | Required for deploy_wallet only |
Minimum to get started: Just
AGENT_PRIVATE_KEY+AGENT_WALLET_ADDRESS. Everything else has sensible defaults.
Integration Examples
Cursor / Windsurf
{
"mcpServers": {
"agentpay": {
"command": "npx",
"args": ["-y", "agentpay-mcp"],
"env": {
"AGENT_PRIVATE_KEY": "0x...",
"AGENT_WALLET_ADDRESS": "0x...",
"CHAIN_ID": "8453"
}
}
}
}
Ecosystem
- Agent Wallet SDK ā Non-custodial wallet SDK for AI agents
- @agent-wallet/mastra-plugin ā Mastra framework integration
- AgentPay MCP ā This package (MCP server)
- x402 Protocol ā HTTP 402 payment standard
- Base Network ā L2 chain
License
MIT ā see LICENSE
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.