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.
Files changed (51) hide show
  1. package/.env.example +37 -0
  2. package/LICENSE +21 -0
  3. package/README.md +380 -31
  4. package/claude_desktop_config.json +17 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +166 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/session/manager.d.ts +90 -0
  10. package/dist/session/manager.d.ts.map +1 -0
  11. package/dist/session/manager.js +262 -0
  12. package/dist/session/manager.js.map +1 -0
  13. package/dist/session/types.d.ts +113 -0
  14. package/dist/session/types.d.ts.map +1 -0
  15. package/dist/session/types.js +16 -0
  16. package/dist/session/types.js.map +1 -0
  17. package/dist/tools/deploy.d.ts +49 -0
  18. package/dist/tools/deploy.d.ts.map +1 -0
  19. package/dist/tools/deploy.js +123 -0
  20. package/dist/tools/deploy.js.map +1 -0
  21. package/dist/tools/history.d.ts +59 -0
  22. package/dist/tools/history.d.ts.map +1 -0
  23. package/dist/tools/history.js +202 -0
  24. package/dist/tools/history.js.map +1 -0
  25. package/dist/tools/payments.d.ts +71 -0
  26. package/dist/tools/payments.d.ts.map +1 -0
  27. package/dist/tools/payments.js +158 -0
  28. package/dist/tools/payments.js.map +1 -0
  29. package/dist/tools/session.d.ts +240 -0
  30. package/dist/tools/session.d.ts.map +1 -0
  31. package/dist/tools/session.js +678 -0
  32. package/dist/tools/session.js.map +1 -0
  33. package/dist/tools/wallet.d.ts +107 -0
  34. package/dist/tools/wallet.d.ts.map +1 -0
  35. package/dist/tools/wallet.js +271 -0
  36. package/dist/tools/wallet.js.map +1 -0
  37. package/dist/tools/x402.d.ts +90 -0
  38. package/dist/tools/x402.d.ts.map +1 -0
  39. package/dist/tools/x402.js +268 -0
  40. package/dist/tools/x402.js.map +1 -0
  41. package/dist/utils/client.d.ts +46 -0
  42. package/dist/utils/client.d.ts.map +1 -0
  43. package/dist/utils/client.js +123 -0
  44. package/dist/utils/client.js.map +1 -0
  45. package/dist/utils/format.d.ts +59 -0
  46. package/dist/utils/format.d.ts.map +1 -0
  47. package/dist/utils/format.js +161 -0
  48. package/dist/utils/format.js.map +1 -0
  49. package/package.json +58 -12
  50. package/index.d.ts +0 -1
  51. package/index.js +0 -13
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendPaymentTool = exports.SendPaymentSchema = void 0;
4
+ exports.handleSendPayment = handleSendPayment;
5
+ exports.parseTokenAmount = parseTokenAmount;
6
+ /**
7
+ * payments.ts — send_payment tool.
8
+ * Executes ETH or ERC20 token transfers via the AgentAccountV2 contract.
9
+ */
10
+ const zod_1 = require("zod");
11
+ const viem_1 = require("viem");
12
+ const agentwallet_sdk_1 = require("agentwallet-sdk");
13
+ const client_js_1 = require("../utils/client.js");
14
+ const format_js_1 = require("../utils/format.js");
15
+ const NATIVE_TOKEN = viem_1.zeroAddress;
16
+ // ─── Schema ────────────────────────────────────────────────────────────────
17
+ exports.SendPaymentSchema = zod_1.z.object({
18
+ to: zod_1.z
19
+ .string()
20
+ .describe('Recipient address (0x-prefixed, checksummed or lowercase)'),
21
+ amount_eth: zod_1.z
22
+ .string()
23
+ .describe('Amount to send, expressed in ETH (e.g. "0.001"). ' +
24
+ 'For ERC20 tokens, this is the human-readable amount (e.g. "1.5" for 1.5 USDC). ' +
25
+ 'Use the token_decimals parameter to control precision.'),
26
+ token: zod_1.z
27
+ .string()
28
+ .optional()
29
+ .describe('ERC20 token contract address. ' +
30
+ 'Omit or use "0x0000000000000000000000000000000000000000" for native ETH.'),
31
+ token_decimals: zod_1.z
32
+ .number()
33
+ .int()
34
+ .min(0)
35
+ .max(18)
36
+ .optional()
37
+ .default(18)
38
+ .describe('Token decimal places (default: 18 for ETH; use 6 for USDC).'),
39
+ memo: zod_1.z
40
+ .string()
41
+ .max(200)
42
+ .optional()
43
+ .describe('Optional memo/note for this payment (logged locally, not on-chain).'),
44
+ });
45
+ // ─── Tool definition ───────────────────────────────────────────────────────
46
+ exports.sendPaymentTool = {
47
+ name: 'send_payment',
48
+ description: 'Send ETH or ERC20 tokens from the Agent Wallet. ' +
49
+ 'If the amount is within the configured spend limits, it executes immediately and returns the tx hash. ' +
50
+ 'If it exceeds limits, the transaction is queued for owner approval (use queue_approval to manage). ' +
51
+ 'Always check spend limits first with check_spend_limit to avoid surprises.',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {
55
+ to: {
56
+ type: 'string',
57
+ description: 'Recipient wallet address (0x-prefixed)',
58
+ },
59
+ amount_eth: {
60
+ type: 'string',
61
+ description: 'Amount in ETH (or token units). E.g. "0.001" for 0.001 ETH, "1.5" for 1.5 USDC',
62
+ },
63
+ token: {
64
+ type: 'string',
65
+ description: 'ERC20 token address. Omit for native ETH.',
66
+ },
67
+ token_decimals: {
68
+ type: 'number',
69
+ description: 'Token decimals (default 18 for ETH, 6 for USDC)',
70
+ default: 18,
71
+ },
72
+ memo: {
73
+ type: 'string',
74
+ description: 'Optional memo for this payment (not stored on-chain)',
75
+ maxLength: 200,
76
+ },
77
+ },
78
+ required: ['to', 'amount_eth'],
79
+ },
80
+ };
81
+ // ─── Handler ───────────────────────────────────────────────────────────────
82
+ async function handleSendPayment(input) {
83
+ try {
84
+ const wallet = (0, client_js_1.getWallet)();
85
+ const config = (0, client_js_1.getConfig)();
86
+ // Validate recipient address
87
+ if (!input.to.startsWith('0x') || input.to.length !== 42) {
88
+ throw new Error(`Invalid recipient address: "${input.to}". Must be a 0x-prefixed 42-character hex string.`);
89
+ }
90
+ const toAddress = input.to;
91
+ // Parse amount
92
+ const amountCheck = parseFloat(input.amount_eth);
93
+ if (isNaN(amountCheck) || amountCheck <= 0) {
94
+ throw new Error(`Invalid amount: "${input.amount_eth}". Must be a positive number.`);
95
+ }
96
+ const decimals = input.token_decimals ?? 18;
97
+ const amountWei = parseTokenAmount(input.amount_eth, decimals);
98
+ const isNativeEth = !input.token || input.token === NATIVE_TOKEN || input.token === '0x0000000000000000000000000000000000000000';
99
+ const tokenAddress = isNativeEth ? NATIVE_TOKEN : input.token;
100
+ const tokenLabel = isNativeEth ? 'ETH' : input.token ?? 'ETH';
101
+ let txHash;
102
+ if (isNativeEth) {
103
+ // Native ETH transfer via agentExecute
104
+ const result = await (0, agentwallet_sdk_1.agentExecute)(wallet, {
105
+ to: toAddress,
106
+ value: amountWei,
107
+ });
108
+ txHash = result.txHash;
109
+ }
110
+ else {
111
+ // ERC20 transfer via agentTransferToken
112
+ txHash = await (0, agentwallet_sdk_1.agentTransferToken)(wallet, {
113
+ token: tokenAddress,
114
+ to: toAddress,
115
+ amount: amountWei,
116
+ });
117
+ }
118
+ const explorerUrl = (0, format_js_1.explorerTxUrl)(txHash, config.chainId);
119
+ const memoLine = input.memo ? `\n📝 Memo: ${input.memo}` : '';
120
+ return {
121
+ content: [
122
+ (0, format_js_1.textContent)(`✅ **Payment Sent**\n\n` +
123
+ ` To: ${toAddress}\n` +
124
+ ` Amount: ${input.amount_eth} ${tokenLabel}\n` +
125
+ ` Token: ${tokenLabel}\n` +
126
+ ` Network: ${(0, format_js_1.chainName)(config.chainId)}\n` +
127
+ ` TX Hash: ${txHash}\n` +
128
+ ` 🔗 ${explorerUrl}` +
129
+ memoLine + '\n\n' +
130
+ `ℹ️ If the transaction was over-limit, it was queued for owner approval.\n` +
131
+ ` Use queue_approval (action="list") to check pending transactions.`),
132
+ ],
133
+ };
134
+ }
135
+ catch (error) {
136
+ return {
137
+ content: [(0, format_js_1.textContent)((0, format_js_1.formatError)(error, 'send_payment'))],
138
+ isError: true,
139
+ };
140
+ }
141
+ }
142
+ // ─── Token amount parser ───────────────────────────────────────────────────
143
+ /**
144
+ * Parse a human-readable token amount string into base units (bigint).
145
+ * Handles floating-point precision correctly without using JavaScript floats.
146
+ * e.g., "1.5" with decimals=6 → 1500000n
147
+ */
148
+ function parseTokenAmount(amount, decimals) {
149
+ const trimmed = amount.trim();
150
+ if (!trimmed || isNaN(Number(trimmed))) {
151
+ throw new Error(`Invalid amount: "${amount}"`);
152
+ }
153
+ const [intPart, fracPart = ''] = trimmed.split('.');
154
+ const fracTrimmed = fracPart.slice(0, decimals).padEnd(decimals, '0');
155
+ const intStr = (intPart ?? '0') + fracTrimmed;
156
+ return BigInt(intStr);
157
+ }
158
+ //# sourceMappingURL=payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/tools/payments.ts"],"names":[],"mappings":";;;AAgGA,8CAuEC;AASD,4CAWC;AA3LD;;;GAGG;AACH,6BAAwB;AACxB,+BAAiD;AACjD,qDAAmE;AACnE,kDAA0D;AAC1D,kDAM4B;AAE5B,MAAM,YAAY,GAAG,kBAAW,CAAC;AAEjC,8EAA8E;AAEjE,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,OAAC;SACF,MAAM,EAAE;SACR,QAAQ,CAAC,2DAA2D,CAAC;IACxE,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,CACP,mDAAmD;QACnD,iFAAiF;QACjF,wDAAwD,CACzD;IACH,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,gCAAgC;QAChC,0EAA0E,CAC3E;IACH,cAAc,EAAE,OAAC;SACd,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;SACV,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,6DAA6D,CAAC;IAC1E,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qEAAqE,CAAC;CACnF,CAAC,CAAC;AAIH,8EAA8E;AAEjE,QAAA,eAAe,GAAG;IAC7B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,240 @@
1
+ /**
2
+ * session.ts — x402 V2 session payment tools.
3
+ *
4
+ * Implements the x402 V2 "wallet-based access & reusable sessions" pattern:
5
+ * 1. x402_session_start — pay once, receive a signed session token
6
+ * 2. x402_session_fetch — make N calls within the session (no new payments)
7
+ * 3. x402_session_status — inspect active sessions and TTL remaining
8
+ * 4. x402_session_end — explicitly close a session
9
+ *
10
+ * Non-custodial design:
11
+ * Agents sign session tokens locally with their private key.
12
+ * No third party holds or validates keys at any point.
13
+ * Session tokens are self-contained ECDSA-signed claims that any server
14
+ * implementing x402 V2 can independently verify.
15
+ */
16
+ import { z } from 'zod';
17
+ import { findSessionForUrl, buildSessionHeaders } from '../session/manager.js';
18
+ export declare const X402SessionStartSchema: z.ZodObject<{
19
+ endpoint: z.ZodString;
20
+ scope: z.ZodDefault<z.ZodOptional<z.ZodEnum<["prefix", "exact"]>>>;
21
+ ttl_seconds: z.ZodOptional<z.ZodNumber>;
22
+ label: z.ZodOptional<z.ZodString>;
23
+ max_payment_eth: z.ZodOptional<z.ZodString>;
24
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>>;
25
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
26
+ body: z.ZodOptional<z.ZodString>;
27
+ timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
30
+ endpoint: string;
31
+ scope: "exact" | "prefix";
32
+ timeout_ms: number;
33
+ body?: string | undefined;
34
+ headers?: Record<string, string> | undefined;
35
+ ttl_seconds?: number | undefined;
36
+ label?: string | undefined;
37
+ max_payment_eth?: string | undefined;
38
+ }, {
39
+ endpoint: string;
40
+ body?: string | undefined;
41
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
42
+ headers?: Record<string, string> | undefined;
43
+ scope?: "exact" | "prefix" | undefined;
44
+ ttl_seconds?: number | undefined;
45
+ label?: string | undefined;
46
+ max_payment_eth?: string | undefined;
47
+ timeout_ms?: number | undefined;
48
+ }>;
49
+ export type X402SessionStartInput = z.infer<typeof X402SessionStartSchema>;
50
+ export declare const x402SessionStartTool: {
51
+ name: string;
52
+ description: string;
53
+ inputSchema: {
54
+ type: "object";
55
+ properties: {
56
+ endpoint: {
57
+ type: string;
58
+ description: string;
59
+ };
60
+ scope: {
61
+ type: string;
62
+ enum: string[];
63
+ description: string;
64
+ default: string;
65
+ };
66
+ ttl_seconds: {
67
+ type: string;
68
+ description: string;
69
+ };
70
+ label: {
71
+ type: string;
72
+ description: string;
73
+ };
74
+ max_payment_eth: {
75
+ type: string;
76
+ description: string;
77
+ };
78
+ method: {
79
+ type: string;
80
+ enum: string[];
81
+ description: string;
82
+ default: string;
83
+ };
84
+ headers: {
85
+ type: string;
86
+ additionalProperties: {
87
+ type: string;
88
+ };
89
+ description: string;
90
+ };
91
+ body: {
92
+ type: string;
93
+ description: string;
94
+ };
95
+ timeout_ms: {
96
+ type: string;
97
+ description: string;
98
+ default: number;
99
+ };
100
+ };
101
+ required: string[];
102
+ };
103
+ };
104
+ export declare function handleX402SessionStart(input: X402SessionStartInput): Promise<{
105
+ content: Array<{
106
+ type: 'text';
107
+ text: string;
108
+ }>;
109
+ isError?: boolean;
110
+ }>;
111
+ export declare const X402SessionFetchSchema: z.ZodObject<{
112
+ session_id: z.ZodString;
113
+ url: z.ZodString;
114
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>>;
115
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
116
+ body: z.ZodOptional<z.ZodString>;
117
+ timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
120
+ timeout_ms: number;
121
+ session_id: string;
122
+ url: string;
123
+ body?: string | undefined;
124
+ headers?: Record<string, string> | undefined;
125
+ }, {
126
+ session_id: string;
127
+ url: string;
128
+ body?: string | undefined;
129
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
130
+ headers?: Record<string, string> | undefined;
131
+ timeout_ms?: number | undefined;
132
+ }>;
133
+ export type X402SessionFetchInput = z.infer<typeof X402SessionFetchSchema>;
134
+ export declare const x402SessionFetchTool: {
135
+ name: string;
136
+ description: string;
137
+ inputSchema: {
138
+ type: "object";
139
+ properties: {
140
+ session_id: {
141
+ type: string;
142
+ description: string;
143
+ };
144
+ url: {
145
+ type: string;
146
+ description: string;
147
+ };
148
+ method: {
149
+ type: string;
150
+ enum: string[];
151
+ description: string;
152
+ default: string;
153
+ };
154
+ headers: {
155
+ type: string;
156
+ additionalProperties: {
157
+ type: string;
158
+ };
159
+ description: string;
160
+ };
161
+ body: {
162
+ type: string;
163
+ description: string;
164
+ };
165
+ timeout_ms: {
166
+ type: string;
167
+ description: string;
168
+ default: number;
169
+ };
170
+ };
171
+ required: string[];
172
+ };
173
+ };
174
+ export declare function handleX402SessionFetch(input: X402SessionFetchInput): Promise<{
175
+ content: Array<{
176
+ type: 'text';
177
+ text: string;
178
+ }>;
179
+ isError?: boolean;
180
+ }>;
181
+ export declare const X402SessionStatusSchema: z.ZodObject<{
182
+ session_id: z.ZodOptional<z.ZodString>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ session_id?: string | undefined;
185
+ }, {
186
+ session_id?: string | undefined;
187
+ }>;
188
+ export type X402SessionStatusInput = z.infer<typeof X402SessionStatusSchema>;
189
+ export declare const x402SessionStatusTool: {
190
+ name: string;
191
+ description: string;
192
+ inputSchema: {
193
+ type: "object";
194
+ properties: {
195
+ session_id: {
196
+ type: string;
197
+ description: string;
198
+ };
199
+ };
200
+ required: never[];
201
+ };
202
+ };
203
+ export declare function handleX402SessionStatus(input: X402SessionStatusInput): Promise<{
204
+ content: Array<{
205
+ type: 'text';
206
+ text: string;
207
+ }>;
208
+ isError?: boolean;
209
+ }>;
210
+ export declare const X402SessionEndSchema: z.ZodObject<{
211
+ session_id: z.ZodString;
212
+ }, "strip", z.ZodTypeAny, {
213
+ session_id: string;
214
+ }, {
215
+ session_id: string;
216
+ }>;
217
+ export type X402SessionEndInput = z.infer<typeof X402SessionEndSchema>;
218
+ export declare const x402SessionEndTool: {
219
+ name: string;
220
+ description: string;
221
+ inputSchema: {
222
+ type: "object";
223
+ properties: {
224
+ session_id: {
225
+ type: string;
226
+ description: string;
227
+ };
228
+ };
229
+ required: string[];
230
+ };
231
+ };
232
+ export declare function handleX402SessionEnd(input: X402SessionEndInput): Promise<{
233
+ content: Array<{
234
+ type: 'text';
235
+ text: string;
236
+ }>;
237
+ isError?: boolean;
238
+ }>;
239
+ export { findSessionForUrl, buildSessionHeaders };
240
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/tools/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAML,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDjC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDhC,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,E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