agentpay-mcp 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +570 -220
- package/dist/index.js +83 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/bridge.d.ts +52 -0
- package/dist/tools/bridge.d.ts.map +1 -0
- package/dist/tools/bridge.js +97 -0
- package/dist/tools/bridge.js.map +1 -0
- package/dist/tools/budget.d.ts +84 -0
- package/dist/tools/budget.d.ts.map +1 -0
- package/dist/tools/budget.js +163 -0
- package/dist/tools/budget.js.map +1 -0
- package/dist/tools/escrow.d.ts +73 -0
- package/dist/tools/escrow.d.ts.map +1 -0
- package/dist/tools/escrow.js +146 -0
- package/dist/tools/escrow.js.map +1 -0
- package/dist/tools/identity.d.ts +65 -0
- package/dist/tools/identity.d.ts.map +1 -0
- package/dist/tools/identity.js +158 -0
- package/dist/tools/identity.js.map +1 -0
- package/dist/tools/swap.d.ts +65 -0
- package/dist/tools/swap.d.ts.map +1 -0
- package/dist/tools/swap.js +101 -0
- package/dist/tools/swap.js.map +1 -0
- package/dist/tools/tokens.d.ts +129 -0
- package/dist/tools/tokens.d.ts.map +1 -0
- package/dist/tools/tokens.js +138 -0
- package/dist/tools/tokens.js.map +1 -0
- package/dist/tools/transfers.d.ts +86 -0
- package/dist/tools/transfers.d.ts.map +1 -0
- package/dist/tools/transfers.js +136 -0
- package/dist/tools/transfers.js.map +1 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,58 +1,38 @@
|
|
|
1
1
|
# AgentPay MCP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/agentpay-mcp)
|
|
3
|
+
[](https://www.npmjs.com/package/agentpay-mcp)
|
|
6
4
|
[](LICENSE)
|
|
7
|
-
[ server that wraps the [Agent Wallet SDK (`agentwallet-sdk`)](https://www.npmjs.com/package/agentwallet-sdk) — enabling any MCP-compatible AI client (Claude Desktop, Cursor, Windsurf, etc.) to make on-chain payments with built-in spend limit enforcement.
|
|
5
|
+
[](tests/)
|
|
6
|
+
[](https://uspto.gov)
|
|
16
7
|
|
|
17
|
-
|
|
8
|
+
> MCP server that gives AI agents a complete crypto wallet — send tokens, swap, bridge, manage budgets, verify identity.
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
- 💸 **Spend-limited** — On-chain limits cap what agents can spend per-tx and per-period. Over-limit transactions queue for your approval.
|
|
21
|
-
- ⚡ **x402-native** — Automatic HTTP 402 payment handling (pay-per-API-call, pay-per-token, etc.)
|
|
22
|
-
- 🌐 **Multi-chain** — Base (live), Etherlink, Polygon, Stellar (coming Q2 2026)
|
|
10
|
+
**Patent Pending** — USPTO provisional filed March 2026.
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
Built by [AI Agent Economy](https://ai-agent-economy.com). Payment infrastructure integrated into **NVIDIA's official NeMo Agent Toolkit Examples catalog**.
|
|
25
13
|
|
|
26
14
|
---
|
|
27
15
|
|
|
28
|
-
##
|
|
16
|
+
## What's New in v4.0.0
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Chain | Status | Settlement | Notes |
|
|
33
|
-
|-------|--------|------------|-------|
|
|
34
|
-
| **Base** (Coinbase L2) | ✅ Live | USDC native | Primary chain. Production-ready. |
|
|
35
|
-
| **Etherlink** (Tezos L2) | 🔜 Coming | USDC via bridge | Live on Etherlink since Mar 9, 2026. AgentPay integration in progress. |
|
|
36
|
-
| **Polygon** | 🔜 Coming | USDC native | Agent CLI support live since Mar 8, 2026. AgentPay integration in progress. |
|
|
37
|
-
| **Stellar** | 🔜 Coming | USDC native | x402 support live ~Mar 10, 2026. AgentPay integration in progress. |
|
|
38
|
-
| **Circle Testnet** | 🧪 Testing | USDC (12 chains) | Multi-chain CCTP testnet for cross-chain USDC settlement. |
|
|
39
|
-
|
|
40
|
-
**How multi-chain works with AgentPay MCP:**
|
|
41
|
-
|
|
42
|
-
Your agent calls `x402_pay` with a URL. The MCP server detects the x402 payment requirements from the HTTP 402 response - including which chain the provider expects payment on. As we add chain support, the agent's integration stays the same: one tool call, automatic chain routing.
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Your agent code doesn't change when new chains are added
|
|
46
|
-
x402_pay({ url: "https://api.example.com/data", max_payment_eth: "0.001" })
|
|
47
|
-
```
|
|
18
|
+
**11 new MCP tools** powered by full **agentwallet-sdk v6.0.0** integration:
|
|
48
19
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
| Category | New Tools |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Token Registry | `lookup_token`, `add_custom_token`, `list_chain_tokens` |
|
|
23
|
+
| Token Transfers | `send_token`, `get_balances` |
|
|
24
|
+
| DeFi | `swap_tokens` (Uniswap V3), `bridge_usdc` (CCTP V2) |
|
|
25
|
+
| Spending Controls | `set_spend_policy`, `check_budget` |
|
|
26
|
+
| Agent Identity | `verify_agent_identity`, `get_reputation` |
|
|
27
|
+
| Escrow | `create_escrow` |
|
|
54
28
|
|
|
55
|
-
|
|
29
|
+
Other highlights:
|
|
30
|
+
- **12 supported chains** — Base, Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Linea, Unichain, Sonic, Worldchain, Base Sepolia, Arbitrum Sepolia
|
|
31
|
+
- **100+ pre-loaded tokens** via TokenRegistry
|
|
32
|
+
- **CCTP V2** cross-chain USDC bridging (10 EVM chains)
|
|
33
|
+
- **Uniswap V3** swaps on Base, Arbitrum, Optimism, Polygon
|
|
34
|
+
- **ERC-8004** on-chain agent identity verification
|
|
35
|
+
- 42 new tests (149 total), 99.6% type coverage
|
|
56
36
|
|
|
57
37
|
---
|
|
58
38
|
|
|
@@ -64,31 +44,39 @@ Want a specific chain prioritized? [Open an issue](https://github.com/up2itnow08
|
|
|
64
44
|
npm install -g agentpay-mcp
|
|
65
45
|
```
|
|
66
46
|
|
|
67
|
-
### 2.
|
|
47
|
+
### 2. Environment Variables
|
|
68
48
|
|
|
69
|
-
|
|
49
|
+
Copy `.env.example` to `.env` and fill in the required values:
|
|
70
50
|
|
|
71
51
|
```bash
|
|
72
52
|
# Required
|
|
73
|
-
AGENT_PRIVATE_KEY=0x...
|
|
74
|
-
AGENT_WALLET_ADDRESS=0x...
|
|
53
|
+
AGENT_PRIVATE_KEY=0x... # Agent hot wallet private key (0x-prefixed hex)
|
|
54
|
+
AGENT_WALLET_ADDRESS=0x... # Deployed AgentAccountV2 wallet address
|
|
75
55
|
|
|
76
56
|
# Optional (defaults shown)
|
|
77
|
-
CHAIN_ID=8453
|
|
78
|
-
RPC_URL=https://mainnet.base.org
|
|
57
|
+
CHAIN_ID=8453 # 8453 = Base Mainnet (default)
|
|
58
|
+
RPC_URL=https://mainnet.base.org # Custom RPC URL
|
|
59
|
+
|
|
60
|
+
# For x402 session payments
|
|
61
|
+
SESSION_TTL_SECONDS=3600 # Session lifetime (default: 1 hour)
|
|
62
|
+
|
|
63
|
+
# For deploy_wallet tool
|
|
64
|
+
FACTORY_ADDRESS=0x... # AgentAccountFactoryV2 address
|
|
65
|
+
NFT_CONTRACT_ADDRESS=0x... # NFT contract that owns the wallet
|
|
79
66
|
```
|
|
80
67
|
|
|
81
|
-
|
|
68
|
+
### 3. MCP Configuration
|
|
82
69
|
|
|
83
|
-
|
|
70
|
+
#### Claude Desktop
|
|
84
71
|
|
|
85
|
-
|
|
72
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
86
73
|
|
|
87
74
|
```json
|
|
88
75
|
{
|
|
89
76
|
"mcpServers": {
|
|
90
77
|
"agentpay": {
|
|
91
|
-
"command": "
|
|
78
|
+
"command": "npx",
|
|
79
|
+
"args": ["agentpay-mcp"],
|
|
92
80
|
"env": {
|
|
93
81
|
"AGENT_PRIVATE_KEY": "0x...",
|
|
94
82
|
"AGENT_WALLET_ADDRESS": "0x...",
|
|
@@ -99,305 +87,667 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
99
87
|
}
|
|
100
88
|
```
|
|
101
89
|
|
|
102
|
-
|
|
90
|
+
#### Cursor
|
|
91
|
+
|
|
92
|
+
Add to `.cursor/mcp.json` in your project or `~/.cursor/mcp.json` globally:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"agentpay": {
|
|
98
|
+
"command": "npx",
|
|
99
|
+
"args": ["agentpay-mcp"],
|
|
100
|
+
"env": {
|
|
101
|
+
"AGENT_PRIVATE_KEY": "0x...",
|
|
102
|
+
"AGENT_WALLET_ADDRESS": "0x...",
|
|
103
|
+
"CHAIN_ID": "8453"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
103
109
|
|
|
104
110
|
---
|
|
105
111
|
|
|
106
|
-
## Tools Reference
|
|
112
|
+
## All 23 Tools Reference
|
|
113
|
+
|
|
114
|
+
### Original Tools (v1.0.0–v3.1.0)
|
|
115
|
+
|
|
116
|
+
| Tool | Description | Key Parameters |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| `deploy_wallet` | Deploy a new AgentAccountV2 wallet via factory | `token_id`, `nft_contract_address?`, `factory_address?` |
|
|
119
|
+
| `get_wallet_info` | Wallet address, balances, spend limits, queue depth | `token?` (address) |
|
|
120
|
+
| `send_payment` | Send ETH or ERC-20 via AgentAccountV2 contract | `to`, `amount_eth`, `token?`, `token_decimals?`, `memo?` |
|
|
121
|
+
| `check_spend_limit` | Check remaining spend limit for a token | `token?` |
|
|
122
|
+
| `queue_approval` | Approve or cancel a queued transaction | `action`, `tx_id`, `token?` |
|
|
123
|
+
| `x402_pay` | Auto-pay x402 paywalled URLs | `url`, `method?`, `headers?`, `body?`, `max_payment_eth?` |
|
|
124
|
+
| `get_transaction_history` | Query on-chain event logs | `limit?`, `from_block?`, `to_block?`, `event_type?` |
|
|
125
|
+
| `x402_session_start` | Pay once, get reusable session token | `endpoint`, `scope?`, `ttl_seconds?`, `label?` |
|
|
126
|
+
| `x402_session_fetch` | Make calls within an active session | `url`, `method?`, `headers?`, `body?`, `session_id?` |
|
|
127
|
+
| `x402_session_status` | Inspect active sessions and TTL | `session_id?` |
|
|
128
|
+
| `x402_session_end` | Explicitly close a session | `session_id` |
|
|
129
|
+
|
|
130
|
+
### New Tools (v4.0.0)
|
|
131
|
+
|
|
132
|
+
| Tool | Description | Key Parameters |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `lookup_token` | Look up token address and decimals by symbol | `symbol`, `chainId` |
|
|
135
|
+
| `add_custom_token` | Register a custom ERC-20 in the token registry | `symbol`, `address`, `decimals`, `chainId`, `name?` |
|
|
136
|
+
| `list_chain_tokens` | List all registered tokens for a chain | `chainId` |
|
|
137
|
+
| `send_token` | Send any registry token to a recipient | `tokenSymbol`, `chainId`, `recipientAddress`, `amount` |
|
|
138
|
+
| `get_balances` | Get balances for multiple tokens | `chainId`, `tokens?` |
|
|
139
|
+
| `swap_tokens` | Swap tokens via Uniswap V3 | `fromSymbol`, `toSymbol`, `amount`, `chainId`, `slippageBps?` |
|
|
140
|
+
| `bridge_usdc` | Bridge USDC cross-chain via CCTP V2 | `fromChain`, `toChain`, `amount` |
|
|
141
|
+
| `set_spend_policy` | Configure daily limits and recipient allowlists | `dailyLimitEth?`, `perTxCapEth?`, `allowedRecipients?` |
|
|
142
|
+
| `check_budget` | Query on-chain remaining budget | `token?`, `spender?` |
|
|
143
|
+
| `verify_agent_identity` | Verify agent ERC-8004 on-chain identity | `agentAddress` |
|
|
144
|
+
| `get_reputation` | Fetch agent reputation score | `agentAddress` |
|
|
145
|
+
| `create_escrow` | Create mutual-stake USDC escrow vault | `counterpartyAddress`, `stakeAmount`, `terms`, `factoryAddress?`, `deadlineDays?`, `challengeWindowHours?` |
|
|
146
|
+
|
|
147
|
+
---
|
|
107
148
|
|
|
108
|
-
|
|
149
|
+
## Detailed Tool Documentation
|
|
109
150
|
|
|
110
|
-
|
|
151
|
+
### `deploy_wallet`
|
|
111
152
|
|
|
112
|
-
|
|
153
|
+
Deploy a new AgentAccountV2 smart contract wallet. The wallet is deterministically addressed (CREATE2) and owned by an NFT.
|
|
113
154
|
|
|
155
|
+
**Parameters:**
|
|
156
|
+
| Name | Type | Required | Description |
|
|
157
|
+
|---|---|---|---|
|
|
158
|
+
| `token_id` | string | ✅ | NFT token ID that will own the wallet (e.g. `"1"`) |
|
|
159
|
+
| `nft_contract_address` | string | ❌ | NFT contract address (defaults to `NFT_CONTRACT_ADDRESS` env) |
|
|
160
|
+
| `factory_address` | string | ❌ | Factory contract address (defaults to `FACTORY_ADDRESS` env) |
|
|
161
|
+
|
|
162
|
+
**Example:**
|
|
114
163
|
```json
|
|
164
|
+
// Request
|
|
165
|
+
{ "token_id": "42" }
|
|
166
|
+
|
|
167
|
+
// Response
|
|
115
168
|
{
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
169
|
+
"walletAddress": "0xabc...def",
|
|
170
|
+
"txHash": "0x123...456",
|
|
171
|
+
"explorerUrl": "https://basescan.org/address/0xabc...def"
|
|
119
172
|
}
|
|
120
173
|
```
|
|
121
174
|
|
|
122
|
-
|
|
175
|
+
---
|
|
123
176
|
|
|
124
|
-
|
|
125
|
-
✅ Agent Wallet deployed successfully!
|
|
177
|
+
### `get_wallet_info`
|
|
126
178
|
|
|
127
|
-
|
|
128
|
-
🔗 Explorer: https://basescan.org/address/0xabc...
|
|
179
|
+
Get comprehensive wallet information: address, on-chain balance, spend limits, period utilization, and pending queue depth.
|
|
129
180
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
181
|
+
**Parameters:**
|
|
182
|
+
| Name | Type | Required | Description |
|
|
183
|
+
|---|---|---|---|
|
|
184
|
+
| `token` | string | ❌ | Token address to check budget for. Omit for ETH. |
|
|
185
|
+
|
|
186
|
+
**Example:**
|
|
187
|
+
```json
|
|
188
|
+
// Request
|
|
189
|
+
{}
|
|
133
190
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
191
|
+
// Response (text)
|
|
192
|
+
"📊 Agent Wallet Info
|
|
193
|
+
📍 Address: 0xabc...def
|
|
194
|
+
🌐 Chain: Base Mainnet
|
|
195
|
+
💰 ETH Balance: 0.05 ETH
|
|
196
|
+
📈 Spend Limits (ETH)
|
|
197
|
+
Per-tx limit: 0.01 ETH
|
|
198
|
+
Period limit: 0.1 ETH
|
|
199
|
+
Remaining: 0.085 ETH
|
|
200
|
+
Utilization: 15% 🟢"
|
|
138
201
|
```
|
|
139
202
|
|
|
140
203
|
---
|
|
141
204
|
|
|
142
|
-
###
|
|
205
|
+
### `send_payment`
|
|
143
206
|
|
|
144
|
-
|
|
207
|
+
Execute an ETH or ERC-20 transfer via the AgentAccountV2 contract. Subject to on-chain spend limits.
|
|
145
208
|
|
|
146
|
-
**
|
|
209
|
+
**Parameters:**
|
|
210
|
+
| Name | Type | Required | Description |
|
|
211
|
+
|---|---|---|---|
|
|
212
|
+
| `to` | string | ✅ | Recipient address (0x-prefixed) |
|
|
213
|
+
| `amount_eth` | string | ✅ | Amount in ETH (or token's human-readable units) |
|
|
214
|
+
| `token` | string | ❌ | ERC-20 contract address. Omit for native ETH. |
|
|
215
|
+
| `token_decimals` | number | ❌ | Token decimals (default: 18; use 6 for USDC) |
|
|
216
|
+
| `memo` | string | ❌ | Optional memo (logged locally, not on-chain) |
|
|
147
217
|
|
|
218
|
+
**Example:**
|
|
148
219
|
```json
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
220
|
+
// Request
|
|
221
|
+
{ "to": "0xrecipient...", "amount_eth": "0.01" }
|
|
222
|
+
|
|
223
|
+
// Response
|
|
224
|
+
"✅ Payment sent: 0.01 ETH → 0xrecipient...
|
|
225
|
+
Tx: 0xtxhash..."
|
|
152
226
|
```
|
|
153
227
|
|
|
154
|
-
|
|
228
|
+
---
|
|
155
229
|
|
|
156
|
-
|
|
230
|
+
### `check_spend_limit`
|
|
157
231
|
|
|
158
|
-
|
|
159
|
-
📊 Agent Wallet Info
|
|
232
|
+
Check the remaining spend limit for the current period for a given token.
|
|
160
233
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
234
|
+
**Parameters:**
|
|
235
|
+
| Name | Type | Required | Description |
|
|
236
|
+
|---|---|---|---|
|
|
237
|
+
| `token` | string | ❌ | Token address (omit for ETH) |
|
|
164
238
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### `queue_approval`
|
|
242
|
+
|
|
243
|
+
Approve or cancel a queued transaction that exceeded the per-tx cap.
|
|
244
|
+
|
|
245
|
+
**Parameters:**
|
|
246
|
+
| Name | Type | Required | Description |
|
|
247
|
+
|---|---|---|---|
|
|
248
|
+
| `action` | string | ✅ | `"approve"` or `"cancel"` |
|
|
249
|
+
| `tx_id` | string | ✅ | Queued transaction ID |
|
|
250
|
+
| `token` | string | ❌ | Token address (omit for ETH) |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### `x402_pay`
|
|
255
|
+
|
|
256
|
+
Fetch a URL, automatically handling HTTP 402 Payment Required by paying with the Agent Wallet and retrying. Supports auto-session detection — if an active session covers the URL, no new payment is made.
|
|
257
|
+
|
|
258
|
+
**Parameters:**
|
|
259
|
+
| Name | Type | Required | Description |
|
|
260
|
+
|---|---|---|---|
|
|
261
|
+
| `url` | string | ✅ | URL to fetch |
|
|
262
|
+
| `method` | string | ❌ | HTTP method (default: `GET`) |
|
|
263
|
+
| `headers` | object | ❌ | Additional request headers |
|
|
264
|
+
| `body` | string | ❌ | Request body (JSON string for JSON APIs) |
|
|
265
|
+
| `max_payment_eth` | string | ❌ | Max ETH to pay (rejects if exceeded) |
|
|
266
|
+
| `timeout_ms` | number | ❌ | Timeout in ms (default: 30000) |
|
|
267
|
+
| `skip_session_check` | boolean | ❌ | Force fresh payment even if session exists |
|
|
268
|
+
|
|
269
|
+
**Example:**
|
|
270
|
+
```json
|
|
271
|
+
// Request
|
|
272
|
+
{ "url": "https://api.example.com/data", "max_payment_eth": "0.001" }
|
|
273
|
+
|
|
274
|
+
// Response
|
|
275
|
+
{ "status": 200, "body": "{ ... }" }
|
|
173
276
|
```
|
|
174
277
|
|
|
175
278
|
---
|
|
176
279
|
|
|
177
|
-
###
|
|
280
|
+
### `get_transaction_history`
|
|
178
281
|
|
|
179
|
-
|
|
282
|
+
Query on-chain event logs for the wallet's transaction history. Filter by event type or block range.
|
|
180
283
|
|
|
181
|
-
**
|
|
284
|
+
**Parameters:**
|
|
285
|
+
| Name | Type | Required | Description |
|
|
286
|
+
|---|---|---|---|
|
|
287
|
+
| `limit` | number | ❌ | Max entries (default: 20, max: 100) |
|
|
288
|
+
| `from_block` | string | ❌ | Start block number (hex or decimal) |
|
|
289
|
+
| `to_block` | string | ❌ | End block (default: latest) |
|
|
290
|
+
| `event_type` | string | ❌ | Filter: `all`, `execution`, `queued`, `approved`, `cancelled`, `policy_update`, `operator_update` |
|
|
182
291
|
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
### `x402_session_start`
|
|
295
|
+
|
|
296
|
+
Pay once, receive a signed x402 V2 session token. Subsequent requests to the endpoint use the session token without additional payments.
|
|
297
|
+
|
|
298
|
+
**Parameters:**
|
|
299
|
+
| Name | Type | Required | Description |
|
|
300
|
+
|---|---|---|---|
|
|
301
|
+
| `endpoint` | string | ✅ | Base URL to establish a session for |
|
|
302
|
+
| `scope` | string | ❌ | `"prefix"` (default) or `"exact"` |
|
|
303
|
+
| `ttl_seconds` | number | ❌ | Session lifetime in seconds (min: 60, max: 2592000) |
|
|
304
|
+
| `label` | string | ❌ | Human-readable session label |
|
|
305
|
+
|
|
306
|
+
**Example:**
|
|
183
307
|
```json
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
308
|
+
// Request
|
|
309
|
+
{ "endpoint": "https://api.example.com/", "ttl_seconds": 3600 }
|
|
310
|
+
|
|
311
|
+
// Response
|
|
312
|
+
{ "session_id": "sess_abc123", "token": "eyJ...", "expires_at": 1741000000 }
|
|
189
313
|
```
|
|
190
314
|
|
|
191
|
-
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### `x402_session_fetch`
|
|
318
|
+
|
|
319
|
+
Make an HTTP call within an active session. No new payment required.
|
|
320
|
+
|
|
321
|
+
**Parameters:**
|
|
322
|
+
| Name | Type | Required | Description |
|
|
323
|
+
|---|---|---|---|
|
|
324
|
+
| `url` | string | ✅ | URL to fetch within the session |
|
|
325
|
+
| `method` | string | ❌ | HTTP method (default: `GET`) |
|
|
326
|
+
| `headers` | object | ❌ | Additional headers |
|
|
327
|
+
| `body` | string | ❌ | Request body |
|
|
328
|
+
| `session_id` | string | ❌ | Explicit session ID (auto-detected if omitted) |
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### `x402_session_status`
|
|
333
|
+
|
|
334
|
+
Inspect active sessions, TTL remaining, and call counts.
|
|
335
|
+
|
|
336
|
+
**Parameters:**
|
|
337
|
+
| Name | Type | Required | Description |
|
|
338
|
+
|---|---|---|---|
|
|
339
|
+
| `session_id` | string | ❌ | Specific session to inspect (omit for all active sessions) |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
### `x402_session_end`
|
|
344
|
+
|
|
345
|
+
Explicitly close and invalidate a session.
|
|
346
|
+
|
|
347
|
+
**Parameters:**
|
|
348
|
+
| Name | Type | Required | Description |
|
|
349
|
+
|---|---|---|---|
|
|
350
|
+
| `session_id` | string | ✅ | Session ID to close |
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### `lookup_token`
|
|
355
|
+
|
|
356
|
+
Look up a token's address, decimals, and metadata from the global token registry by symbol and chain.
|
|
357
|
+
|
|
358
|
+
**Parameters:**
|
|
359
|
+
| Name | Type | Required | Description |
|
|
360
|
+
|---|---|---|---|
|
|
361
|
+
| `symbol` | string | ✅ | Token symbol (e.g. `"USDC"`, `"WETH"`) |
|
|
362
|
+
| `chainId` | number | ✅ | Chain ID (e.g. `8453` for Base Mainnet) |
|
|
192
363
|
|
|
364
|
+
**Example:**
|
|
193
365
|
```json
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
366
|
+
// Request
|
|
367
|
+
{ "symbol": "USDC", "chainId": 8453 }
|
|
368
|
+
|
|
369
|
+
// Response
|
|
370
|
+
{ "found": true, "symbol": "USDC", "address": "0x833589...", "decimals": 6, "chainId": 8453 }
|
|
200
371
|
```
|
|
201
372
|
|
|
202
|
-
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
### `add_custom_token`
|
|
376
|
+
|
|
377
|
+
Register a custom ERC-20 token in the global registry so it can be used by `send_token`, `get_balances`, and `swap_tokens`.
|
|
203
378
|
|
|
204
|
-
|
|
205
|
-
|
|
379
|
+
**Parameters:**
|
|
380
|
+
| Name | Type | Required | Description |
|
|
381
|
+
|---|---|---|---|
|
|
382
|
+
| `symbol` | string | ✅ | Token symbol |
|
|
383
|
+
| `address` | string | ✅ | Contract address (0x-prefixed) |
|
|
384
|
+
| `decimals` | number | ✅ | Token decimal precision (0–18) |
|
|
385
|
+
| `chainId` | number | ✅ | Chain ID |
|
|
386
|
+
| `name` | string | ❌ | Human-readable token name |
|
|
206
387
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
388
|
+
**Example:**
|
|
389
|
+
```json
|
|
390
|
+
// Request
|
|
391
|
+
{ "symbol": "MYTKN", "address": "0xabc...", "decimals": 18, "chainId": 8453 }
|
|
392
|
+
|
|
393
|
+
// Response
|
|
394
|
+
{ "success": true, "message": "Token MYTKN registered on chain 8453" }
|
|
213
395
|
```
|
|
214
396
|
|
|
215
|
-
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### `list_chain_tokens`
|
|
400
|
+
|
|
401
|
+
List all tokens registered in the global registry for a specific chain.
|
|
402
|
+
|
|
403
|
+
**Parameters:**
|
|
404
|
+
| Name | Type | Required | Description |
|
|
405
|
+
|---|---|---|---|
|
|
406
|
+
| `chainId` | number | ✅ | Chain ID (e.g. `8453`) |
|
|
407
|
+
|
|
408
|
+
**Example:**
|
|
409
|
+
```json
|
|
410
|
+
// Request
|
|
411
|
+
{ "chainId": 8453 }
|
|
412
|
+
|
|
413
|
+
// Response
|
|
414
|
+
{ "chainId": 8453, "count": 47, "tokens": [{ "symbol": "USDC", "address": "0x833589...", "decimals": 6 }, ...] }
|
|
415
|
+
```
|
|
216
416
|
|
|
217
417
|
---
|
|
218
418
|
|
|
219
|
-
###
|
|
419
|
+
### `send_token`
|
|
220
420
|
|
|
221
|
-
|
|
421
|
+
Send any ERC-20 token using the symbol-based registry. Resolves address and decimals automatically.
|
|
222
422
|
|
|
223
|
-
**
|
|
423
|
+
**Parameters:**
|
|
424
|
+
| Name | Type | Required | Description |
|
|
425
|
+
|---|---|---|---|
|
|
426
|
+
| `tokenSymbol` | string | ✅ | Token symbol (e.g. `"USDC"`) |
|
|
427
|
+
| `chainId` | number | ✅ | Chain ID |
|
|
428
|
+
| `recipientAddress` | string | ✅ | Recipient wallet address (0x-prefixed) |
|
|
429
|
+
| `amount` | string | ✅ | Amount in human-readable units (e.g. `"10.5"`) |
|
|
224
430
|
|
|
431
|
+
**Example:**
|
|
225
432
|
```json
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
433
|
+
// Request
|
|
434
|
+
{ "tokenSymbol": "USDC", "chainId": 8453, "recipientAddress": "0xrecipient...", "amount": "100" }
|
|
435
|
+
|
|
436
|
+
// Response
|
|
437
|
+
{ "success": true, "txHash": "0x...", "amount": "100", "token": "USDC", "recipient": "0xrecipient..." }
|
|
229
438
|
```
|
|
230
439
|
|
|
231
|
-
|
|
440
|
+
---
|
|
232
441
|
|
|
233
|
-
|
|
234
|
-
🔍 Spend Limit Check
|
|
442
|
+
### `get_balances`
|
|
235
443
|
|
|
236
|
-
|
|
237
|
-
Amount: 0.005 ETH
|
|
444
|
+
Get token balances for the Agent Wallet across one or more tokens on a given chain.
|
|
238
445
|
|
|
239
|
-
|
|
240
|
-
|
|
446
|
+
**Parameters:**
|
|
447
|
+
| Name | Type | Required | Description |
|
|
448
|
+
|---|---|---|---|
|
|
449
|
+
| `chainId` | number | ✅ | Chain ID |
|
|
450
|
+
| `tokens` | string[] | ❌ | Token symbols to check (omit for all registered tokens on chain) |
|
|
241
451
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
452
|
+
**Example:**
|
|
453
|
+
```json
|
|
454
|
+
// Request
|
|
455
|
+
{ "chainId": 8453, "tokens": ["USDC", "WETH"] }
|
|
245
456
|
|
|
246
|
-
|
|
457
|
+
// Response
|
|
458
|
+
{ "balances": [{ "symbol": "USDC", "balance": "500.00", "decimals": 6 }, { "symbol": "WETH", "balance": "0.05", "decimals": 18 }] }
|
|
247
459
|
```
|
|
248
460
|
|
|
249
461
|
---
|
|
250
462
|
|
|
251
|
-
###
|
|
463
|
+
### `swap_tokens`
|
|
252
464
|
|
|
253
|
-
|
|
465
|
+
Swap one ERC-20 token for another using Uniswap V3. Supported chains: Base, Arbitrum, Optimism, Polygon.
|
|
254
466
|
|
|
255
|
-
**
|
|
467
|
+
**Parameters:**
|
|
468
|
+
| Name | Type | Required | Description |
|
|
469
|
+
|---|---|---|---|
|
|
470
|
+
| `fromSymbol` | string | ✅ | Symbol of token to sell (e.g. `"USDC"`) |
|
|
471
|
+
| `toSymbol` | string | ✅ | Symbol of token to buy (e.g. `"WETH"`) |
|
|
472
|
+
| `amount` | string | ✅ | Amount to sell in human-readable units |
|
|
473
|
+
| `chainId` | number | ✅ | Chain ID (8453, 42161, 10, or 137) |
|
|
474
|
+
| `slippageBps` | number | ❌ | Slippage in basis points (default: 50 = 0.5%) |
|
|
256
475
|
|
|
476
|
+
**Example:**
|
|
257
477
|
```json
|
|
258
|
-
|
|
478
|
+
// Request
|
|
479
|
+
{ "fromSymbol": "USDC", "toSymbol": "WETH", "amount": "100", "chainId": 8453 }
|
|
480
|
+
|
|
481
|
+
// Response
|
|
482
|
+
{ "success": true, "txHash": "0x...", "amountIn": "100 USDC", "amountOut": "0.0412 WETH" }
|
|
259
483
|
```
|
|
260
484
|
|
|
261
|
-
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
### `bridge_usdc`
|
|
488
|
+
|
|
489
|
+
Bridge USDC cross-chain using Circle's CCTP V2 protocol. Burns on source, polls Circle IRIS for attestation, mints on destination.
|
|
262
490
|
|
|
491
|
+
**Parameters:**
|
|
492
|
+
| Name | Type | Required | Description |
|
|
493
|
+
|---|---|---|---|
|
|
494
|
+
| `fromChain` | string | ✅ | Source chain name (e.g. `"base"`) |
|
|
495
|
+
| `toChain` | string | ✅ | Destination chain name (e.g. `"arbitrum"`) |
|
|
496
|
+
| `amount` | string | ✅ | Amount of USDC in human-readable units (e.g. `"100"`) |
|
|
497
|
+
|
|
498
|
+
Supported chains: `base`, `ethereum`, `optimism`, `arbitrum`, `polygon`, `avalanche`, `linea`, `unichain`, `sonic`, `worldchain`
|
|
499
|
+
|
|
500
|
+
**Example:**
|
|
263
501
|
```json
|
|
264
|
-
|
|
502
|
+
// Request
|
|
503
|
+
{ "fromChain": "base", "toChain": "arbitrum", "amount": "500" }
|
|
504
|
+
|
|
505
|
+
// Response
|
|
506
|
+
{ "success": true, "burnTxHash": "0x...", "mintTxHash": "0x...", "amount": "500 USDC" }
|
|
265
507
|
```
|
|
266
508
|
|
|
267
|
-
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
### `set_spend_policy`
|
|
512
|
+
|
|
513
|
+
Configure the Agent Wallet spend policy. Sets a daily limit, per-transaction cap, and optional recipient allowlist. Enforced for the lifetime of the MCP server.
|
|
268
514
|
|
|
515
|
+
**Parameters:**
|
|
516
|
+
| Name | Type | Required | Description |
|
|
517
|
+
|---|---|---|---|
|
|
518
|
+
| `dailyLimitEth` | string | ❌ | Daily spend limit in ETH-equivalent (e.g. `"0.1"`) |
|
|
519
|
+
| `perTxCapEth` | string | ❌ | Per-transaction cap in ETH-equivalent (e.g. `"0.01"`) |
|
|
520
|
+
| `allowedRecipients` | string[] | ❌ | Allowlist of recipient addresses. Empty = all allowed. |
|
|
521
|
+
|
|
522
|
+
**Example:**
|
|
269
523
|
```json
|
|
270
|
-
|
|
524
|
+
// Request
|
|
525
|
+
{ "dailyLimitEth": "0.5", "perTxCapEth": "0.05", "allowedRecipients": ["0xrecipient..."] }
|
|
526
|
+
|
|
527
|
+
// Response
|
|
528
|
+
{ "success": true, "policy": { "dailyLimitEth": "0.5", "perTxCapEth": "0.05" } }
|
|
271
529
|
```
|
|
272
530
|
|
|
273
531
|
---
|
|
274
532
|
|
|
275
|
-
###
|
|
533
|
+
### `check_budget`
|
|
276
534
|
|
|
277
|
-
|
|
535
|
+
Query the on-chain remaining budget for a given spender and token.
|
|
278
536
|
|
|
279
|
-
**
|
|
537
|
+
**Parameters:**
|
|
538
|
+
| Name | Type | Required | Description |
|
|
539
|
+
|---|---|---|---|
|
|
540
|
+
| `token` | string | ❌ | Token address (omit for ETH / zero address) |
|
|
541
|
+
| `spender` | string | ❌ | Spender address (defaults to Agent Wallet address) |
|
|
280
542
|
|
|
543
|
+
**Example:**
|
|
281
544
|
```json
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
545
|
+
// Request
|
|
546
|
+
{}
|
|
547
|
+
|
|
548
|
+
// Response
|
|
549
|
+
{ "remaining": "0.085 ETH", "spent": "0.015 ETH", "limit": "0.1 ETH", "periodEnds": "2026-03-23T00:00:00Z" }
|
|
287
550
|
```
|
|
288
551
|
|
|
289
552
|
---
|
|
290
553
|
|
|
291
|
-
###
|
|
554
|
+
### `verify_agent_identity`
|
|
292
555
|
|
|
293
|
-
|
|
556
|
+
Verify an agent's on-chain identity using ERC-8004. Returns identity details including agent ID, URI, and registration file.
|
|
294
557
|
|
|
295
|
-
**
|
|
558
|
+
**Parameters:**
|
|
559
|
+
| Name | Type | Required | Description |
|
|
560
|
+
|---|---|---|---|
|
|
561
|
+
| `agentAddress` | string | ✅ | Agent owner address (0x-prefixed) |
|
|
296
562
|
|
|
563
|
+
**Example:**
|
|
297
564
|
```json
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
565
|
+
// Request
|
|
566
|
+
{ "agentAddress": "0xagent..." }
|
|
567
|
+
|
|
568
|
+
// Response
|
|
569
|
+
{ "found": true, "agentId": "42", "owner": "0xagent...", "uri": "ipfs://Qm...", "registrationFile": { "name": "MyAgent", "version": "1.0" } }
|
|
302
570
|
```
|
|
303
571
|
|
|
304
572
|
---
|
|
305
573
|
|
|
306
|
-
|
|
574
|
+
### `get_reputation`
|
|
307
575
|
|
|
308
|
-
|
|
576
|
+
Fetch an agent's on-chain reputation score and history.
|
|
309
577
|
|
|
310
|
-
|
|
578
|
+
**Parameters:**
|
|
579
|
+
| Name | Type | Required | Description |
|
|
580
|
+
|---|---|---|---|
|
|
581
|
+
| `agentAddress` | string | ✅ | Agent address (0x-prefixed) |
|
|
311
582
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
583
|
+
**Example:**
|
|
584
|
+
```json
|
|
585
|
+
// Request
|
|
586
|
+
{ "agentAddress": "0xagent..." }
|
|
316
587
|
|
|
317
|
-
|
|
588
|
+
// Response
|
|
589
|
+
{ "agentAddress": "0xagent...", "score": 92, "level": "trusted", "totalInteractions": 1250, "successRate": 0.98 }
|
|
590
|
+
```
|
|
318
591
|
|
|
319
|
-
|
|
320
|
-
|--------|------------|
|
|
321
|
-
| Compromised agent private key | On-chain spend limits cap exposure |
|
|
322
|
-
| Runaway agent (infinite payment loop) | Period limits + queue-on-exceed |
|
|
323
|
-
| x402 price manipulation | `max_payment_eth` cap parameter |
|
|
324
|
-
| Over-spending a single service | x402 per-service budget controls |
|
|
325
|
-
| Lost private key | Owner (NFT holder) remains in control |
|
|
592
|
+
---
|
|
326
593
|
|
|
327
|
-
###
|
|
594
|
+
### `create_escrow`
|
|
328
595
|
|
|
329
|
-
|
|
596
|
+
Create a mutual-stake escrow vault between the Agent Wallet (buyer) and a counterparty (seller). Both parties lock collateral equal to the payment amount, ensuring aligned incentives. Uses USDC as the payment token.
|
|
330
597
|
|
|
331
|
-
|
|
598
|
+
**Parameters:**
|
|
599
|
+
| Name | Type | Required | Description |
|
|
600
|
+
|---|---|---|---|
|
|
601
|
+
| `counterpartyAddress` | string | ✅ | Seller/counterparty address (0x-prefixed) |
|
|
602
|
+
| `stakeAmount` | string | ✅ | Payment amount in USDC (e.g. `"100"`) |
|
|
603
|
+
| `terms` | string | ✅ | Human-readable escrow terms |
|
|
604
|
+
| `factoryAddress` | string | ❌ | StakeVaultFactory address (defaults to `FACTORY_ADDRESS` env) |
|
|
605
|
+
| `deadlineDays` | number | ❌ | Deadline in days (default: 7) |
|
|
606
|
+
| `challengeWindowHours` | number | ❌ | Challenge window in hours after fulfillment (default: 24) |
|
|
332
607
|
|
|
333
|
-
**
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
608
|
+
**Example:**
|
|
609
|
+
```json
|
|
610
|
+
// Request
|
|
611
|
+
{ "counterpartyAddress": "0xseller...", "stakeAmount": "100", "terms": "Deliver logo design by 2026-04-01" }
|
|
337
612
|
|
|
338
|
-
|
|
613
|
+
// Response
|
|
614
|
+
{ "success": true, "escrowAddress": "0xvault...", "txHash": "0x...", "deadline": "2026-03-29T00:00:00Z" }
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
---
|
|
339
618
|
|
|
340
|
-
|
|
619
|
+
## Supported Chains
|
|
620
|
+
|
|
621
|
+
| Chain | Chain ID | Features |
|
|
622
|
+
|---|---|---|
|
|
623
|
+
| Base Mainnet | 8453 | All features (recommended) |
|
|
624
|
+
| Ethereum Mainnet | 1 | Identity, bridge, transfers |
|
|
625
|
+
| Arbitrum One | 42161 | All features, swaps |
|
|
626
|
+
| Optimism | 10 | All features, swaps |
|
|
627
|
+
| Polygon | 137 | All features, swaps |
|
|
628
|
+
| Avalanche | 43114 | Bridge, transfers |
|
|
629
|
+
| Linea | 59144 | Bridge, transfers |
|
|
630
|
+
| Unichain | 1301 | Bridge, transfers |
|
|
631
|
+
| Sonic | 146 | Bridge, transfers |
|
|
632
|
+
| Worldchain | 480 | Bridge, transfers |
|
|
633
|
+
| Base Sepolia | 84532 | Testnet — all features |
|
|
634
|
+
| Arbitrum Sepolia | 421614 | Testnet — identity, transfers |
|
|
341
635
|
|
|
342
|
-
|
|
636
|
+
---
|
|
343
637
|
|
|
344
|
-
|
|
638
|
+
## Supported Tokens
|
|
345
639
|
|
|
346
|
-
|
|
640
|
+
AgentPay MCP ships with **100+ pre-loaded tokens** across all supported chains via `agentwallet-sdk`'s TokenRegistry. Common tokens available on every major chain include:
|
|
347
641
|
|
|
348
|
-
|
|
642
|
+
- **Stablecoins:** USDC, USDT, DAI, FRAX, LUSD
|
|
643
|
+
- **Native Wrapped:** WETH, WBTC, WMATIC, WAVAX
|
|
644
|
+
- **DeFi:** UNI, AAVE, LINK, CRV, LDO
|
|
645
|
+
- **L2 Tokens:** cbETH, rETH, weETH, ezETH
|
|
349
646
|
|
|
350
|
-
**
|
|
647
|
+
**Custom tokens** can be registered at runtime with `add_custom_token` and will be available to `send_token`, `get_balances`, and `swap_tokens` immediately.
|
|
351
648
|
|
|
352
649
|
---
|
|
353
650
|
|
|
354
651
|
## Configuration
|
|
355
652
|
|
|
356
|
-
|
|
|
357
|
-
|
|
358
|
-
| `AGENT_PRIVATE_KEY` | ✅ | — | Agent
|
|
653
|
+
| Env Var | Required | Default | Description |
|
|
654
|
+
|---|---|---|---|
|
|
655
|
+
| `AGENT_PRIVATE_KEY` | ✅ | — | Agent signing key (0x-prefixed hex). NOT the owner key. |
|
|
359
656
|
| `AGENT_WALLET_ADDRESS` | ✅ | — | Deployed AgentAccountV2 contract address |
|
|
360
|
-
| `CHAIN_ID` |
|
|
361
|
-
| `RPC_URL` |
|
|
362
|
-
| `
|
|
363
|
-
| `
|
|
364
|
-
|
|
365
|
-
> **Minimum to get started:** Just `AGENT_PRIVATE_KEY` + `AGENT_WALLET_ADDRESS`. Everything else has sensible defaults.
|
|
657
|
+
| `CHAIN_ID` | ❌ | `8453` | Chain ID (8453 = Base Mainnet) |
|
|
658
|
+
| `RPC_URL` | ❌ | Public Base RPC | Custom RPC endpoint (Alchemy, Infura, etc. recommended) |
|
|
659
|
+
| `SESSION_TTL_SECONDS` | ❌ | `3600` | Default x402 session lifetime (60–2592000 seconds) |
|
|
660
|
+
| `FACTORY_ADDRESS` | ❌ | — | AgentAccountFactoryV2 address (for `deploy_wallet`, `create_escrow`) |
|
|
661
|
+
| `NFT_CONTRACT_ADDRESS` | ❌ | — | NFT contract address (for `deploy_wallet`) |
|
|
366
662
|
|
|
367
663
|
---
|
|
368
664
|
|
|
369
|
-
##
|
|
665
|
+
## Security
|
|
370
666
|
|
|
371
|
-
###
|
|
667
|
+
### Non-Custodial Design
|
|
372
668
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
669
|
+
AgentPay MCP is **non-custodial** — the agent signs all transactions locally with its private key. No third party holds or validates keys at any point.
|
|
670
|
+
|
|
671
|
+
### On-Chain Spending Controls
|
|
672
|
+
|
|
673
|
+
- **Per-transaction caps** — transactions exceeding the cap are queued for human approval via `queue_approval`
|
|
674
|
+
- **Daily period limits** — aggregate spending is enforced on-chain by the AgentAccountV2 contract
|
|
675
|
+
- **Recipient allowlists** — restrict which addresses the agent can send to via `set_spend_policy`
|
|
676
|
+
|
|
677
|
+
### Separation of Roles
|
|
678
|
+
|
|
679
|
+
The agent's signing key (`AGENT_PRIVATE_KEY`) can **only** transact within the limits set by the wallet owner. The owner (NFT holder) can:
|
|
680
|
+
- Adjust spend limits without redeploying
|
|
681
|
+
- Revoke the agent's operator access
|
|
682
|
+
- Cancel queued transactions
|
|
683
|
+
|
|
684
|
+
This means even if the agent's key is compromised, the attacker can only spend up to the configured limit.
|
|
685
|
+
|
|
686
|
+
### x402 Session Tokens
|
|
687
|
+
|
|
688
|
+
Session tokens are self-contained ECDSA-signed claims. Any server implementing x402 V2 can independently verify them — no central session store required.
|
|
689
|
+
|
|
690
|
+
---
|
|
691
|
+
|
|
692
|
+
## Architecture
|
|
693
|
+
|
|
694
|
+
```
|
|
695
|
+
┌─────────────────────────────────────────┐
|
|
696
|
+
│ AI Agent (Claude / Cursor / Windsurf) │
|
|
697
|
+
└────────────────┬────────────────────────┘
|
|
698
|
+
│ MCP (stdio/SSE)
|
|
699
|
+
┌────────────────▼────────────────────────┐
|
|
700
|
+
│ AgentPay MCP Server │
|
|
701
|
+
│ ┌────────────┐ ┌────────────────────┐ │
|
|
702
|
+
│ │ 23 Tools │ │ Session Manager │ │
|
|
703
|
+
│ └─────┬──────┘ └────────────────────┘ │
|
|
704
|
+
│ │ │
|
|
705
|
+
│ ┌─────▼──────────────────────────────┐ │
|
|
706
|
+
│ │ agentwallet-sdk v6.0.0 │ │
|
|
707
|
+
│ │ TokenRegistry SwapModule │ │
|
|
708
|
+
│ │ BridgeModule ERC8004Client │ │
|
|
709
|
+
│ │ ReputationClient MutualStake... │ │
|
|
710
|
+
│ └─────┬──────────────────────────────┘ │
|
|
711
|
+
└────────┼────────────────────────────────┘
|
|
712
|
+
│ viem + RPC
|
|
713
|
+
┌────────▼────────────────────────────────┐
|
|
714
|
+
│ AgentAccountV2 Smart Contract │
|
|
715
|
+
│ (12 chains — Base, ETH, ARB, OP, ...) │
|
|
716
|
+
└─────────────────────────────────────────┘
|
|
387
717
|
```
|
|
388
718
|
|
|
719
|
+
**MCP Transport:** The server uses `stdio` transport by default (compatible with Claude Desktop, Cursor, Windsurf, any MCP-compatible host). SSE transport is available for remote/networked deployments.
|
|
720
|
+
|
|
721
|
+
**Tool Routing:** Each MCP tool call is routed to the corresponding handler in `src/tools/`. All handlers are typed with Zod schemas and return structured `{ content: [{ type: "text", text: "..." }] }` responses.
|
|
722
|
+
|
|
723
|
+
**Token Resolution:** `send_token`, `get_balances`, and `swap_tokens` use the agentwallet-sdk `TokenRegistry` to resolve symbols to on-chain addresses and decimals, eliminating the need for agents to manage contract addresses manually.
|
|
724
|
+
|
|
389
725
|
---
|
|
390
726
|
|
|
391
|
-
##
|
|
727
|
+
## Contributing
|
|
392
728
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
-
|
|
729
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on submitting issues and pull requests.
|
|
730
|
+
|
|
731
|
+
```bash
|
|
732
|
+
git clone https://github.com/up2itnow0822/agentpay-mcp
|
|
733
|
+
cd agentpay-mcp
|
|
734
|
+
npm install
|
|
735
|
+
npm run build
|
|
736
|
+
npm test
|
|
737
|
+
```
|
|
398
738
|
|
|
399
739
|
---
|
|
400
740
|
|
|
401
741
|
## License
|
|
402
742
|
|
|
403
|
-
MIT
|
|
743
|
+
MIT © [AI Agent Economy](https://ai-agent-economy.com)
|
|
744
|
+
|
|
745
|
+
---
|
|
746
|
+
|
|
747
|
+
## About
|
|
748
|
+
|
|
749
|
+
Built by **AI Agent Economy** — infrastructure for autonomous agent commerce.
|
|
750
|
+
|
|
751
|
+
> Payment infrastructure integrated into **NVIDIA's official NeMo Agent Toolkit Examples catalog**.
|
|
752
|
+
|
|
753
|
+
**Patent Pending** — USPTO provisional application filed March 2026.
|