@continuumdao/ctm-mpc-defi 0.1.4 → 0.2.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 (55) hide show
  1. package/dist/agent/catalog.cjs +878 -141
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.cts +756 -12
  4. package/dist/agent/catalog.d.ts +756 -12
  5. package/dist/agent/catalog.js +829 -142
  6. package/dist/agent/catalog.js.map +1 -1
  7. package/dist/chains/evm/index.cjs +13 -0
  8. package/dist/chains/evm/index.cjs.map +1 -1
  9. package/dist/chains/evm/index.d.cts +3 -1
  10. package/dist/chains/evm/index.d.ts +3 -1
  11. package/dist/chains/evm/index.js +13 -1
  12. package/dist/chains/evm/index.js.map +1 -1
  13. package/dist/index.cjs +825 -141
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +2 -1
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.js +825 -142
  18. package/dist/index.js.map +1 -1
  19. package/dist/protocols/evm/aave-v4/index.cjs +1987 -0
  20. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -0
  21. package/dist/protocols/evm/aave-v4/index.d.cts +500 -0
  22. package/dist/protocols/evm/aave-v4/index.d.ts +500 -0
  23. package/dist/protocols/evm/aave-v4/index.js +1943 -0
  24. package/dist/protocols/evm/aave-v4/index.js.map +1 -0
  25. package/dist/protocols/evm/ethena/index.cjs +965 -0
  26. package/dist/protocols/evm/ethena/index.cjs.map +1 -0
  27. package/dist/protocols/evm/ethena/index.d.cts +161 -0
  28. package/dist/protocols/evm/ethena/index.d.ts +161 -0
  29. package/dist/protocols/evm/ethena/index.js +943 -0
  30. package/dist/protocols/evm/ethena/index.js.map +1 -0
  31. package/dist/protocols/evm/euler-v2/index.cjs +2263 -0
  32. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -0
  33. package/dist/protocols/evm/euler-v2/index.d.cts +317 -0
  34. package/dist/protocols/evm/euler-v2/index.d.ts +317 -0
  35. package/dist/protocols/evm/euler-v2/index.js +2238 -0
  36. package/dist/protocols/evm/euler-v2/index.js.map +1 -0
  37. package/dist/protocols/evm/lido/index.cjs +834 -0
  38. package/dist/protocols/evm/lido/index.cjs.map +1 -0
  39. package/dist/protocols/evm/lido/index.d.cts +120 -0
  40. package/dist/protocols/evm/lido/index.d.ts +120 -0
  41. package/dist/protocols/evm/lido/index.js +809 -0
  42. package/dist/protocols/evm/lido/index.js.map +1 -0
  43. package/dist/protocols/evm/maple/index.cjs +707 -0
  44. package/dist/protocols/evm/maple/index.cjs.map +1 -0
  45. package/dist/protocols/evm/maple/index.d.cts +109 -0
  46. package/dist/protocols/evm/maple/index.d.ts +109 -0
  47. package/dist/protocols/evm/maple/index.js +693 -0
  48. package/dist/protocols/evm/maple/index.js.map +1 -0
  49. package/dist/protocols/evm/sky/index.cjs +1254 -0
  50. package/dist/protocols/evm/sky/index.cjs.map +1 -0
  51. package/dist/protocols/evm/sky/index.d.cts +218 -0
  52. package/dist/protocols/evm/sky/index.d.ts +218 -0
  53. package/dist/protocols/evm/sky/index.js +1229 -0
  54. package/dist/protocols/evm/sky/index.js.map +1 -0
  55. package/package.json +37 -3
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
- require('viem');
3
+ var viem = require('viem');
4
+ var zodToJsonSchema = require('zod-to-json-schema');
5
+ var zod = require('zod');
4
6
 
5
7
  // src/core/registry.ts
6
8
  var modules = [];
@@ -272,46 +274,581 @@ var MANAGEMENT_SIG_DOC = {
272
274
  fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key."
273
275
  }
274
276
  };
275
-
276
- // src/agent/mcpTools.ts
277
- function paramProperties(params, includeCommon = []) {
278
- const out = {};
279
- for (const k of includeCommon) {
280
- const d = EVM_COMMON_PARAM_DOCS[k];
281
- if (d) out[k] = { type: d.type, description: d.description };
277
+ function zodSchemaToMcpJsonSchema(schema) {
278
+ const raw = zodToJsonSchema.zodToJsonSchema(schema, {
279
+ target: "openApi3",
280
+ $refStrategy: "none"
281
+ });
282
+ if (raw.type === "object" || raw.type === "array" || raw.type === "string") {
283
+ const { $schema: _s, ...rest } = raw;
284
+ return rest;
282
285
  }
283
- for (const [k, d] of Object.entries(params)) {
284
- out[k] = { type: d.type, description: d.description };
286
+ const defs = raw.definitions;
287
+ if (defs) {
288
+ const first = Object.values(defs)[0];
289
+ if (first?.type) {
290
+ const { $schema: _s, ...rest } = first;
291
+ return rest;
292
+ }
285
293
  }
286
- return out;
294
+ return raw;
287
295
  }
288
- function requiredKeys(params, includeCommon = []) {
289
- const req = [];
290
- for (const k of includeCommon) {
291
- if (EVM_COMMON_PARAM_DOCS[k]?.required) req.push(k);
292
- }
293
- for (const [k, d] of Object.entries(params)) {
294
- if (d.required) req.push(k);
295
- }
296
- return req;
296
+ var evmAddressSchema = zod.z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
297
+ var keyGenSchema = zod.z.object({
298
+ pubkeyhex: zod.z.string().min(1).describe("MPC secp256k1 public key hex (required for multiSignRequest pubKey)"),
299
+ keylist: zod.z.array(zod.z.string()).optional().describe("Key list on the sign request"),
300
+ ClientKeys: zod.z.record(zod.z.string()).optional().describe("Optional client key map from keyGen")
301
+ }).describe(
302
+ "MPC key slice: { pubkeyhex, keylist?, ClientKeys? }. Used for pubKey/keyList on POST /multiSignRequest."
303
+ );
304
+ var chainDetailSchema = zod.z.object({
305
+ legacy: zod.z.boolean().optional(),
306
+ gasLimit: zod.z.number().optional(),
307
+ gasMultiplier: zod.z.number().optional(),
308
+ gasPrice: zod.z.number().optional(),
309
+ baseFee: zod.z.number().optional(),
310
+ priorityFee: zod.z.number().optional(),
311
+ baseFeeMultiplier: zod.z.number().optional()
312
+ }).passthrough().describe(
313
+ "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
314
+ );
315
+ var evmMultisignCommonInputSchema = zod.z.object({
316
+ keyGen: keyGenSchema,
317
+ purposeText: zod.z.string().min(1).describe(
318
+ "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
319
+ ),
320
+ useCustomGas: zod.z.boolean().describe(
321
+ "When true, apply chain gas settings from chainDetail / customGasChainDetails instead of raw RPC estimates only."
322
+ ),
323
+ chainId: zod.z.number().int().positive().describe("EVM chain id (decimal). Becomes destinationChainID on the sign request."),
324
+ rpcUrl: zod.z.string().min(1).describe("HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."),
325
+ executorAddress: evmAddressSchema.describe(
326
+ "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
327
+ ),
328
+ chainDetail: chainDetailSchema,
329
+ customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
330
+ });
331
+ var multisignOutputSchema = zod.z.object({
332
+ bodyForSign: zod.z.record(zod.z.unknown()).describe(
333
+ "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
334
+ ),
335
+ messageToSign: zod.z.string().describe("JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig.")
336
+ }).describe(
337
+ "Unsigned mpc-auth multiSignRequest payload. Sign messageToSign and POST { ...bodyForSign, clientSig, signedMessage } to /multiSignRequest."
338
+ );
339
+ var jsonObjectSchema = zod.z.record(zod.z.unknown());
340
+ var uniswapQuoteTradeTypeSchema = zod.z.enum(["EXACT_INPUT", "EXACT_OUTPUT"]);
341
+ var mcpUniswapV4QuoteInputSchema = zod.z.object({
342
+ type: uniswapQuoteTradeTypeSchema.describe("EXACT_INPUT or EXACT_OUTPUT"),
343
+ amount: zod.z.string().min(1).describe("Amount in token-in base units (wei string for ERC-20)"),
344
+ tokenIn: zod.z.string().min(1).describe("Input token; 0x0 for native ETH"),
345
+ tokenOut: zod.z.string().min(1).describe("Output token address"),
346
+ chainId: zod.z.union([zod.z.number().int().positive(), zod.z.string().min(1)]).describe("tokenInChainId / same-chain default"),
347
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API x-api-key"),
348
+ swapper: evmAddressSchema.optional().describe("MPC executor; omit if keyGen + managementNodeUrl provided"),
349
+ slippage: zod.z.union([zod.z.number(), zod.z.string()]).optional().describe("Slippage percent; omit for API auto slippage"),
350
+ keyGen: zod.z.string().optional().describe("KeyGen id \u2014 resolves swapper via GET /getKeyGenResultById when swapper omitted"),
351
+ managementNodeUrl: zod.z.string().min(1).optional().describe("MPC node base URL; required with keyGen when swapper is omitted"),
352
+ tokenInChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
353
+ tokenOutChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
354
+ permit2Disabled: zod.z.boolean().optional(),
355
+ baseUrl: zod.z.string().optional(),
356
+ universalRouterVersion: zod.z.string().optional()
357
+ });
358
+ var mcpUniswapV4QuoteOutputSchema = jsonObjectSchema.describe(
359
+ "Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
360
+ );
361
+ var mcpUniswapV4CreateSwapInputSchema = zod.z.object({
362
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API key"),
363
+ fullQuoteFromPermit: jsonObjectSchema.describe("Full quote JSON from ctm_uniswap_v4_quote"),
364
+ swapTransactionDeadlineUnix: zod.z.number().int().positive().optional().describe("On-chain deadline unix seconds; default ~30 min from now"),
365
+ useServerProxy: zod.z.boolean().optional().describe("Set false in Node/agents; true only in browser via Next API route"),
366
+ baseUrl: zod.z.string().optional(),
367
+ universalRouterVersion: zod.z.string().optional()
368
+ });
369
+ var mcpUniswapV4CreateSwapOutputSchema = zod.z.object({
370
+ swap: jsonObjectSchema.describe("Universal Router tx: { to, data, value, gasLimit? }"),
371
+ requestId: zod.z.string().optional(),
372
+ gasFee: zod.z.string().optional()
373
+ }).passthrough().describe("{ swap: TransactionRequest, requestId?, gasFee? }");
374
+ var swapTxRequestSchema = jsonObjectSchema.describe("swap field from create_swap response (to, data, value)");
375
+ var mcpUniswapV4BuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
376
+ tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
377
+ swap: swapTxRequestSchema,
378
+ createSwapResponse: zod.z.object({
379
+ swap: swapTxRequestSchema,
380
+ requestId: zod.z.string().optional(),
381
+ gasFee: zod.z.string().optional()
382
+ }).passthrough().describe("Full create_swap response"),
383
+ fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
384
+ swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
385
+ slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
386
+ });
387
+ var mcpCurveDaoBuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
388
+ tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
389
+ tokenOut: zod.z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
390
+ amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn"),
391
+ slippagePercent: zod.z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
392
+ });
393
+ function mcpMultisignInput(fields) {
394
+ return evmMultisignCommonInputSchema.extend(fields);
297
395
  }
298
- var multisignOutputSchema = {
299
- type: "object",
300
- description: MULTISIGN_OUTPUT_DOC.description,
301
- properties: {
302
- bodyForSign: {
303
- type: "object",
304
- description: MULTISIGN_OUTPUT_DOC.fields.bodyForSign.description
305
- },
306
- messageToSign: {
307
- type: "string",
308
- description: MULTISIGN_OUTPUT_DOC.fields.messageToSign.description
309
- }
310
- },
311
- required: ["bodyForSign", "messageToSign"]
312
- };
313
- var MCP_TOOL_DEFINITIONS = [
314
- {
396
+ var mcpLidoSubmitInputSchema = mcpMultisignInput({
397
+ valueWei: zod.z.string().min(1).describe("ETH to stake (wei decimal string)"),
398
+ referral: evmAddressSchema.optional()
399
+ });
400
+ var mcpLidoRequestWithdrawalsInputSchema = mcpMultisignInput({
401
+ stEthAmountsWei: zod.z.array(zod.z.string()).min(1).describe("stETH amounts per withdrawal request (wei strings)")
402
+ });
403
+ var mcpLidoClaimWithdrawalInputSchema = mcpMultisignInput({
404
+ requestId: zod.z.union([zod.z.string(), zod.z.number()]).describe("Withdrawal queue request id")
405
+ });
406
+ var mcpLidoWrapStEthInputSchema = mcpMultisignInput({
407
+ stEthAmountWei: zod.z.string().min(1)
408
+ });
409
+ var mcpLidoUnwrapWstEthInputSchema = mcpMultisignInput({
410
+ wstEthAmountWei: zod.z.string().min(1)
411
+ });
412
+ var mcpEthenaStakeInputSchema = mcpMultisignInput({
413
+ usdeAmountHuman: zod.z.string().min(1),
414
+ susdeVault: evmAddressSchema.optional()
415
+ });
416
+ var mcpEthenaRedeemInputSchema = mcpMultisignInput({
417
+ susdeSharesHuman: zod.z.string().min(1),
418
+ susdeVault: evmAddressSchema.optional()
419
+ });
420
+ var mcpEthenaCooldownInputSchema = mcpMultisignInput({
421
+ susdeSharesHuman: zod.z.string().min(1),
422
+ susdeVault: evmAddressSchema.optional()
423
+ });
424
+ var mcpEthenaClaimInputSchema = mcpMultisignInput({
425
+ susdeVault: evmAddressSchema.optional()
426
+ });
427
+ var mcpMapleDepositInputSchema = mcpMultisignInput({
428
+ syrupRouter: evmAddressSchema,
429
+ pool: evmAddressSchema,
430
+ asset: evmAddressSchema,
431
+ amountHuman: zod.z.string().min(1),
432
+ authorizeSig: jsonObjectSchema.optional()
433
+ });
434
+ var mcpMapleRequestRedeemInputSchema = mcpMultisignInput({
435
+ pool: evmAddressSchema,
436
+ sharesHuman: zod.z.string().min(1),
437
+ receiver: evmAddressSchema
438
+ });
439
+ var mcpSkyLockstakeStakeInputSchema = mcpMultisignInput({
440
+ skyAmountHuman: zod.z.string().min(1),
441
+ usdsDrawHuman: zod.z.string().optional(),
442
+ farmRef: zod.z.string().optional()
443
+ });
444
+ var mcpSkyLockstakeDrawInputSchema = mcpMultisignInput({
445
+ usdsAmountHuman: zod.z.string().min(1),
446
+ urnIndex: zod.z.number().int().nonnegative()
447
+ });
448
+ var mcpSkyLockstakeWipeInputSchema = mcpMultisignInput({
449
+ usdsAmountHuman: zod.z.string().min(1),
450
+ urnIndex: zod.z.number().int().nonnegative()
451
+ });
452
+ var mcpSkyLockstakeCloseInputSchema = mcpMultisignInput({
453
+ urnIndex: zod.z.number().int().nonnegative()
454
+ });
455
+ var mcpSkyLockstakeGetRewardInputSchema = mcpMultisignInput({
456
+ urnIndex: zod.z.number().int().nonnegative()
457
+ });
458
+ var mcpSkySusdsDepositInputSchema = mcpMultisignInput({
459
+ usdsAmountHuman: zod.z.string().min(1)
460
+ });
461
+ var mcpSkySusdsRedeemInputSchema = mcpMultisignInput({
462
+ sharesHuman: zod.z.string().min(1)
463
+ });
464
+ var mcpAaveV4DepositInputSchema = mcpMultisignInput({
465
+ spoke: evmAddressSchema,
466
+ underlying: evmAddressSchema,
467
+ amountHuman: zod.z.string().min(1),
468
+ marketId: zod.z.string().min(1)
469
+ });
470
+ var mcpAaveV4WithdrawInputSchema = mcpMultisignInput({
471
+ spoke: evmAddressSchema,
472
+ underlying: evmAddressSchema,
473
+ amountHuman: zod.z.string().min(1),
474
+ marketId: zod.z.string().min(1)
475
+ });
476
+ var mcpAaveV4BorrowInputSchema = mcpMultisignInput({
477
+ spoke: evmAddressSchema,
478
+ underlying: evmAddressSchema,
479
+ amountHuman: zod.z.string().min(1),
480
+ marketId: zod.z.string().min(1)
481
+ });
482
+ var mcpAaveV4RepayInputSchema = mcpMultisignInput({
483
+ spoke: evmAddressSchema,
484
+ underlying: evmAddressSchema,
485
+ amountHuman: zod.z.string().min(1),
486
+ marketId: zod.z.string().min(1)
487
+ });
488
+ var mcpEulerV2IsolatedLendInputSchema = mcpMultisignInput({
489
+ vault: evmAddressSchema,
490
+ assetAmountHuman: zod.z.string().min(1)
491
+ });
492
+ var mcpEulerV2IsolatedBorrowInputSchema = mcpMultisignInput({
493
+ vault: evmAddressSchema,
494
+ collateralAsset: evmAddressSchema,
495
+ borrowAsset: evmAddressSchema,
496
+ collateralAmountHuman: zod.z.string().min(1),
497
+ loopBorrowWeis: zod.z.array(zod.z.string()).min(1)
498
+ });
499
+ var mcpEulerV2VaultWithdrawInputSchema = mcpMultisignInput({
500
+ vault: evmAddressSchema,
501
+ sharesHuman: zod.z.string().min(1)
502
+ });
503
+ var mcpEulerV2BorrowRepayInputSchema = mcpMultisignInput({
504
+ vault: evmAddressSchema,
505
+ amountHuman: zod.z.string().min(1)
506
+ });
507
+ var mcpEulerV2CollateralDepositInputSchema = mcpMultisignInput({
508
+ vault: evmAddressSchema,
509
+ collateralAsset: evmAddressSchema,
510
+ amountHuman: zod.z.string().min(1)
511
+ });
512
+ var mcpEulerV2CollateralWithdrawInputSchema = mcpMultisignInput({
513
+ vault: evmAddressSchema,
514
+ collateralAsset: evmAddressSchema,
515
+ amountHuman: zod.z.string().min(1)
516
+ });
517
+
518
+ // src/agent/mcpProtocolTools.ts
519
+ function defineProtocolMcpTool(def) {
520
+ return {
521
+ ...def,
522
+ outputZod: multisignOutputSchema,
523
+ inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
524
+ outputSchema: zodSchemaToMcpJsonSchema(multisignOutputSchema),
525
+ parseInput: (data) => def.inputZod.parse(data),
526
+ parseOutput: (data) => multisignOutputSchema.parse(data)
527
+ };
528
+ }
529
+ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
530
+ defineProtocolMcpTool({
531
+ name: "ctm_lido_build_submit_multisign",
532
+ actionId: "lido.submit",
533
+ protocolId: "lido",
534
+ chainCategory: "evm",
535
+ description: "Build mpc-auth multiSignRequest for Lido ETH stake (submit).",
536
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
537
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
538
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoSubmit" },
539
+ inputZod: mcpLidoSubmitInputSchema
540
+ }),
541
+ defineProtocolMcpTool({
542
+ name: "ctm_lido_build_request_withdrawals_multisign",
543
+ actionId: "lido.request-withdrawals",
544
+ protocolId: "lido",
545
+ chainCategory: "evm",
546
+ description: "Build batch for Lido withdrawal queue (approve + requestWithdrawals).",
547
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
548
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
549
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoRequestWithdrawals" },
550
+ inputZod: mcpLidoRequestWithdrawalsInputSchema
551
+ }),
552
+ defineProtocolMcpTool({
553
+ name: "ctm_lido_build_claim_withdrawal_multisign",
554
+ actionId: "lido.claim-withdrawal",
555
+ protocolId: "lido",
556
+ chainCategory: "evm",
557
+ description: "Build tx for Lido claimWithdrawal.",
558
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
559
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
560
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoClaimWithdrawal" },
561
+ inputZod: mcpLidoClaimWithdrawalInputSchema
562
+ }),
563
+ defineProtocolMcpTool({
564
+ name: "ctm_lido_build_wrap_steth_multisign",
565
+ actionId: "lido.wrap-steth",
566
+ protocolId: "lido",
567
+ chainCategory: "evm",
568
+ description: "Build batch for wstETH wrap.",
569
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
570
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
571
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoWrapStEth" },
572
+ inputZod: mcpLidoWrapStEthInputSchema
573
+ }),
574
+ defineProtocolMcpTool({
575
+ name: "ctm_lido_build_unwrap_wsteth_multisign",
576
+ actionId: "lido.unwrap-wsteth",
577
+ protocolId: "lido",
578
+ chainCategory: "evm",
579
+ description: "Build tx for wstETH unwrap.",
580
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
581
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
582
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoUnwrapWstEth" },
583
+ inputZod: mcpLidoUnwrapWstEthInputSchema
584
+ }),
585
+ defineProtocolMcpTool({
586
+ name: "ctm_ethena_build_stake_multisign",
587
+ actionId: "ethena.stake-usde",
588
+ protocolId: "ethena",
589
+ chainCategory: "evm",
590
+ description: "Build batch: USDe approve + sUSDe deposit.",
591
+ prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
592
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
593
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUsdeStakeToSusde" },
594
+ inputZod: mcpEthenaStakeInputSchema
595
+ }),
596
+ defineProtocolMcpTool({
597
+ name: "ctm_ethena_build_redeem_multisign",
598
+ actionId: "ethena.redeem-susde",
599
+ protocolId: "ethena",
600
+ chainCategory: "evm",
601
+ description: "Build sUSDe redeem when cooldown is off.",
602
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
603
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
604
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeRedeemToUsde" },
605
+ inputZod: mcpEthenaRedeemInputSchema
606
+ }),
607
+ defineProtocolMcpTool({
608
+ name: "ctm_ethena_build_cooldown_multisign",
609
+ actionId: "ethena.cooldown-shares",
610
+ protocolId: "ethena",
611
+ chainCategory: "evm",
612
+ description: "Build sUSDe cooldownShares batch step.",
613
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
614
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
615
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeCooldownShares" },
616
+ inputZod: mcpEthenaCooldownInputSchema
617
+ }),
618
+ defineProtocolMcpTool({
619
+ name: "ctm_ethena_build_claim_multisign",
620
+ actionId: "ethena.claim-unstake",
621
+ protocolId: "ethena",
622
+ chainCategory: "evm",
623
+ description: "Build unstake claim after cooldown.",
624
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
625
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
626
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUnstakeClaim" },
627
+ inputZod: mcpEthenaClaimInputSchema
628
+ }),
629
+ defineProtocolMcpTool({
630
+ name: "ctm_maple_build_deposit_multisign",
631
+ actionId: "maple-syrup.deposit",
632
+ protocolId: "maple-syrup",
633
+ chainCategory: "evm",
634
+ description: "Build Maple Syrup router deposit batch.",
635
+ prerequisites: ["keyGen", "executorAddress", "router + pool addresses"],
636
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
637
+ handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMapleSyrupDeposit" },
638
+ inputZod: mcpMapleDepositInputSchema
639
+ }),
640
+ defineProtocolMcpTool({
641
+ name: "ctm_maple_build_request_redeem_multisign",
642
+ actionId: "maple-syrup.request-redeem",
643
+ protocolId: "maple-syrup",
644
+ chainCategory: "evm",
645
+ description: "Build Maple PoolV2 requestRedeem batch.",
646
+ prerequisites: ["keyGen", "executorAddress", "pool address"],
647
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
648
+ handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMaplePoolRequestRedeem" },
649
+ inputZod: mcpMapleRequestRedeemInputSchema
650
+ }),
651
+ defineProtocolMcpTool({
652
+ name: "ctm_sky_build_lockstake_stake_multisign",
653
+ actionId: "sky.lockstake-stake",
654
+ protocolId: "sky",
655
+ chainCategory: "evm",
656
+ description: "Build Sky Lockstake open/stake batch.",
657
+ prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
658
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
659
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeStakePositionBatch" },
660
+ inputZod: mcpSkyLockstakeStakeInputSchema
661
+ }),
662
+ defineProtocolMcpTool({
663
+ name: "ctm_sky_build_lockstake_draw_multisign",
664
+ actionId: "sky.lockstake-draw",
665
+ protocolId: "sky",
666
+ chainCategory: "evm",
667
+ description: "Build Lockstake draw (borrow USDS).",
668
+ prerequisites: ["keyGen", "executorAddress", "open urn"],
669
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
670
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeDrawBatch" },
671
+ inputZod: mcpSkyLockstakeDrawInputSchema
672
+ }),
673
+ defineProtocolMcpTool({
674
+ name: "ctm_sky_build_lockstake_wipe_multisign",
675
+ actionId: "sky.lockstake-wipe",
676
+ protocolId: "sky",
677
+ chainCategory: "evm",
678
+ description: "Build Lockstake repay/wipe batch.",
679
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
680
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
681
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeWipeBatch" },
682
+ inputZod: mcpSkyLockstakeWipeInputSchema
683
+ }),
684
+ defineProtocolMcpTool({
685
+ name: "ctm_sky_build_lockstake_close_multisign",
686
+ actionId: "sky.lockstake-close",
687
+ protocolId: "sky",
688
+ chainCategory: "evm",
689
+ description: "Build Lockstake close position batch.",
690
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
691
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
692
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeCloseBatch" },
693
+ inputZod: mcpSkyLockstakeCloseInputSchema
694
+ }),
695
+ defineProtocolMcpTool({
696
+ name: "ctm_sky_build_lockstake_get_reward_multisign",
697
+ actionId: "sky.lockstake-get-reward",
698
+ protocolId: "sky",
699
+ chainCategory: "evm",
700
+ description: "Build Lockstake getReward batch.",
701
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
702
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
703
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeGetRewardBatch" },
704
+ inputZod: mcpSkyLockstakeGetRewardInputSchema
705
+ }),
706
+ defineProtocolMcpTool({
707
+ name: "ctm_sky_build_susds_deposit_multisign",
708
+ actionId: "sky.susds-deposit",
709
+ protocolId: "sky",
710
+ chainCategory: "evm",
711
+ description: "Build USDS \u2192 sUSDS ERC-4626 deposit batch.",
712
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
713
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
714
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsDepositFromUsdsBatch" },
715
+ inputZod: mcpSkySusdsDepositInputSchema
716
+ }),
717
+ defineProtocolMcpTool({
718
+ name: "ctm_sky_build_susds_redeem_multisign",
719
+ actionId: "sky.susds-redeem",
720
+ protocolId: "sky",
721
+ chainCategory: "evm",
722
+ description: "Build sUSDS redeem to USDS batch.",
723
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
724
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
725
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsRedeemToUsdsBatch" },
726
+ inputZod: mcpSkySusdsRedeemInputSchema
727
+ }),
728
+ defineProtocolMcpTool({
729
+ name: "ctm_aave_v4_build_deposit_multisign",
730
+ actionId: "aave-v4.deposit",
731
+ protocolId: "aave-v4",
732
+ chainCategory: "evm",
733
+ description: "Build Aave v4 Spoke supply/deposit batch.",
734
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
735
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
736
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4DepositBatch" },
737
+ inputZod: mcpAaveV4DepositInputSchema
738
+ }),
739
+ defineProtocolMcpTool({
740
+ name: "ctm_aave_v4_build_withdraw_multisign",
741
+ actionId: "aave-v4.withdraw",
742
+ protocolId: "aave-v4",
743
+ chainCategory: "evm",
744
+ description: "Build Aave v4 Spoke withdraw batch.",
745
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
746
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
747
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeWithdraw" },
748
+ inputZod: mcpAaveV4WithdrawInputSchema
749
+ }),
750
+ defineProtocolMcpTool({
751
+ name: "ctm_aave_v4_build_borrow_multisign",
752
+ actionId: "aave-v4.borrow",
753
+ protocolId: "aave-v4",
754
+ chainCategory: "evm",
755
+ description: "Build Aave v4 Spoke borrow batch.",
756
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
757
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
758
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeBorrow" },
759
+ inputZod: mcpAaveV4BorrowInputSchema
760
+ }),
761
+ defineProtocolMcpTool({
762
+ name: "ctm_aave_v4_build_repay_multisign",
763
+ actionId: "aave-v4.repay",
764
+ protocolId: "aave-v4",
765
+ chainCategory: "evm",
766
+ description: "Build Aave v4 Spoke repay batch.",
767
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
768
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
769
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeRepay" },
770
+ inputZod: mcpAaveV4RepayInputSchema
771
+ }),
772
+ defineProtocolMcpTool({
773
+ name: "ctm_euler_v2_build_isolated_lend_multisign",
774
+ actionId: "euler-v2.isolated-lend",
775
+ protocolId: "euler-v2",
776
+ chainCategory: "evm",
777
+ description: "Build Euler v2 vault deposit/lend batch.",
778
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
779
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
780
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedLendDepositBatch" },
781
+ inputZod: mcpEulerV2IsolatedLendInputSchema
782
+ }),
783
+ defineProtocolMcpTool({
784
+ name: "ctm_euler_v2_build_isolated_borrow_multisign",
785
+ actionId: "euler-v2.isolated-borrow",
786
+ protocolId: "euler-v2",
787
+ chainCategory: "evm",
788
+ description: "Build Euler v2 isolated borrow loop batch.",
789
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral"],
790
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
791
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedBorrowBatch" },
792
+ inputZod: mcpEulerV2IsolatedBorrowInputSchema
793
+ }),
794
+ defineProtocolMcpTool({
795
+ name: "ctm_euler_v2_build_vault_withdraw_multisign",
796
+ actionId: "euler-v2.vault-withdraw",
797
+ protocolId: "euler-v2",
798
+ chainCategory: "evm",
799
+ description: "Build Euler v2 vault withdraw/redeem batch.",
800
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
801
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
802
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2VaultWithdrawBatch" },
803
+ inputZod: mcpEulerV2VaultWithdrawInputSchema
804
+ }),
805
+ defineProtocolMcpTool({
806
+ name: "ctm_euler_v2_build_borrow_repay_multisign",
807
+ actionId: "euler-v2.borrow-repay",
808
+ protocolId: "euler-v2",
809
+ chainCategory: "evm",
810
+ description: "Build Euler v2 borrow repay batch.",
811
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
812
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
813
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowRepayBatch" },
814
+ inputZod: mcpEulerV2BorrowRepayInputSchema
815
+ }),
816
+ defineProtocolMcpTool({
817
+ name: "ctm_euler_v2_build_collateral_deposit_multisign",
818
+ actionId: "euler-v2.collateral-deposit",
819
+ protocolId: "euler-v2",
820
+ chainCategory: "evm",
821
+ description: "Build Euler v2 borrow collateral deposit batch.",
822
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
823
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
824
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralDepositBatch" },
825
+ inputZod: mcpEulerV2CollateralDepositInputSchema
826
+ }),
827
+ defineProtocolMcpTool({
828
+ name: "ctm_euler_v2_build_collateral_withdraw_multisign",
829
+ actionId: "euler-v2.collateral-withdraw",
830
+ protocolId: "euler-v2",
831
+ chainCategory: "evm",
832
+ description: "Build Euler v2 borrow collateral withdraw batch.",
833
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
834
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
835
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralWithdrawBatch" },
836
+ inputZod: mcpEulerV2CollateralWithdrawInputSchema
837
+ })
838
+ ];
839
+
840
+ // src/agent/mcpTools.ts
841
+ function defineMcpTool(def) {
842
+ return {
843
+ ...def,
844
+ inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
845
+ outputSchema: zodSchemaToMcpJsonSchema(def.outputZod),
846
+ parseInput: (data) => def.inputZod.parse(data),
847
+ parseOutput: (data) => def.outputZod.parse(data)
848
+ };
849
+ }
850
+ var CORE_MCP_TOOL_DEFINITIONS = [
851
+ defineMcpTool({
315
852
  name: "ctm_uniswap_v4_quote",
316
853
  actionId: "uniswap-v4.quote",
317
854
  protocolId: "uniswap-v4",
@@ -320,33 +857,10 @@ var MCP_TOOL_DEFINITIONS = [
320
857
  prerequisites: ["Chain must be supported by Uniswap V4 (Universal Router map)."],
321
858
  followUp: ["ctm_uniswap_v4_create_swap", "ctm_uniswap_v4_build_swap_multisign"],
322
859
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapTradeQuote" },
323
- inputSchema: {
324
- type: "object",
325
- properties: paramProperties({
326
- type: { type: "string", required: true, description: "EXACT_INPUT or EXACT_OUTPUT" },
327
- amount: { type: "string", required: true, description: "Amount in token-in base units (wei string for ERC-20)" },
328
- tokenIn: { type: "address", required: true, description: "Input token; 0x0 for native ETH" },
329
- tokenOut: { type: "address", required: true, description: "Output token address" },
330
- chainId: { type: "number", required: true, description: "tokenInChainId / same-chain default" },
331
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API x-api-key" },
332
- swapper: { type: "address", required: false, description: "MPC executor; omit if keyGen + managementNodeUrl provided" },
333
- slippage: { type: "number", required: false, description: "Slippage percent; omit for API auto slippage" }
334
- }),
335
- required: requiredKeys({
336
- type: { type: "string", required: true, description: "" },
337
- amount: { type: "string", required: true, description: "" },
338
- tokenIn: { type: "address", required: true, description: "" },
339
- tokenOut: { type: "address", required: true, description: "" },
340
- chainId: { type: "number", required: true, description: "" },
341
- uniswapApiKey: { type: "string", required: true, description: "" }
342
- })
343
- },
344
- outputSchema: {
345
- type: "object",
346
- description: "Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
347
- }
348
- },
349
- {
860
+ inputZod: mcpUniswapV4QuoteInputSchema,
861
+ outputZod: mcpUniswapV4QuoteOutputSchema
862
+ }),
863
+ defineMcpTool({
350
864
  name: "ctm_uniswap_v4_create_swap",
351
865
  actionId: "uniswap-v4.create-swap",
352
866
  protocolId: "uniswap-v4",
@@ -355,33 +869,10 @@ var MCP_TOOL_DEFINITIONS = [
355
869
  prerequisites: ["ctm_uniswap_v4_quote output (fullQuoteFromPermit)"],
356
870
  followUp: ["ctm_uniswap_v4_build_swap_multisign"],
357
871
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapCreateSwap" },
358
- inputSchema: {
359
- type: "object",
360
- properties: paramProperties({
361
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" },
362
- fullQuoteFromPermit: { type: "object", required: true, description: "Full quote JSON from ctm_uniswap_v4_quote" },
363
- swapTransactionDeadlineUnix: {
364
- type: "number",
365
- required: false,
366
- description: "On-chain deadline unix seconds; default ~30 min from now"
367
- },
368
- useServerProxy: {
369
- type: "boolean",
370
- required: false,
371
- description: "Set false in Node/agents; true only in browser via Next API route"
372
- }
373
- }),
374
- required: requiredKeys({
375
- uniswapApiKey: { type: "string", required: true, description: "" },
376
- fullQuoteFromPermit: { type: "object", required: true, description: "" }
377
- })
378
- },
379
- outputSchema: {
380
- type: "object",
381
- description: "{ swap: TransactionRequest, requestId?, gasFee? }"
382
- }
383
- },
384
- {
872
+ inputZod: mcpUniswapV4CreateSwapInputSchema,
873
+ outputZod: mcpUniswapV4CreateSwapOutputSchema
874
+ }),
875
+ defineMcpTool({
385
876
  name: "ctm_uniswap_v4_build_swap_multisign",
386
877
  actionId: "uniswap-v4.swap-exact-input",
387
878
  protocolId: "uniswap-v4",
@@ -395,33 +886,10 @@ var MCP_TOOL_DEFINITIONS = [
395
886
  ],
396
887
  followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
397
888
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
398
- inputSchema: {
399
- type: "object",
400
- properties: paramProperties(
401
- {
402
- tokenIn: { type: "address", required: true, description: "Token in; 0x0 for native ETH" },
403
- swap: { type: "object", required: true, description: "swap field from create_swap response" },
404
- createSwapResponse: { type: "object", required: true, description: "Full create_swap response" },
405
- fullQuoteSnapshot: { type: "object", required: true, description: "Quote JSON used for the swap" },
406
- swapDeadlineUnix: { type: "number", required: true, description: "Same deadline passed to create_swap" },
407
- slippagePercent: { type: "number", required: false, description: "Extra approve headroom for EXACT_OUTPUT" }
408
- },
409
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
410
- ),
411
- required: requiredKeys(
412
- {
413
- tokenIn: { type: "address", required: true, description: "" },
414
- swap: { type: "object", required: true, description: "" },
415
- createSwapResponse: { type: "object", required: true, description: "" },
416
- fullQuoteSnapshot: { type: "object", required: true, description: "" },
417
- swapDeadlineUnix: { type: "number", required: true, description: "" }
418
- },
419
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
420
- )
421
- },
422
- outputSchema: multisignOutputSchema
423
- },
424
- {
889
+ inputZod: mcpUniswapV4BuildSwapMultisignInputSchema,
890
+ outputZod: multisignOutputSchema
891
+ }),
892
+ defineMcpTool({
425
893
  name: "ctm_curve_dao_build_swap_multisign",
426
894
  actionId: "curve-dao.swap",
427
895
  protocolId: "curve-dao",
@@ -430,36 +898,45 @@ var MCP_TOOL_DEFINITIONS = [
430
898
  prerequisites: ["keyGen", "executorAddress", "tokenIn/tokenOut/amountHuman/slippage", "RPC URL"],
431
899
  followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
432
900
  handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
433
- inputSchema: {
434
- type: "object",
435
- properties: paramProperties(
436
- {
437
- tokenIn: { type: "address", required: true, description: "ERC-20 sold (native in uses WETH path in UI)" },
438
- tokenOut: { type: "string", required: true, description: "Output token or 0xeeee\u2026 native placeholder" },
439
- amountHuman: { type: "string", required: true, description: "Human-readable amount of tokenIn" },
440
- slippagePercent: { type: "number", required: true, description: "Slippage 0\u2013100 exclusive" }
441
- },
442
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
443
- ),
444
- required: requiredKeys(
445
- {
446
- tokenIn: { type: "address", required: true, description: "" },
447
- tokenOut: { type: "string", required: true, description: "" },
448
- amountHuman: { type: "string", required: true, description: "" },
449
- slippagePercent: { type: "number", required: true, description: "" }
450
- },
451
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
452
- )
453
- },
454
- outputSchema: multisignOutputSchema
455
- }
901
+ inputZod: mcpCurveDaoBuildSwapMultisignInputSchema,
902
+ outputZod: multisignOutputSchema
903
+ })
904
+ ];
905
+ var MCP_TOOL_DEFINITIONS = [
906
+ ...CORE_MCP_TOOL_DEFINITIONS,
907
+ ...MCP_PROTOCOL_TOOL_DEFINITIONS
456
908
  ];
909
+ function buildToolSchemaMap(kind) {
910
+ const out = {};
911
+ for (const tool of MCP_TOOL_DEFINITIONS) {
912
+ out[tool.name] = kind === "input" ? tool.inputZod : tool.outputZod;
913
+ }
914
+ return out;
915
+ }
916
+ var MCP_TOOL_INPUT_SCHEMAS = buildToolSchemaMap("input");
917
+ var MCP_TOOL_OUTPUT_SCHEMAS = buildToolSchemaMap("output");
457
918
  function getMcpToolDefinitions() {
458
919
  return MCP_TOOL_DEFINITIONS;
459
920
  }
460
921
  function getMcpToolByName(name) {
461
922
  return MCP_TOOL_DEFINITIONS.find((t) => t.name === name);
462
923
  }
924
+ function getMcpToolInputSchema(name) {
925
+ const schema = MCP_TOOL_INPUT_SCHEMAS[name];
926
+ if (!schema) throw new Error(`Unknown MCP tool: ${name}`);
927
+ return schema;
928
+ }
929
+ function getMcpToolOutputSchema(name) {
930
+ const schema = MCP_TOOL_OUTPUT_SCHEMAS[name];
931
+ if (!schema) throw new Error(`Unknown MCP tool: ${name}`);
932
+ return schema;
933
+ }
934
+ function parseMcpToolInput(name, data) {
935
+ return getMcpToolInputSchema(name).parse(data);
936
+ }
937
+ function parseMcpToolOutput(name, data) {
938
+ return getMcpToolOutputSchema(name).parse(data);
939
+ }
463
940
  function getAgentCatalogForMcp() {
464
941
  return {
465
942
  tools: MCP_TOOL_DEFINITIONS,
@@ -467,6 +944,9 @@ function getAgentCatalogForMcp() {
467
944
  commonParams: EVM_COMMON_PARAM_DOCS,
468
945
  multisignOutput: MULTISIGN_OUTPUT_DOC,
469
946
  managementSig: MANAGEMENT_SIG_DOC,
947
+ /** Zod schemas for MCP tool I/O — source of truth for continuum-mcp-server validation. */
948
+ inputSchemas: MCP_TOOL_INPUT_SCHEMAS,
949
+ outputSchemas: MCP_TOOL_OUTPUT_SCHEMAS,
470
950
  workflow: {
471
951
  evmSwapTypical: [
472
952
  "1. Quote (protocol-specific API if needed)",
@@ -485,10 +965,211 @@ function getAgentCatalogForMcp() {
485
965
  }
486
966
  };
487
967
  }
968
+ viem.getAddress(
969
+ "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
970
+ );
971
+ viem.getAddress(
972
+ "0x7f39C581F595B853cBbF37C12FfeeA971C5a5bEa"
973
+ );
974
+ viem.getAddress("0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1");
975
+ var LIDO_ETHEREUM_MAINNET_CHAIN_ID = 1;
976
+
977
+ // src/protocols/evm/lido/index.ts
978
+ var LIDO_PROTOCOL_ID = "lido";
979
+ var lidoProtocolModule = {
980
+ id: LIDO_PROTOCOL_ID,
981
+ chainCategory: "evm",
982
+ isChainSupported(ctx) {
983
+ if (ctx.chainCategory !== "evm") return false;
984
+ return Number(ctx.chainId) === LIDO_ETHEREUM_MAINNET_CHAIN_ID;
985
+ },
986
+ isTokenSupported(token) {
987
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
988
+ },
989
+ actions: [
990
+ { id: "lido.submit", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Stake ETH via Lido submit()", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { valueWei: { type: "string", required: true, description: "ETH to stake (wei string)" } } },
991
+ { id: "lido.request-withdrawals", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Queue stETH withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
992
+ { id: "lido.claim-withdrawal", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Claim finalized withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
993
+ { id: "lido.wrap-steth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Wrap stETH to wstETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
994
+ { id: "lido.unwrap-wsteth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Unwrap wstETH to stETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
995
+ ]
996
+ };
997
+ registerProtocolModule(lidoProtocolModule);
998
+ var USDE_ETHEREUM_MAINNET = "0x4c9edd5852cd905f086c759e8383e09bff1e68b3";
999
+ var USDE_MOST_L2S = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
1000
+ var USDE_ZKSYNC_ERA = "0x39Fe7a0DACcE31Bd90418e3e659fb0b5f0B3Db0d";
1001
+ var L2_SAME_ADDRESS_CHAIN_IDS = /* @__PURE__ */ new Set([
1002
+ 42161,
1003
+ // Arbitrum One
1004
+ 10,
1005
+ // Optimism
1006
+ 8453,
1007
+ // Base
1008
+ 56,
1009
+ // BNB Chain
1010
+ 59144,
1011
+ // Linea
1012
+ 5e3,
1013
+ // Mantle
1014
+ 81457,
1015
+ // Blast
1016
+ 169,
1017
+ // Manta Pacific
1018
+ 534352,
1019
+ // Scroll
1020
+ 252,
1021
+ // Fraxtal
1022
+ 34443,
1023
+ // Mode
1024
+ 196,
1025
+ // X Layer
1026
+ 1088,
1027
+ // Metis
1028
+ 80084,
1029
+ // Berachain
1030
+ 2222,
1031
+ // Kava
1032
+ 2818,
1033
+ // Morph
1034
+ 1923,
1035
+ // Swell
1036
+ 48900
1037
+ // Zircuit
1038
+ ]);
1039
+ function usdeTokenAddressOnEvmChain(chainId) {
1040
+ if (chainId === 1) return USDE_ETHEREUM_MAINNET;
1041
+ if (chainId === 324) return USDE_ZKSYNC_ERA;
1042
+ if (L2_SAME_ADDRESS_CHAIN_IDS.has(chainId)) return USDE_MOST_L2S;
1043
+ return null;
1044
+ }
1045
+ function isEvmChainInEthenaUsdeList(chainId) {
1046
+ return usdeTokenAddressOnEvmChain(chainId) != null;
1047
+ }
1048
+
1049
+ // src/protocols/evm/ethena/index.ts
1050
+ var ETHENA_PROTOCOL_ID = "ethena";
1051
+ var ethenaProtocolModule = {
1052
+ id: ETHENA_PROTOCOL_ID,
1053
+ chainCategory: "evm",
1054
+ isChainSupported(ctx) {
1055
+ if (ctx.chainCategory !== "evm") return false;
1056
+ const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
1057
+ return isEvmChainInEthenaUsdeList(n);
1058
+ },
1059
+ isTokenSupported(token) {
1060
+ return token.category === "evm" && token.kind === "erc20";
1061
+ },
1062
+ actions: [
1063
+ { id: "ethena.stake-usde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Stake USDe \u2192 sUSDe", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { amountHuman: { type: "string", required: true, description: "USDe amount" } } },
1064
+ { id: "ethena.redeem-susde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDe \u2192 USDe (no cooldown)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1065
+ { id: "ethena.cooldown-shares", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Start sUSDe cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1066
+ { id: "ethena.claim-unstake", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Claim after cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
1067
+ ]
1068
+ };
1069
+ registerProtocolModule(ethenaProtocolModule);
1070
+
1071
+ // src/protocols/evm/maple/constants.ts
1072
+ function isMapleSyrupSupportedChain(chainId) {
1073
+ return chainId === 1 || chainId === 11155111;
1074
+ }
1075
+
1076
+ // src/protocols/evm/maple/index.ts
1077
+ var MAPLE_PROTOCOL_ID = "maple-syrup";
1078
+ var mapleProtocolModule = {
1079
+ id: MAPLE_PROTOCOL_ID,
1080
+ chainCategory: "evm",
1081
+ isChainSupported(ctx) {
1082
+ if (ctx.chainCategory !== "evm") return false;
1083
+ const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
1084
+ return isMapleSyrupSupportedChain(n);
1085
+ },
1086
+ isTokenSupported(token) {
1087
+ return token.category === "evm" && token.kind === "erc20";
1088
+ },
1089
+ actions: [
1090
+ { id: "maple-syrup.deposit", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Maple Syrup pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1091
+ { id: "maple-syrup.request-redeem", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Request redeem from pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
1092
+ ]
1093
+ };
1094
+ registerProtocolModule(mapleProtocolModule);
1095
+
1096
+ // src/protocols/evm/sky/mainnet.ts
1097
+ var SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
1098
+
1099
+ // src/protocols/evm/sky/index.ts
1100
+ var SKY_PROTOCOL_ID = "sky";
1101
+ var skyProtocolModule = {
1102
+ id: SKY_PROTOCOL_ID,
1103
+ chainCategory: "evm",
1104
+ isChainSupported(ctx) {
1105
+ if (ctx.chainCategory !== "evm") return false;
1106
+ return Number(ctx.chainId) === SKY_ETHEREUM_MAINNET_CHAIN_ID;
1107
+ },
1108
+ isTokenSupported(token) {
1109
+ return token.category === "evm" && token.kind === "erc20";
1110
+ },
1111
+ actions: [
1112
+ { id: "sky.lockstake-stake", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Open Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1113
+ { id: "sky.lockstake-draw", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Borrow USDS from Lockstake", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1114
+ { id: "sky.lockstake-wipe", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Repay Lockstake debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1115
+ { id: "sky.lockstake-close", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Close Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1116
+ { id: "sky.susds-deposit", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Deposit USDS into sUSDS vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1117
+ { id: "sky.susds-redeem", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDS to USDS", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
1118
+ ]
1119
+ };
1120
+ registerProtocolModule(skyProtocolModule);
1121
+
1122
+ // src/protocols/evm/aave-v4/index.ts
1123
+ var AAVE_V4_PROTOCOL_ID = "aave-v4";
1124
+ var aaveV4ProtocolModule = {
1125
+ id: AAVE_V4_PROTOCOL_ID,
1126
+ chainCategory: "evm",
1127
+ isChainSupported(ctx) {
1128
+ return ctx.chainCategory === "evm";
1129
+ },
1130
+ isTokenSupported(token) {
1131
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
1132
+ },
1133
+ actions: [
1134
+ { id: "aave-v4.deposit", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Supply to Aave v4 Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1135
+ { id: "aave-v4.withdraw", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1136
+ { id: "aave-v4.borrow", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1137
+ { id: "aave-v4.repay", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Repay Spoke debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
1138
+ ]
1139
+ };
1140
+ registerProtocolModule(aaveV4ProtocolModule);
1141
+
1142
+ // src/protocols/evm/euler-v2/index.ts
1143
+ var EULER_V2_PROTOCOL_ID = "euler-v2";
1144
+ var eulerV2ProtocolModule = {
1145
+ id: EULER_V2_PROTOCOL_ID,
1146
+ chainCategory: "evm",
1147
+ isChainSupported(ctx) {
1148
+ return ctx.chainCategory === "evm";
1149
+ },
1150
+ isTokenSupported(token) {
1151
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
1152
+ },
1153
+ actions: [
1154
+ { id: "euler-v2.isolated-lend", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1155
+ { id: "euler-v2.isolated-borrow", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1156
+ { id: "euler-v2.vault-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1157
+ { id: "euler-v2.borrow-repay", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Repay Euler borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1158
+ { id: "euler-v2.collateral-deposit", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
1159
+ { id: "euler-v2.collateral-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
1160
+ ]
1161
+ };
1162
+ registerProtocolModule(eulerV2ProtocolModule);
488
1163
 
489
1164
  // src/agent/catalog.ts
490
1165
  registerProtocolModule(uniswapV4ProtocolModule);
491
1166
  registerProtocolModule(curveDaoProtocolModule);
1167
+ registerProtocolModule(lidoProtocolModule);
1168
+ registerProtocolModule(ethenaProtocolModule);
1169
+ registerProtocolModule(mapleProtocolModule);
1170
+ registerProtocolModule(skyProtocolModule);
1171
+ registerProtocolModule(aaveV4ProtocolModule);
1172
+ registerProtocolModule(eulerV2ProtocolModule);
492
1173
  function getAgentCatalog() {
493
1174
  return {
494
1175
  protocols: getProtocolModules(),
@@ -499,6 +1180,12 @@ function getAgentCatalog() {
499
1180
  },
500
1181
  uniswapV4: uniswapV4ProtocolModule,
501
1182
  curveDao: curveDaoProtocolModule,
1183
+ lido: lidoProtocolModule,
1184
+ ethena: ethenaProtocolModule,
1185
+ maple: mapleProtocolModule,
1186
+ sky: skyProtocolModule,
1187
+ aaveV4: aaveV4ProtocolModule,
1188
+ eulerV2: eulerV2ProtocolModule,
502
1189
  /** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
503
1190
  mcp: getAgentCatalogForMcp()
504
1191
  };
@@ -507,12 +1194,62 @@ function getAgentCatalog() {
507
1194
  exports.EVM_COMMON_PARAM_DOCS = EVM_COMMON_PARAM_DOCS;
508
1195
  exports.MANAGEMENT_SIG_DOC = MANAGEMENT_SIG_DOC;
509
1196
  exports.MCP_TOOL_DEFINITIONS = MCP_TOOL_DEFINITIONS;
1197
+ exports.MCP_TOOL_INPUT_SCHEMAS = MCP_TOOL_INPUT_SCHEMAS;
1198
+ exports.MCP_TOOL_OUTPUT_SCHEMAS = MCP_TOOL_OUTPUT_SCHEMAS;
510
1199
  exports.MULTISIGN_OUTPUT_DOC = MULTISIGN_OUTPUT_DOC;
1200
+ exports.chainDetailSchema = chainDetailSchema;
1201
+ exports.evmAddressSchema = evmAddressSchema;
1202
+ exports.evmMultisignCommonInputSchema = evmMultisignCommonInputSchema;
511
1203
  exports.getActionsByChainCategory = getActionsByChainCategory;
512
1204
  exports.getAgentCatalog = getAgentCatalog;
513
1205
  exports.getAgentCatalogForMcp = getAgentCatalogForMcp;
514
1206
  exports.getMcpToolByName = getMcpToolByName;
515
1207
  exports.getMcpToolDefinitions = getMcpToolDefinitions;
1208
+ exports.getMcpToolInputSchema = getMcpToolInputSchema;
1209
+ exports.getMcpToolOutputSchema = getMcpToolOutputSchema;
516
1210
  exports.getProtocolModules = getProtocolModules;
1211
+ exports.jsonObjectSchema = jsonObjectSchema;
1212
+ exports.keyGenSchema = keyGenSchema;
1213
+ exports.mcpAaveV4BorrowInputSchema = mcpAaveV4BorrowInputSchema;
1214
+ exports.mcpAaveV4DepositInputSchema = mcpAaveV4DepositInputSchema;
1215
+ exports.mcpAaveV4RepayInputSchema = mcpAaveV4RepayInputSchema;
1216
+ exports.mcpAaveV4WithdrawInputSchema = mcpAaveV4WithdrawInputSchema;
1217
+ exports.mcpCurveDaoBuildSwapMultisignInputSchema = mcpCurveDaoBuildSwapMultisignInputSchema;
1218
+ exports.mcpEthenaClaimInputSchema = mcpEthenaClaimInputSchema;
1219
+ exports.mcpEthenaCooldownInputSchema = mcpEthenaCooldownInputSchema;
1220
+ exports.mcpEthenaRedeemInputSchema = mcpEthenaRedeemInputSchema;
1221
+ exports.mcpEthenaStakeInputSchema = mcpEthenaStakeInputSchema;
1222
+ exports.mcpEulerV2BorrowRepayInputSchema = mcpEulerV2BorrowRepayInputSchema;
1223
+ exports.mcpEulerV2CollateralDepositInputSchema = mcpEulerV2CollateralDepositInputSchema;
1224
+ exports.mcpEulerV2CollateralWithdrawInputSchema = mcpEulerV2CollateralWithdrawInputSchema;
1225
+ exports.mcpEulerV2IsolatedBorrowInputSchema = mcpEulerV2IsolatedBorrowInputSchema;
1226
+ exports.mcpEulerV2IsolatedLendInputSchema = mcpEulerV2IsolatedLendInputSchema;
1227
+ exports.mcpEulerV2VaultWithdrawInputSchema = mcpEulerV2VaultWithdrawInputSchema;
1228
+ exports.mcpLidoClaimWithdrawalInputSchema = mcpLidoClaimWithdrawalInputSchema;
1229
+ exports.mcpLidoRequestWithdrawalsInputSchema = mcpLidoRequestWithdrawalsInputSchema;
1230
+ exports.mcpLidoSubmitInputSchema = mcpLidoSubmitInputSchema;
1231
+ exports.mcpLidoUnwrapWstEthInputSchema = mcpLidoUnwrapWstEthInputSchema;
1232
+ exports.mcpLidoWrapStEthInputSchema = mcpLidoWrapStEthInputSchema;
1233
+ exports.mcpMapleDepositInputSchema = mcpMapleDepositInputSchema;
1234
+ exports.mcpMapleRequestRedeemInputSchema = mcpMapleRequestRedeemInputSchema;
1235
+ exports.mcpMultisignInput = mcpMultisignInput;
1236
+ exports.mcpMultisignOutputSchema = multisignOutputSchema;
1237
+ exports.mcpSkyLockstakeCloseInputSchema = mcpSkyLockstakeCloseInputSchema;
1238
+ exports.mcpSkyLockstakeDrawInputSchema = mcpSkyLockstakeDrawInputSchema;
1239
+ exports.mcpSkyLockstakeGetRewardInputSchema = mcpSkyLockstakeGetRewardInputSchema;
1240
+ exports.mcpSkyLockstakeStakeInputSchema = mcpSkyLockstakeStakeInputSchema;
1241
+ exports.mcpSkyLockstakeWipeInputSchema = mcpSkyLockstakeWipeInputSchema;
1242
+ exports.mcpSkySusdsDepositInputSchema = mcpSkySusdsDepositInputSchema;
1243
+ exports.mcpSkySusdsRedeemInputSchema = mcpSkySusdsRedeemInputSchema;
1244
+ exports.mcpUniswapV4BuildSwapMultisignInputSchema = mcpUniswapV4BuildSwapMultisignInputSchema;
1245
+ exports.mcpUniswapV4CreateSwapInputSchema = mcpUniswapV4CreateSwapInputSchema;
1246
+ exports.mcpUniswapV4CreateSwapOutputSchema = mcpUniswapV4CreateSwapOutputSchema;
1247
+ exports.mcpUniswapV4QuoteInputSchema = mcpUniswapV4QuoteInputSchema;
1248
+ exports.mcpUniswapV4QuoteOutputSchema = mcpUniswapV4QuoteOutputSchema;
1249
+ exports.multisignOutputSchema = multisignOutputSchema;
1250
+ exports.parseMcpToolInput = parseMcpToolInput;
1251
+ exports.parseMcpToolOutput = parseMcpToolOutput;
1252
+ exports.uniswapQuoteTradeTypeSchema = uniswapQuoteTradeTypeSchema;
1253
+ exports.zodSchemaToMcpJsonSchema = zodSchemaToMcpJsonSchema;
517
1254
  //# sourceMappingURL=catalog.cjs.map
518
1255
  //# sourceMappingURL=catalog.cjs.map