agentpay-mcp 1.2.0 → 3.1.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/.env.example +37 -0
- package/LICENSE +21 -0
- package/README.md +380 -31
- package/claude_desktop_config.json +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/session/manager.d.ts +90 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +262 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/types.d.ts +113 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +16 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tools/deploy.d.ts +49 -0
- package/dist/tools/deploy.d.ts.map +1 -0
- package/dist/tools/deploy.js +123 -0
- package/dist/tools/deploy.js.map +1 -0
- package/dist/tools/history.d.ts +59 -0
- package/dist/tools/history.d.ts.map +1 -0
- package/dist/tools/history.js +202 -0
- package/dist/tools/history.js.map +1 -0
- package/dist/tools/payments.d.ts +71 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +158 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/session.d.ts +240 -0
- package/dist/tools/session.d.ts.map +1 -0
- package/dist/tools/session.js +678 -0
- package/dist/tools/session.js.map +1 -0
- package/dist/tools/wallet.d.ts +107 -0
- package/dist/tools/wallet.d.ts.map +1 -0
- package/dist/tools/wallet.js +271 -0
- package/dist/tools/wallet.js.map +1 -0
- package/dist/tools/x402.d.ts +90 -0
- package/dist/tools/x402.d.ts.map +1 -0
- package/dist/tools/x402.js +268 -0
- package/dist/tools/x402.js.map +1 -0
- package/dist/utils/client.d.ts +46 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +123 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/format.d.ts +59 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +161 -0
- package/dist/utils/format.js.map +1 -0
- package/package.json +58 -12
- package/index.d.ts +0 -1
- package/index.js +0 -13
package/.env.example
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ClawPay MCP — Environment Configuration
|
|
2
|
+
# Copy to .env and fill in your values
|
|
3
|
+
# Minimum required: AGENT_PRIVATE_KEY + AGENT_WALLET_ADDRESS (CHAIN_ID defaults to Base Mainnet)
|
|
4
|
+
|
|
5
|
+
# ─── Required ───────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
# Agent hot wallet private key (hex, 0x-prefixed)
|
|
8
|
+
# This is the agent's signing key, NOT the owner's key.
|
|
9
|
+
# The on-chain spend limits protect you — the owner controls limits via NFT ownership.
|
|
10
|
+
AGENT_PRIVATE_KEY=0x...
|
|
11
|
+
|
|
12
|
+
# Deployed AgentAccountV2 wallet address
|
|
13
|
+
AGENT_WALLET_ADDRESS=0x...
|
|
14
|
+
|
|
15
|
+
# ─── Optional (have sensible defaults) ───────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
# Chain ID: 8453 = Base Mainnet (default), 84532 = Base Sepolia testnet
|
|
18
|
+
CHAIN_ID=8453
|
|
19
|
+
|
|
20
|
+
# Custom RPC URL (defaults to public Base RPC if not set)
|
|
21
|
+
# Recommended: Use a dedicated node (Alchemy, Infura, Coinbase Developer Platform)
|
|
22
|
+
RPC_URL=https://mainnet.base.org
|
|
23
|
+
|
|
24
|
+
# ─── Optional: x402 V2 Session Payments (v1.1.0) ─────────────────────────────
|
|
25
|
+
|
|
26
|
+
# Session lifetime in seconds for x402 V2 sessions (default: 3600 = 1 hour)
|
|
27
|
+
# Agents pay once per session; all calls within the session use the session token.
|
|
28
|
+
# Min: 60s | Max: 2592000 (30 days)
|
|
29
|
+
SESSION_TTL_SECONDS=3600
|
|
30
|
+
|
|
31
|
+
# ─── Optional: Factory (only needed for deploy_wallet tool) ──────────────────
|
|
32
|
+
|
|
33
|
+
# AgentAccountFactoryV2 address (Base Mainnet default below)
|
|
34
|
+
FACTORY_ADDRESS=0x...
|
|
35
|
+
|
|
36
|
+
# NFT contract address (for deploy_wallet — the NFT that becomes the wallet owner)
|
|
37
|
+
NFT_CONTRACT_ADDRESS=0x...
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 up2itnow0822
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,54 +1,403 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AgentPay MCP
|
|
2
2
|
|
|
3
|
-
Non-custodial x402 payment layer for AI agents.
|
|
3
|
+
> _Formerly ClawPay MCP_ — Non-custodial x402 payment layer for AI agents. Base (live), Etherlink, Polygon, and Stellar (coming Q2 2026).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/agentpay-mcp)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://modelcontextprotocol.io)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
> **Migration notice:** The npm package has been renamed from `clawpay-mcp` to `agentpay-mcp`. Install with `npm install -g agentpay-mcp`. The old package name will continue to redirect but receives no further updates.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What is AgentPay MCP?
|
|
14
|
+
|
|
15
|
+
AgentPay MCP is a [Model Context Protocol](https://modelcontextprotocol.io) 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.
|
|
16
|
+
|
|
17
|
+
**Key properties:**
|
|
18
|
+
|
|
19
|
+
- 🔐 **Non-custodial** — You hold your keys. The wallet is a smart contract you own via NFT.
|
|
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)
|
|
23
|
+
|
|
24
|
+
**Part of the [Agent Wallet](https://github.com/up2itnow0822/agent-wallet-sdk) ecosystem.**
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## x402 Multi-Chain Support
|
|
29
|
+
|
|
30
|
+
x402 is live on multiple chains, and AgentPay MCP is designed to be the abstraction layer so your agent doesn't need chain-specific payment code.
|
|
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.
|
|
8
43
|
|
|
9
44
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
npm install @agenteconomy/pay
|
|
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" })
|
|
13
47
|
```
|
|
14
48
|
|
|
15
|
-
|
|
49
|
+
**Multi-chain roadmap:**
|
|
50
|
+
1. Base - live now
|
|
51
|
+
2. Etherlink - Q2 2026
|
|
52
|
+
3. Polygon - Q2 2026
|
|
53
|
+
4. Stellar - Q2 2026
|
|
16
54
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- **USDC on Base** — stable, fast, low-fee
|
|
21
|
-
- **Spend limits** — on-chain enforcement via ERC-6551
|
|
55
|
+
Want a specific chain prioritized? [Open an issue](https://github.com/up2itnow0822/agentpay-mcp/issues).
|
|
56
|
+
|
|
57
|
+
---
|
|
22
58
|
|
|
23
59
|
## Quick Start
|
|
24
60
|
|
|
25
|
-
|
|
26
|
-
const { AgentPay } = require('agentpay-mcp');
|
|
61
|
+
### 1. Install
|
|
27
62
|
|
|
28
|
-
|
|
29
|
-
|
|
63
|
+
```bash
|
|
64
|
+
npm install -g agentpay-mcp
|
|
30
65
|
```
|
|
31
66
|
|
|
32
|
-
|
|
67
|
+
### 2. Configure environment
|
|
68
|
+
|
|
69
|
+
Create a `.env` file (or set env vars for your MCP client):
|
|
33
70
|
|
|
34
71
|
```bash
|
|
35
|
-
|
|
36
|
-
|
|
72
|
+
# Required
|
|
73
|
+
AGENT_PRIVATE_KEY=0x... # Agent hot wallet private key
|
|
74
|
+
AGENT_WALLET_ADDRESS=0x... # Your deployed AgentAccountV2 address
|
|
75
|
+
|
|
76
|
+
# Optional (defaults shown)
|
|
77
|
+
CHAIN_ID=8453 # 8453 = Base Mainnet, 84532 = Base Sepolia
|
|
78
|
+
RPC_URL=https://mainnet.base.org
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> **Security note:** `AGENT_PRIVATE_KEY` is 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.
|
|
82
|
+
|
|
83
|
+
### 3. Add to Claude Desktop
|
|
84
|
+
|
|
85
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"agentpay": {
|
|
91
|
+
"command": "agentpay-mcp",
|
|
92
|
+
"env": {
|
|
93
|
+
"AGENT_PRIVATE_KEY": "0x...",
|
|
94
|
+
"AGENT_WALLET_ADDRESS": "0x...",
|
|
95
|
+
"CHAIN_ID": "8453"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then restart Claude Desktop. You'll see the 🔧 AgentPay tools available in your conversation.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Tools Reference
|
|
107
|
+
|
|
108
|
+
### 1. `deploy_wallet`
|
|
109
|
+
|
|
110
|
+
Deploy a new AgentAccountV2 wallet via the factory contract.
|
|
111
|
+
|
|
112
|
+
**Input:**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"token_id": "1",
|
|
117
|
+
"factory_address": "0x...",
|
|
118
|
+
"nft_contract_address": "0x..."
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Output:**
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
✅ Agent Wallet deployed successfully!
|
|
126
|
+
|
|
127
|
+
📍 Wallet Address: 0xabc...
|
|
128
|
+
🔗 Explorer: https://basescan.org/address/0xabc...
|
|
129
|
+
|
|
130
|
+
📋 Transaction: 0xdef...
|
|
131
|
+
🔑 Owner NFT: 0xnft... #1
|
|
132
|
+
🌐 Chain: Base Mainnet
|
|
133
|
+
|
|
134
|
+
ℹ️ Next steps:
|
|
135
|
+
1. Set AGENT_WALLET_ADDRESS=0xabc... in your .env
|
|
136
|
+
2. Use set_spend_policy to configure spending limits
|
|
137
|
+
3. Fund the wallet with ETH or USDC
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### 2. `get_wallet_info`
|
|
143
|
+
|
|
144
|
+
Get wallet address, balance, spend limits, and remaining allowance.
|
|
145
|
+
|
|
146
|
+
**Input:**
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"token": "0x0000000000000000000000000000000000000000"
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
*`token` is optional — omit for native ETH.*
|
|
155
|
+
|
|
156
|
+
**Output:**
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
📊 Agent Wallet Info
|
|
160
|
+
|
|
161
|
+
📍 Address: 0xabc...
|
|
162
|
+
🌐 Chain: Base Mainnet
|
|
163
|
+
💰 ETH Balance: 0.5 ETH
|
|
164
|
+
|
|
165
|
+
📈 Spend Limits (ETH)
|
|
166
|
+
Per-tx limit: 0.01 ETH
|
|
167
|
+
Period limit: 0.1 ETH
|
|
168
|
+
Period spent: 0.03 ETH
|
|
169
|
+
Remaining: 0.07 ETH
|
|
170
|
+
Utilization: 30% 🟢 Healthy
|
|
171
|
+
Period length: 24h
|
|
172
|
+
Resets in: 18h 22m
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### 3. `send_payment`
|
|
178
|
+
|
|
179
|
+
Send ETH or ERC20 tokens within spend limits.
|
|
180
|
+
|
|
181
|
+
**Input:**
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"to": "0xrecipient...",
|
|
186
|
+
"amount_eth": "0.001",
|
|
187
|
+
"memo": "Payment for API access"
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
For ERC20 (e.g. USDC):
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"to": "0xrecipient...",
|
|
196
|
+
"amount_eth": "5.00",
|
|
197
|
+
"token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
198
|
+
"token_decimals": 6
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Output:**
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
✅ Payment Sent
|
|
206
|
+
|
|
207
|
+
To: 0xrecipient...
|
|
208
|
+
Amount: 0.001 ETH
|
|
209
|
+
Network: Base Mainnet
|
|
210
|
+
TX Hash: 0xabc...
|
|
211
|
+
🔗 https://basescan.org/tx/0xabc...
|
|
212
|
+
📝 Memo: Payment for API access
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
> If the payment exceeds spend limits, it's automatically queued for your approval. Use `queue_approval` to manage the queue.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### 4. `check_spend_limit`
|
|
220
|
+
|
|
221
|
+
Check if a proposed payment is within autonomous limits before sending.
|
|
222
|
+
|
|
223
|
+
**Input:**
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"amount_eth": "0.005"
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Output:**
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
🔍 Spend Limit Check
|
|
235
|
+
|
|
236
|
+
Token: ETH
|
|
237
|
+
Amount: 0.005 ETH
|
|
238
|
+
|
|
239
|
+
Per-tx limit: 0.01 ETH
|
|
240
|
+
Within per-tx: ✅ Yes
|
|
241
|
+
|
|
242
|
+
Remaining period: 0.07 ETH
|
|
243
|
+
Within period: ✅ Yes
|
|
244
|
+
Resets in: 18h 22m
|
|
245
|
+
|
|
246
|
+
✅ APPROVED — This payment can execute autonomously.
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### 5. `queue_approval`
|
|
252
|
+
|
|
253
|
+
Manage over-limit transactions queued for owner review.
|
|
254
|
+
|
|
255
|
+
**List pending:**
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{ "action": "list" }
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Approve:**
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{ "action": "approve", "tx_id": "0" }
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Cancel:**
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{ "action": "cancel", "tx_id": "0" }
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
### 6. `x402_pay`
|
|
276
|
+
|
|
277
|
+
Fetch a URL and automatically handle HTTP 402 Payment Required responses.
|
|
278
|
+
|
|
279
|
+
**Input:**
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"url": "https://api.example.com/premium-data",
|
|
284
|
+
"max_payment_eth": "0.001",
|
|
285
|
+
"timeout_ms": 15000
|
|
286
|
+
}
|
|
37
287
|
```
|
|
38
288
|
|
|
39
|
-
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### 7. `get_transaction_history`
|
|
292
|
+
|
|
293
|
+
Retrieve on-chain transaction history from event logs.
|
|
294
|
+
|
|
295
|
+
**Input:**
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"limit": 10,
|
|
300
|
+
"event_type": "execution"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Security Model
|
|
307
|
+
|
|
308
|
+
### Non-Custodial Architecture
|
|
309
|
+
|
|
310
|
+
AgentPay MCP wraps **AgentAccountV2** — a smart contract wallet that you own via an NFT. The security model:
|
|
311
|
+
|
|
312
|
+
1. **You own the NFT** → You own the wallet. If you transfer the NFT, the new holder controls the wallet.
|
|
313
|
+
2. **Agent hot key** → `AGENT_PRIVATE_KEY` is a *limited* operator key. It can execute transactions only within the on-chain spend limits you set.
|
|
314
|
+
3. **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.
|
|
315
|
+
4. **Approval queue** → Over-limit transactions are queued on-chain for your explicit approval. The agent cannot bypass this.
|
|
316
|
+
|
|
317
|
+
### Threat Model
|
|
318
|
+
|
|
319
|
+
| Threat | Mitigation |
|
|
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 |
|
|
326
|
+
|
|
327
|
+
### Isolation Architecture — Why ContextCrush-Style Attacks Don't Apply
|
|
328
|
+
|
|
329
|
+
In March 2026, Noma Security disclosed "ContextCrush" (CVE-2026-31841): MCP servers delivering poisoned documentation into AI coding assistants (Claude Desktop, Cursor, Windsurf, VS Code). The attack injects malicious instructions via the context window, causing the AI to execute destructive commands — including deleting local files.
|
|
330
|
+
|
|
331
|
+
AgentPay MCP is architecturally immune to this class of attack. Here's why.
|
|
332
|
+
|
|
333
|
+
**ContextCrush attack vector:**
|
|
334
|
+
- A malicious MCP server (e.g. a documentation provider like Context7) returns poisoned content when the AI queries it
|
|
335
|
+
- That content contains hidden instructions injected into the AI's context window
|
|
336
|
+
- The AI, following what looks like legitimate documentation, executes the attacker's commands
|
|
337
|
+
|
|
338
|
+
**Why AgentPay MCP doesn't have this surface:**
|
|
339
|
+
|
|
340
|
+
1. **Payment-only tool surface** — AgentPay MCP exposes exactly 7 tools: `deploy_wallet`, `get_wallet_info`, `send_payment`, `check_spend_limit`, `queue_approval`, `x402_pay`, `get_transaction_history`. It does not fetch or return arbitrary content from external URLs. There is no documentation retrieval pathway, no web browsing tool, no file system access. The attack surface is bounded by the payment domain.
|
|
341
|
+
|
|
342
|
+
2. **No content pass-through** — ContextCrush works because the compromised MCP server passes external content (poisoned docs) directly into the AI's context. AgentPay MCP only returns structured JSON objects describing payment state and transaction results. It cannot inject arbitrary text into the AI's reasoning context.
|
|
343
|
+
|
|
344
|
+
3. **On-chain enforcement independent of context** — Even if an attacker somehow caused the AI to issue a malicious `send_payment` call, the on-chain spend limits enforce the authorization policy regardless of what the AI believes it's doing. The smart contract validates against the configured `SpendingPolicy` — it doesn't trust the AI's interpretation of the situation.
|
|
345
|
+
|
|
346
|
+
4. **Process isolation** — AgentPay MCP runs as a separate process (`npx agentpay-mcp`). It communicates with the AI client via stdio, not shared memory. It cannot read or write files in your project directory, cannot access your clipboard, cannot execute shell commands. The process has no filesystem permissions beyond reading its own `.env` configuration.
|
|
347
|
+
|
|
348
|
+
5. **No naming collisions** — CVE-2026-30856 (Tencent WeKnora) exploited tool naming collisions between MCP servers. AgentPay MCP's tool names are payment-specific and unlikely to collide with documentation or utility tools in legitimate agent setups.
|
|
349
|
+
|
|
350
|
+
**Summary:** AgentPay MCP cannot be weaponized as a ContextCrush-style vector because it serves no content, accesses no external URLs, writes no files, and executes no shell commands. Its on-chain authorization layer enforces payment policy independently of AI context. Enterprise teams evaluating MCP governance should treat payment-specific, isolated MCP servers differently from general-purpose documentation or utility servers.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Configuration
|
|
355
|
+
|
|
356
|
+
| Variable | Required | Default | Description |
|
|
357
|
+
|----------|----------|---------|-------------|
|
|
358
|
+
| `AGENT_PRIVATE_KEY` | ✅ | — | Agent hot wallet private key (0x-prefixed hex) |
|
|
359
|
+
| `AGENT_WALLET_ADDRESS` | ✅ | — | Deployed AgentAccountV2 contract address |
|
|
360
|
+
| `CHAIN_ID` | ⬜ | `8453` | Chain ID (8453 = Base Mainnet, 84532 = Base Sepolia) |
|
|
361
|
+
| `RPC_URL` | ⬜ | Public Base RPC | Custom RPC endpoint (recommended for production) |
|
|
362
|
+
| `FACTORY_ADDRESS` | ⬜ | — | Required for `deploy_wallet` only |
|
|
363
|
+
| `NFT_CONTRACT_ADDRESS` | ⬜ | — | Required for `deploy_wallet` only |
|
|
364
|
+
|
|
365
|
+
> **Minimum to get started:** Just `AGENT_PRIVATE_KEY` + `AGENT_WALLET_ADDRESS`. Everything else has sensible defaults.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Integration Examples
|
|
370
|
+
|
|
371
|
+
### Cursor / Windsurf
|
|
372
|
+
|
|
373
|
+
```json
|
|
374
|
+
{
|
|
375
|
+
"mcpServers": {
|
|
376
|
+
"agentpay": {
|
|
377
|
+
"command": "npx",
|
|
378
|
+
"args": ["-y", "agentpay-mcp"],
|
|
379
|
+
"env": {
|
|
380
|
+
"AGENT_PRIVATE_KEY": "0x...",
|
|
381
|
+
"AGENT_WALLET_ADDRESS": "0x...",
|
|
382
|
+
"CHAIN_ID": "8453"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
40
390
|
|
|
41
391
|
## Ecosystem
|
|
42
392
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
393
|
+
- **[Agent Wallet SDK](https://www.npmjs.com/package/agentwallet-sdk)** — Non-custodial wallet SDK for AI agents
|
|
394
|
+
- **[@agent-wallet/mastra-plugin](https://www.npmjs.com/package/@agent-wallet/mastra-plugin)** — Mastra framework integration
|
|
395
|
+
- **[AgentPay MCP](https://www.npmjs.com/package/agentpay-mcp)** — This package (MCP server)
|
|
396
|
+
- **[x402 Protocol](https://x402.org)** — HTTP 402 payment standard
|
|
397
|
+
- **[Base Network](https://base.org)** — L2 chain
|
|
398
|
+
|
|
399
|
+
---
|
|
49
400
|
|
|
50
|
-
##
|
|
401
|
+
## License
|
|
51
402
|
|
|
52
|
-
|
|
53
|
-
- [npm (@agenteconomy/pay)](https://www.npmjs.com/package/@agenteconomy/pay)
|
|
54
|
-
- [Discord](https://discord.gg/958AACqf7Y)
|
|
403
|
+
MIT — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Copy this snippet into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\\Claude\\claude_desktop_config.json (Windows). Then restart Claude Desktop.",
|
|
3
|
+
"mcpServers": {
|
|
4
|
+
"clawpay": {
|
|
5
|
+
"command": "clawpay-mcp",
|
|
6
|
+
"_install": "Run: npm install -g clawpay-mcp",
|
|
7
|
+
"env": {
|
|
8
|
+
"AGENT_PRIVATE_KEY": "0xYOUR_AGENT_PRIVATE_KEY_HERE",
|
|
9
|
+
"AGENT_WALLET_ADDRESS": "0xYOUR_AGENT_WALLET_ADDRESS_HERE",
|
|
10
|
+
"CHAIN_ID": "8453",
|
|
11
|
+
"_CHAIN_ID_NOTE": "8453 = Base Mainnet | 84532 = Base Sepolia testnet",
|
|
12
|
+
"RPC_URL": "https://mainnet.base.org",
|
|
13
|
+
"_RPC_URL_NOTE": "Optional: Use a dedicated node for better reliability"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|