verifystack-x402-mcp 0.4.0 → 0.5.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 +138 -137
- package/bin/verifystack-mcp.mjs +755 -618
- package/package.json +59 -59
package/bin/verifystack-mcp.mjs
CHANGED
|
@@ -1,618 +1,755 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import readline from "node:readline";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
|
|
5
|
-
const DEFAULT_BASE_URL = "https://x402-crypto-math-api.verifystack.workers.dev";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
type: "string",
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import readline from "node:readline";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_BASE_URL = "https://x402-crypto-math-api.verifystack.workers.dev";
|
|
6
|
+
|
|
7
|
+
const READ_NETWORK_ANNOTATIONS = {
|
|
8
|
+
readOnlyHint: true,
|
|
9
|
+
destructiveHint: false,
|
|
10
|
+
idempotentHint: true,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const PURE_COMPUTE_ANNOTATIONS = {
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
openWorldHint: false,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const TOOLS = [
|
|
22
|
+
{
|
|
23
|
+
name: "verifystack_live_funding_arb",
|
|
24
|
+
title: "Live Cross-Exchange Funding Rate Arbitrage Scanner",
|
|
25
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
26
|
+
description:
|
|
27
|
+
"Paid x402 API ($0.01 USDC on Base): Real-time cross-exchange perpetual funding rate arbitrage scanner aggregating Hyperliquid, dYdX v4, and Gate.io normalized to hourly spreads and gross APR.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
symbol: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Optional asset ticker filter (e.g. BTC, ETH, SOL)",
|
|
35
|
+
},
|
|
36
|
+
limit: {
|
|
37
|
+
type: "number",
|
|
38
|
+
description: "Max results (1-100, default 15)",
|
|
39
|
+
},
|
|
40
|
+
minApr: {
|
|
41
|
+
type: "number",
|
|
42
|
+
description: "Minimum gross annualized APR percent filter",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "verifystack_prediction_markets",
|
|
49
|
+
title: "Live Multi-Venue Prediction Market Scanner",
|
|
50
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
51
|
+
description:
|
|
52
|
+
"Paid x402 API ($0.008 USDC on Base): Live prediction market scanner aggregating Polymarket, Kalshi, and Manifold Markets with normalized YES/NO probabilities, spreads, and cross-venue arbitrage divergences.",
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: "object",
|
|
55
|
+
additionalProperties: false,
|
|
56
|
+
properties: {
|
|
57
|
+
q: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Optional keyword search across market questions (e.g. bitcoin, fed, eth)",
|
|
60
|
+
},
|
|
61
|
+
platform: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Filter platforms: polymarket, kalshi, manifold, or all",
|
|
64
|
+
},
|
|
65
|
+
minLiquidity: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Minimum market liquidity threshold",
|
|
68
|
+
},
|
|
69
|
+
limit: {
|
|
70
|
+
type: "number",
|
|
71
|
+
description: "Max markets returned (1-100, default 20)",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "verifystack_defi_yields",
|
|
78
|
+
title: "Live DeFi Yield & Stablecoin APY Scanner",
|
|
79
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
80
|
+
description:
|
|
81
|
+
"Paid x402 API ($0.005 USDC on Base): Live DeFi yield & stablecoin APY scanner powered by DefiLlama; filters by chain, symbol, TVL, and separates organic Base APY from reward emissions.",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
additionalProperties: false,
|
|
85
|
+
properties: {
|
|
86
|
+
chain: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Comma-separated chain filter (e.g. Base, Arbitrum, Ethereum, Solana)",
|
|
89
|
+
},
|
|
90
|
+
symbol: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "Asset symbol substring filter (e.g. USDC, ETH)",
|
|
93
|
+
},
|
|
94
|
+
project: {
|
|
95
|
+
type: "string",
|
|
96
|
+
description: "Protocol slug filter (e.g. aave-v3, morpho-v1)",
|
|
97
|
+
},
|
|
98
|
+
stablecoin: { type: "boolean", description: "Only stablecoin pools" },
|
|
99
|
+
singleAsset: { type: "boolean", description: "Only single-asset no-IL pools" },
|
|
100
|
+
minTvl: { type: "number", description: "Minimum TVL in USD (default 100000)" },
|
|
101
|
+
minApy: { type: "number", description: "Minimum total APY %" },
|
|
102
|
+
limit: { type: "number", description: "Max pools returned (1-100, default 20)" },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "verifystack_decode_tx",
|
|
108
|
+
title: "EVM Transaction Decoder & Calldata Firewall",
|
|
109
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
110
|
+
description:
|
|
111
|
+
"Paid x402 API ($0.005 USDC on Base): EVM calldata & live transaction decoder via OpenChain + EVM RPC; flags unlimited ERC-20/NFT approvals before signing.",
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: "object",
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
properties: {
|
|
116
|
+
data: { type: "string", description: "Raw 0x hex calldata to decode" },
|
|
117
|
+
to: { type: "string", description: "Optional target contract address" },
|
|
118
|
+
valueWei: { type: "string", description: "Optional native value in wei" },
|
|
119
|
+
txHash: { type: "string", description: "Optional live 0x tx hash to fetch and decode" },
|
|
120
|
+
chain: {
|
|
121
|
+
type: "string",
|
|
122
|
+
enum: ["base", "ethereum", "arbitrum", "optimism", "polygon"],
|
|
123
|
+
description: "Target EVM chain used when fetching live txHash (default: base)",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "verifystack_domain_intel",
|
|
130
|
+
title: "Domain Anti-Phishing & Trust Profiler",
|
|
131
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
132
|
+
description:
|
|
133
|
+
"Paid x402 API ($0.004 USDC on Base): Domain anti-phishing & trust profiler via Cloudflare DoH (A/MX/SPF/DMARC), RDAP registration age, and HTTPS security headers.",
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
additionalProperties: false,
|
|
137
|
+
required: ["domainOrUrl"],
|
|
138
|
+
properties: {
|
|
139
|
+
domainOrUrl: {
|
|
140
|
+
type: "string",
|
|
141
|
+
description: "Public domain or URL to inspect (e.g. https://app.uniswap.org)",
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "verifystack_web_research",
|
|
148
|
+
title: "Universal Multi-Source Web & Academic Search",
|
|
149
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
150
|
+
description:
|
|
151
|
+
"Paid x402 API ($0.004 USDC on Base): Universal multi-source research & news search across HackerNews, GitHub Repositories, arXiv papers, and Wikipedia with zero API keys (60s cache).",
|
|
152
|
+
inputSchema: {
|
|
153
|
+
type: "object",
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
required: ["q"],
|
|
156
|
+
properties: {
|
|
157
|
+
q: { type: "string", description: "Search query (2-200 characters)" },
|
|
158
|
+
sources: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "Comma-separated: hackernews, github, arxiv, wikipedia, or all",
|
|
161
|
+
},
|
|
162
|
+
limit: {
|
|
163
|
+
type: "number",
|
|
164
|
+
description: "Max items per source (1-15, default 5)",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "verifystack_clean_url",
|
|
171
|
+
title: "Web-to-Markdown Cleaner & Token Estimator",
|
|
172
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
173
|
+
description:
|
|
174
|
+
"Paid x402 API ($0.005 USDC on Base): Fetches any public URL, strips ads/scripts/navigation boilerplate, and returns clean LLM-ready Markdown, metadata, and token-count estimation.",
|
|
175
|
+
inputSchema: {
|
|
176
|
+
type: "object",
|
|
177
|
+
additionalProperties: false,
|
|
178
|
+
required: ["url"],
|
|
179
|
+
properties: {
|
|
180
|
+
url: {
|
|
181
|
+
type: "string",
|
|
182
|
+
description: "Public http:// or https:// URL to fetch and clean",
|
|
183
|
+
},
|
|
184
|
+
maxChars: {
|
|
185
|
+
type: "number",
|
|
186
|
+
description: "Maximum output length in characters (200-40000, default 12000)",
|
|
187
|
+
},
|
|
188
|
+
includeLinks: {
|
|
189
|
+
type: "boolean",
|
|
190
|
+
description: "Include extracted page links array (default false)",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "verifystack_wallet_profile",
|
|
197
|
+
title: "Multichain EVM Wallet & Gas Profiler",
|
|
198
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
199
|
+
description:
|
|
200
|
+
"Paid x402 API ($0.008 USDC on Base): Multichain EVM wallet counterparty & gas profiler across Base, Ethereum, Arbitrum, Optimism, and Polygon (native/USDC balances, EOA vs contract check, nonce activity, live gas fees).",
|
|
201
|
+
inputSchema: {
|
|
202
|
+
type: "object",
|
|
203
|
+
additionalProperties: false,
|
|
204
|
+
required: ["address"],
|
|
205
|
+
properties: {
|
|
206
|
+
address: {
|
|
207
|
+
type: "string",
|
|
208
|
+
description: "EVM 0x address to inspect across chains",
|
|
209
|
+
},
|
|
210
|
+
chains: {
|
|
211
|
+
type: "array",
|
|
212
|
+
items: {
|
|
213
|
+
type: "string",
|
|
214
|
+
enum: ["base", "ethereum", "arbitrum", "optimism", "polygon"],
|
|
215
|
+
},
|
|
216
|
+
description: "Optional list of chains (defaults to all 5)",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "verifystack_token_safety",
|
|
223
|
+
title: "Pre-Trade Token Security & Liquidity Audit",
|
|
224
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
225
|
+
description:
|
|
226
|
+
"Paid x402 API ($0.008 USDC on Base): Pre-trade token security and DEX liquidity risk audit aggregating GoPlus Security, Honeypot.is simulation, and DexScreener liquidity.",
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: "object",
|
|
229
|
+
additionalProperties: false,
|
|
230
|
+
required: ["chain", "address"],
|
|
231
|
+
properties: {
|
|
232
|
+
chain: {
|
|
233
|
+
type: "string",
|
|
234
|
+
enum: ["base", "ethereum", "arbitrum", "bsc", "polygon", "solana"],
|
|
235
|
+
description: "Blockchain network hosting the token contract",
|
|
236
|
+
},
|
|
237
|
+
address: {
|
|
238
|
+
type: "string",
|
|
239
|
+
description: "Token contract address (EVM 0x... or Solana Base58 mint)",
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: "verifystack_verify_signature",
|
|
246
|
+
title: "Cryptographic Signature & Smart Wallet Verifier",
|
|
247
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
248
|
+
description:
|
|
249
|
+
"Paid x402 API ($0.005 USDC on Base): Deterministic cryptographic signature verifier for EVM EIP-191 personal_sign, EIP-712 typed data, ERC-1271 on-chain smart wallets, and Ed25519 (Solana).",
|
|
250
|
+
inputSchema: {
|
|
251
|
+
type: "object",
|
|
252
|
+
additionalProperties: false,
|
|
253
|
+
required: ["scheme", "signature"],
|
|
254
|
+
properties: {
|
|
255
|
+
scheme: {
|
|
256
|
+
type: "string",
|
|
257
|
+
enum: ["evm_personal", "evm_eip712", "evm_erc1271", "ed25519"],
|
|
258
|
+
description: "Signature verification scheme to evaluate",
|
|
259
|
+
},
|
|
260
|
+
chain: {
|
|
261
|
+
type: "string",
|
|
262
|
+
enum: ["base", "ethereum", "arbitrum", "optimism", "polygon"],
|
|
263
|
+
description: "Target EVM chain for live on-chain ERC-1271 smart wallet verification",
|
|
264
|
+
},
|
|
265
|
+
message: {
|
|
266
|
+
type: "string",
|
|
267
|
+
description: "Signed plaintext, hex, or base64 payload (required for personal_sign, ERC-1271, Ed25519)",
|
|
268
|
+
},
|
|
269
|
+
messageEncoding: {
|
|
270
|
+
type: "string",
|
|
271
|
+
enum: ["utf8", "hex", "base64"],
|
|
272
|
+
description: "Input encoding of message (default: utf8)",
|
|
273
|
+
},
|
|
274
|
+
signature: {
|
|
275
|
+
type: "string",
|
|
276
|
+
description: "Cryptographic signature bytes (0x hex for EVM; Base58/hex/base64 for Ed25519)",
|
|
277
|
+
},
|
|
278
|
+
expectedAddress: {
|
|
279
|
+
type: "string",
|
|
280
|
+
description: "Expected 0x EVM signer or smart-wallet address to match against",
|
|
281
|
+
},
|
|
282
|
+
publicKey: {
|
|
283
|
+
type: "string",
|
|
284
|
+
description: "Ed25519 public key (Solana Base58 or hex) required for ed25519 scheme",
|
|
285
|
+
},
|
|
286
|
+
typedData: {
|
|
287
|
+
type: "object",
|
|
288
|
+
description: "EIP-712 structured object containing domain, types, primaryType, and message",
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "verifystack_arb_net_profit",
|
|
295
|
+
title: "Arbitrage Net Profit & Break-Even Calculator",
|
|
296
|
+
annotations: PURE_COMPUTE_ANNOTATIONS,
|
|
297
|
+
description:
|
|
298
|
+
"Paid x402 API ($0.005 USDC on Base): Exact arbitrage net profit, break-even spread, and APR calculator accounting for maker/taker fees, slippage, transfer gas, and funding.",
|
|
299
|
+
inputSchema: {
|
|
300
|
+
type: "object",
|
|
301
|
+
additionalProperties: false,
|
|
302
|
+
required: [
|
|
303
|
+
"notionalUsd",
|
|
304
|
+
"buyPrice",
|
|
305
|
+
"sellPrice",
|
|
306
|
+
"buyFeeBps",
|
|
307
|
+
"sellFeeBps",
|
|
308
|
+
],
|
|
309
|
+
properties: {
|
|
310
|
+
notionalUsd: { type: "number", description: "Trade position notional size in USD" },
|
|
311
|
+
buyPrice: { type: "number", description: "Execution buy price on long venue" },
|
|
312
|
+
sellPrice: { type: "number", description: "Execution sell price on short venue" },
|
|
313
|
+
buyFeeBps: { type: "number", description: "Buy-side taker/maker fee in basis points" },
|
|
314
|
+
sellFeeBps: { type: "number", description: "Sell-side taker/maker fee in basis points" },
|
|
315
|
+
slippageBps: { type: "number", description: "Estimated combined slippage in basis points (default 0)" },
|
|
316
|
+
gasAndTransferUsd: { type: "number", description: "Fixed on-chain gas or bridge transfer cost in USD (default 0)" },
|
|
317
|
+
fundingRate8hBps: { type: "number", description: "Expected net 8-hour funding rate advantage in bps" },
|
|
318
|
+
holdHours: { type: "number", description: "Planned holding duration in hours for APR & funding accrual" },
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: "verifystack_liquidation_sim",
|
|
324
|
+
title: "Perpetual Liquidation & Half-Kelly Risk Simulator",
|
|
325
|
+
annotations: PURE_COMPUTE_ANNOTATIONS,
|
|
326
|
+
description:
|
|
327
|
+
"Paid x402 API ($0.005 USDC on Base): Isolated-margin perpetual liquidation threshold, distance-to-liquidation %, risk-reward ratio, and conservative half-Kelly sizing simulator.",
|
|
328
|
+
inputSchema: {
|
|
329
|
+
type: "object",
|
|
330
|
+
additionalProperties: false,
|
|
331
|
+
required: ["side", "entryPrice", "leverage", "collateralUsd"],
|
|
332
|
+
properties: {
|
|
333
|
+
side: { type: "string", enum: ["long", "short"], description: "Position direction (long or short)" },
|
|
334
|
+
entryPrice: { type: "number", description: "Position entry price in USD" },
|
|
335
|
+
leverage: { type: "number", description: "Position leverage multiplier (e.g. 5, 10, 20)" },
|
|
336
|
+
collateralUsd: { type: "number", description: "Isolated initial margin collateral in USD" },
|
|
337
|
+
maintenanceMarginRate: { type: "number", description: "Exchange maintenance margin ratio (e.g. 0.005 for 0.5%)" },
|
|
338
|
+
targetPrice: { type: "number", description: "Optional take-profit target price for R:R calculation" },
|
|
339
|
+
stopLossPrice: { type: "number", description: "Optional stop-loss price for R:R calculation" },
|
|
340
|
+
winProbability: { type: "number", description: "Estimated trade win probability (0 to 1) for half-Kelly sizing" },
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "verifystack_contract_intel",
|
|
346
|
+
title: "Smart Contract Firewall & EIP-1967 Proxy Inspector",
|
|
347
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
348
|
+
description:
|
|
349
|
+
"Paid x402 API ($0.008 USDC on Base): Smart contract firewall & EIP-1967 proxy inspector via EVM RPC, Blockscout verification/ABI, and Sourcify across Base, Ethereum, Arbitrum, Optimism, and Polygon.",
|
|
350
|
+
inputSchema: {
|
|
351
|
+
type: "object",
|
|
352
|
+
additionalProperties: false,
|
|
353
|
+
required: ["address"],
|
|
354
|
+
properties: {
|
|
355
|
+
address: {
|
|
356
|
+
type: "string",
|
|
357
|
+
description: "0x EVM smart contract address to inspect",
|
|
358
|
+
},
|
|
359
|
+
chain: {
|
|
360
|
+
type: "string",
|
|
361
|
+
enum: ["base", "ethereum", "arbitrum", "optimism", "polygon"],
|
|
362
|
+
description: "Target EVM chain (default: base)",
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "verifystack_spot_perp_basis",
|
|
369
|
+
title: "Spot vs Perpetual Cash-and-Carry Basis Scanner",
|
|
370
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
371
|
+
description:
|
|
372
|
+
"Paid x402 API ($0.008 USDC on Base): Live cross-exchange cash-and-carry Spot vs Perpetual basis, executable BBO spread, and combined 30d carry APR scanner across Gate.io, OKX, and Hyperliquid.",
|
|
373
|
+
inputSchema: {
|
|
374
|
+
type: "object",
|
|
375
|
+
additionalProperties: false,
|
|
376
|
+
properties: {
|
|
377
|
+
symbol: {
|
|
378
|
+
type: "string",
|
|
379
|
+
description: "Optional asset ticker filter (e.g. BTC, ETH, SOL)",
|
|
380
|
+
},
|
|
381
|
+
minBasisBps: {
|
|
382
|
+
type: "number",
|
|
383
|
+
description: "Minimum absolute executable basis spread in bps (0-5000)",
|
|
384
|
+
},
|
|
385
|
+
notionalUsd: {
|
|
386
|
+
type: "number",
|
|
387
|
+
description: "Optional position size in USD to estimate 30d carry return",
|
|
388
|
+
},
|
|
389
|
+
limit: {
|
|
390
|
+
type: "number",
|
|
391
|
+
description: "Max opportunities returned (1-100, default 15)",
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: "verifystack_dex_market_intel",
|
|
398
|
+
title: "Multi-Chain DEX Liquidity & Order-Flow Oracle",
|
|
399
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
400
|
+
description:
|
|
401
|
+
"Paid x402 API ($0.006 USDC on Base): Multi-chain DEX liquidity, 24h volume, price changes, and buy/sell order-flow oracle powered by DexScreener and GeckoTerminal.",
|
|
402
|
+
inputSchema: {
|
|
403
|
+
type: "object",
|
|
404
|
+
additionalProperties: false,
|
|
405
|
+
properties: {
|
|
406
|
+
q: {
|
|
407
|
+
type: "string",
|
|
408
|
+
description: "Token symbol or name query (e.g. AERO, VIRTUAL, PEPE)",
|
|
409
|
+
},
|
|
410
|
+
address: {
|
|
411
|
+
type: "string",
|
|
412
|
+
description: "Optional token contract/mint address",
|
|
413
|
+
},
|
|
414
|
+
chain: {
|
|
415
|
+
type: "string",
|
|
416
|
+
description: "Optional chain filter (base, ethereum, solana, arbitrum, bsc, polygon)",
|
|
417
|
+
},
|
|
418
|
+
minLiquidityUsd: {
|
|
419
|
+
type: "number",
|
|
420
|
+
description: "Minimum pool liquidity in USD (default 5000)",
|
|
421
|
+
},
|
|
422
|
+
limit: {
|
|
423
|
+
type: "number",
|
|
424
|
+
description: "Max pools returned (1-30, default 10)",
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "verifystack_render_url",
|
|
431
|
+
title: "Headless Chromium JS Web Renderer & Screenshotter",
|
|
432
|
+
annotations: READ_NETWORK_ANNOTATIONS,
|
|
433
|
+
description:
|
|
434
|
+
"Paid x402 API ($0.02 USDC on Base): Renders dynamic JavaScript/SPA/React web pages inside a real headless Chromium browser with SSRF protection, returning clean Markdown, metadata, optional links, and optional JPEG/PNG screenshot.",
|
|
435
|
+
inputSchema: {
|
|
436
|
+
type: "object",
|
|
437
|
+
additionalProperties: false,
|
|
438
|
+
required: ["url"],
|
|
439
|
+
properties: {
|
|
440
|
+
url: {
|
|
441
|
+
type: "string",
|
|
442
|
+
description: "Public http:// or https:// URL to render in Chromium",
|
|
443
|
+
},
|
|
444
|
+
waitUntil: {
|
|
445
|
+
type: "string",
|
|
446
|
+
description: "Navigation readiness event: domcontentloaded, load, or networkidle (default networkidle)",
|
|
447
|
+
},
|
|
448
|
+
waitMs: {
|
|
449
|
+
type: "number",
|
|
450
|
+
description: "Extra settle delay in ms after load for SPA hydration (0-5000, default 500)",
|
|
451
|
+
},
|
|
452
|
+
waitForSelector: {
|
|
453
|
+
type: "string",
|
|
454
|
+
description: "Optional CSS selector to wait for before extracting content",
|
|
455
|
+
},
|
|
456
|
+
maxChars: {
|
|
457
|
+
type: "number",
|
|
458
|
+
description: "Maximum Markdown length returned (200-40000, default 12000)",
|
|
459
|
+
},
|
|
460
|
+
includeLinks: {
|
|
461
|
+
type: "boolean",
|
|
462
|
+
description: "Include extracted outbound links array (default false)",
|
|
463
|
+
},
|
|
464
|
+
includeScreenshot: {
|
|
465
|
+
type: "boolean",
|
|
466
|
+
description: "Capture base64 JPEG or PNG screenshot of rendered page (default false)",
|
|
467
|
+
},
|
|
468
|
+
screenshotFormat: {
|
|
469
|
+
type: "string",
|
|
470
|
+
description: "Screenshot encoding when includeScreenshot is true: jpeg or png (default jpeg)",
|
|
471
|
+
},
|
|
472
|
+
fullPage: {
|
|
473
|
+
type: "boolean",
|
|
474
|
+
description: "Capture full scrollable page screenshot instead of viewport (default false)",
|
|
475
|
+
},
|
|
476
|
+
blockMedia: {
|
|
477
|
+
type: "boolean",
|
|
478
|
+
description: "Block images/fonts/video for faster extraction (defaults true unless includeScreenshot is true)",
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
let cachedHttpClientPromise = null;
|
|
486
|
+
|
|
487
|
+
async function getX402HttpClient(privateKey) {
|
|
488
|
+
if (!cachedHttpClientPromise) {
|
|
489
|
+
cachedHttpClientPromise = (async () => {
|
|
490
|
+
const [{ x402Client }, { x402HTTPClient }, { registerExactEvmScheme }, { privateKeyToAccount }] =
|
|
491
|
+
await Promise.all([
|
|
492
|
+
import("@x402/core/client"),
|
|
493
|
+
import("@x402/core/http"),
|
|
494
|
+
import("@x402/evm/exact/client"),
|
|
495
|
+
import("viem/accounts"),
|
|
496
|
+
]);
|
|
497
|
+
const account = privateKeyToAccount(privateKey);
|
|
498
|
+
const client = new x402Client();
|
|
499
|
+
registerExactEvmScheme(client, { signer: account });
|
|
500
|
+
return new x402HTTPClient(client);
|
|
501
|
+
})();
|
|
502
|
+
}
|
|
503
|
+
return cachedHttpClientPromise;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function buildRequestSpec(toolName, args = {}, baseUrl = DEFAULT_BASE_URL) {
|
|
507
|
+
if (toolName === "verifystack_live_funding_arb") {
|
|
508
|
+
const params = new URLSearchParams();
|
|
509
|
+
if (args.symbol) params.set("symbol", String(args.symbol));
|
|
510
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
511
|
+
if (args.minApr !== undefined) params.set("minApr", String(args.minApr));
|
|
512
|
+
const qs = params.toString();
|
|
513
|
+
return {
|
|
514
|
+
url: `${baseUrl}/api/live-funding-arb${qs ? `?${qs}` : ""}`,
|
|
515
|
+
init: { method: "GET" },
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
if (toolName === "verifystack_prediction_markets") {
|
|
519
|
+
const params = new URLSearchParams();
|
|
520
|
+
if (args.q) params.set("q", String(args.q));
|
|
521
|
+
if (args.platform) params.set("platform", String(args.platform));
|
|
522
|
+
if (args.minLiquidity !== undefined) params.set("minLiquidity", String(args.minLiquidity));
|
|
523
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
524
|
+
const qs = params.toString();
|
|
525
|
+
return {
|
|
526
|
+
url: `${baseUrl}/api/prediction-markets${qs ? `?${qs}` : ""}`,
|
|
527
|
+
init: { method: "GET" },
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
if (toolName === "verifystack_defi_yields") {
|
|
531
|
+
const params = new URLSearchParams();
|
|
532
|
+
if (args.chain) params.set("chain", String(args.chain));
|
|
533
|
+
if (args.symbol) params.set("symbol", String(args.symbol));
|
|
534
|
+
if (args.project) params.set("project", String(args.project));
|
|
535
|
+
if (args.stablecoin !== undefined) params.set("stablecoin", String(args.stablecoin));
|
|
536
|
+
if (args.singleAsset !== undefined) params.set("singleAsset", String(args.singleAsset));
|
|
537
|
+
if (args.minTvl !== undefined) params.set("minTvl", String(args.minTvl));
|
|
538
|
+
if (args.minApy !== undefined) params.set("minApy", String(args.minApy));
|
|
539
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
540
|
+
const qs = params.toString();
|
|
541
|
+
return {
|
|
542
|
+
url: `${baseUrl}/api/defi-yields${qs ? `?${qs}` : ""}`,
|
|
543
|
+
init: { method: "GET" },
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
if (toolName === "verifystack_web_research") {
|
|
547
|
+
const params = new URLSearchParams();
|
|
548
|
+
if (args.q) params.set("q", String(args.q));
|
|
549
|
+
if (args.sources) params.set("sources", String(args.sources));
|
|
550
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
551
|
+
const qs = params.toString();
|
|
552
|
+
return {
|
|
553
|
+
url: `${baseUrl}/api/web-research${qs ? `?${qs}` : ""}`,
|
|
554
|
+
init: { method: "GET" },
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
if (toolName === "verifystack_spot_perp_basis") {
|
|
558
|
+
const params = new URLSearchParams();
|
|
559
|
+
if (args.symbol) params.set("symbol", String(args.symbol));
|
|
560
|
+
if (args.minBasisBps !== undefined) params.set("minBasisBps", String(args.minBasisBps));
|
|
561
|
+
if (args.notionalUsd !== undefined) params.set("notionalUsd", String(args.notionalUsd));
|
|
562
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
563
|
+
const qs = params.toString();
|
|
564
|
+
return {
|
|
565
|
+
url: `${baseUrl}/api/spot-perp-basis${qs ? `?${qs}` : ""}`,
|
|
566
|
+
init: { method: "GET" },
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
if (toolName === "verifystack_dex_market_intel") {
|
|
570
|
+
const params = new URLSearchParams();
|
|
571
|
+
if (args.q) params.set("q", String(args.q));
|
|
572
|
+
if (args.address) params.set("address", String(args.address));
|
|
573
|
+
if (args.chain) params.set("chain", String(args.chain));
|
|
574
|
+
if (args.minLiquidityUsd !== undefined) params.set("minLiquidityUsd", String(args.minLiquidityUsd));
|
|
575
|
+
if (args.limit !== undefined) params.set("limit", String(args.limit));
|
|
576
|
+
const qs = params.toString();
|
|
577
|
+
return {
|
|
578
|
+
url: `${baseUrl}/api/dex-market-intel${qs ? `?${qs}` : ""}`,
|
|
579
|
+
init: { method: "GET" },
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
const postRoutes = {
|
|
584
|
+
verifystack_clean_url: "/api/clean-url",
|
|
585
|
+
verifystack_render_url: "/api/render-url",
|
|
586
|
+
verifystack_contract_intel: "/api/contract-intel",
|
|
587
|
+
verifystack_decode_tx: "/api/decode-tx",
|
|
588
|
+
verifystack_domain_intel: "/api/domain-intel",
|
|
589
|
+
verifystack_wallet_profile: "/api/wallet-profile",
|
|
590
|
+
verifystack_token_safety: "/api/token-safety",
|
|
591
|
+
verifystack_verify_signature: "/api/verify-signature",
|
|
592
|
+
verifystack_arb_net_profit: "/api/arb-net-profit",
|
|
593
|
+
verifystack_liquidation_sim: "/api/liquidation-sim",
|
|
594
|
+
};
|
|
595
|
+
const path = postRoutes[toolName];
|
|
596
|
+
if (!path) {
|
|
597
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
url: `${baseUrl}${path}`,
|
|
601
|
+
init: {
|
|
602
|
+
method: "POST",
|
|
603
|
+
headers: { "Content-Type": "application/json" },
|
|
604
|
+
body: JSON.stringify(args),
|
|
605
|
+
},
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export async function executeTool(
|
|
610
|
+
toolName,
|
|
611
|
+
args = {},
|
|
612
|
+
{
|
|
613
|
+
baseUrl = process.env.VERIFYSTACK_URL || DEFAULT_BASE_URL,
|
|
614
|
+
buyerKey = process.env.X402_BUYER_KEY,
|
|
615
|
+
fetchFn = fetch,
|
|
616
|
+
} = {}
|
|
617
|
+
) {
|
|
618
|
+
const { url, init } = buildRequestSpec(toolName, args, baseUrl);
|
|
619
|
+
const firstRes = await fetchFn(url, init);
|
|
620
|
+
|
|
621
|
+
if (firstRes.status !== 402) {
|
|
622
|
+
const body = await firstRes.text();
|
|
623
|
+
return {
|
|
624
|
+
isError: !firstRes.ok,
|
|
625
|
+
content: [{ type: "text", text: body }],
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
const rawHeader = firstRes.headers.get("payment-required");
|
|
630
|
+
if (!buyerKey) {
|
|
631
|
+
const decoded = rawHeader
|
|
632
|
+
? JSON.parse(Buffer.from(rawHeader, "base64").toString("utf8"))
|
|
633
|
+
: { error: "Payment required" };
|
|
634
|
+
return {
|
|
635
|
+
isError: true,
|
|
636
|
+
content: [
|
|
637
|
+
{
|
|
638
|
+
type: "text",
|
|
639
|
+
text: JSON.stringify(
|
|
640
|
+
{
|
|
641
|
+
error: "X402_BUYER_KEY env variable is not set for automatic Base USDC payment.",
|
|
642
|
+
paymentRequired: decoded,
|
|
643
|
+
},
|
|
644
|
+
null,
|
|
645
|
+
2
|
|
646
|
+
),
|
|
647
|
+
},
|
|
648
|
+
],
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
const httpClient = await getX402HttpClient(buyerKey);
|
|
653
|
+
const paymentRequired = httpClient.getPaymentRequiredResponse((name) =>
|
|
654
|
+
firstRes.headers.get(name)
|
|
655
|
+
);
|
|
656
|
+
const payload = await httpClient.createPaymentPayload(paymentRequired);
|
|
657
|
+
const authHeaders = httpClient.encodePaymentSignatureHeader(payload);
|
|
658
|
+
|
|
659
|
+
const paidRes = await fetchFn(url, {
|
|
660
|
+
...init,
|
|
661
|
+
headers: { ...(init.headers || {}), ...authHeaders },
|
|
662
|
+
});
|
|
663
|
+
const text = await paidRes.text();
|
|
664
|
+
return {
|
|
665
|
+
isError: !paidRes.ok,
|
|
666
|
+
content: [{ type: "text", text }],
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export async function handleRpcMessage(msg, deps = {}) {
|
|
671
|
+
if (!msg || typeof msg !== "object") {
|
|
672
|
+
return {
|
|
673
|
+
jsonrpc: "2.0",
|
|
674
|
+
id: null,
|
|
675
|
+
error: { code: -32600, message: "Invalid Request" },
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const { id, method, params } = msg;
|
|
680
|
+
|
|
681
|
+
if (method === "notifications/initialized") {
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
if (method === "initialize") {
|
|
685
|
+
return {
|
|
686
|
+
jsonrpc: "2.0",
|
|
687
|
+
id,
|
|
688
|
+
result: {
|
|
689
|
+
protocolVersion: "2024-11-05",
|
|
690
|
+
capabilities: { tools: {} },
|
|
691
|
+
serverInfo: { name: "verifystack-x402-mcp", version: "0.5.0" },
|
|
692
|
+
},
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
if (method === "tools/list") {
|
|
696
|
+
return { jsonrpc: "2.0", id, result: { tools: TOOLS } };
|
|
697
|
+
}
|
|
698
|
+
if (method === "tools/call") {
|
|
699
|
+
try {
|
|
700
|
+
const result = await executeTool(params?.name, params?.arguments, deps);
|
|
701
|
+
return { jsonrpc: "2.0", id, result };
|
|
702
|
+
} catch (error) {
|
|
703
|
+
return {
|
|
704
|
+
jsonrpc: "2.0",
|
|
705
|
+
id,
|
|
706
|
+
result: {
|
|
707
|
+
isError: true,
|
|
708
|
+
content: [
|
|
709
|
+
{
|
|
710
|
+
type: "text",
|
|
711
|
+
text: error instanceof Error ? error.message : String(error),
|
|
712
|
+
},
|
|
713
|
+
],
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (id === undefined) return null;
|
|
720
|
+
return {
|
|
721
|
+
jsonrpc: "2.0",
|
|
722
|
+
id,
|
|
723
|
+
error: { code: -32601, message: `Method not found: ${method}` },
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function startStdioServer() {
|
|
728
|
+
const rl = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
729
|
+
rl.on("line", async (line) => {
|
|
730
|
+
const trimmed = line.trim();
|
|
731
|
+
if (!trimmed) return;
|
|
732
|
+
try {
|
|
733
|
+
const msg = JSON.parse(trimmed);
|
|
734
|
+
const reply = await handleRpcMessage(msg);
|
|
735
|
+
if (reply) {
|
|
736
|
+
process.stdout.write(`${JSON.stringify(reply)}\n`);
|
|
737
|
+
}
|
|
738
|
+
} catch {
|
|
739
|
+
process.stdout.write(
|
|
740
|
+
`${JSON.stringify({
|
|
741
|
+
jsonrpc: "2.0",
|
|
742
|
+
id: null,
|
|
743
|
+
error: { code: -32700, message: "Parse error" },
|
|
744
|
+
})}\n`
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (
|
|
751
|
+
process.argv[1] &&
|
|
752
|
+
import.meta.url === pathToFileURL(process.argv[1]).href
|
|
753
|
+
) {
|
|
754
|
+
startStdioServer();
|
|
755
|
+
}
|