@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
package/dist/index.cjs CHANGED
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var viem = require('viem');
4
+ var zodToJsonSchema = require('zod-to-json-schema');
5
+ var zod = require('zod');
4
6
 
5
7
  // src/core/keygen.ts
6
8
  function firstClientIdFromKeyGen(data) {
@@ -565,6 +567,18 @@ function parseEvmChainIdToNumber(chainId) {
565
567
  return Number.parseInt(t, 10);
566
568
  }
567
569
 
570
+ // src/chains/evm/rpcUrl.ts
571
+ function isValidRpcUrl(url) {
572
+ const t = url.trim();
573
+ if (!t) return false;
574
+ try {
575
+ const u = new URL(t);
576
+ return u.protocol === "http:" || u.protocol === "https:";
577
+ } catch {
578
+ return false;
579
+ }
580
+ }
581
+
568
582
  // src/chains/solana/types.ts
569
583
  var solanaChainCategoryModule = {
570
584
  category: "solana"
@@ -2315,46 +2329,581 @@ var MANAGEMENT_SIG_DOC = {
2315
2329
  fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key."
2316
2330
  }
2317
2331
  };
2318
-
2319
- // src/agent/mcpTools.ts
2320
- function paramProperties(params, includeCommon = []) {
2321
- const out = {};
2322
- for (const k of includeCommon) {
2323
- const d = EVM_COMMON_PARAM_DOCS[k];
2324
- if (d) out[k] = { type: d.type, description: d.description };
2325
- }
2326
- for (const [k, d] of Object.entries(params)) {
2327
- out[k] = { type: d.type, description: d.description };
2332
+ function zodSchemaToMcpJsonSchema(schema) {
2333
+ const raw = zodToJsonSchema.zodToJsonSchema(schema, {
2334
+ target: "openApi3",
2335
+ $refStrategy: "none"
2336
+ });
2337
+ if (raw.type === "object" || raw.type === "array" || raw.type === "string") {
2338
+ const { $schema: _s, ...rest } = raw;
2339
+ return rest;
2340
+ }
2341
+ const defs = raw.definitions;
2342
+ if (defs) {
2343
+ const first = Object.values(defs)[0];
2344
+ if (first?.type) {
2345
+ const { $schema: _s, ...rest } = first;
2346
+ return rest;
2347
+ }
2328
2348
  }
2329
- return out;
2349
+ return raw;
2350
+ }
2351
+ var evmAddressSchema = zod.z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
2352
+ var keyGenSchema = zod.z.object({
2353
+ pubkeyhex: zod.z.string().min(1).describe("MPC secp256k1 public key hex (required for multiSignRequest pubKey)"),
2354
+ keylist: zod.z.array(zod.z.string()).optional().describe("Key list on the sign request"),
2355
+ ClientKeys: zod.z.record(zod.z.string()).optional().describe("Optional client key map from keyGen")
2356
+ }).describe(
2357
+ "MPC key slice: { pubkeyhex, keylist?, ClientKeys? }. Used for pubKey/keyList on POST /multiSignRequest."
2358
+ );
2359
+ var chainDetailSchema = zod.z.object({
2360
+ legacy: zod.z.boolean().optional(),
2361
+ gasLimit: zod.z.number().optional(),
2362
+ gasMultiplier: zod.z.number().optional(),
2363
+ gasPrice: zod.z.number().optional(),
2364
+ baseFee: zod.z.number().optional(),
2365
+ priorityFee: zod.z.number().optional(),
2366
+ baseFeeMultiplier: zod.z.number().optional()
2367
+ }).passthrough().describe(
2368
+ "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
2369
+ );
2370
+ var evmMultisignCommonInputSchema = zod.z.object({
2371
+ keyGen: keyGenSchema,
2372
+ purposeText: zod.z.string().min(1).describe(
2373
+ "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
2374
+ ),
2375
+ useCustomGas: zod.z.boolean().describe(
2376
+ "When true, apply chain gas settings from chainDetail / customGasChainDetails instead of raw RPC estimates only."
2377
+ ),
2378
+ chainId: zod.z.number().int().positive().describe("EVM chain id (decimal). Becomes destinationChainID on the sign request."),
2379
+ rpcUrl: zod.z.string().min(1).describe("HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."),
2380
+ executorAddress: evmAddressSchema.describe(
2381
+ "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
2382
+ ),
2383
+ chainDetail: chainDetailSchema,
2384
+ customGasChainDetails: zod.z.record(zod.z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
2385
+ });
2386
+ var multisignOutputSchema = zod.z.object({
2387
+ bodyForSign: zod.z.record(zod.z.unknown()).describe(
2388
+ "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
2389
+ ),
2390
+ messageToSign: zod.z.string().describe("JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig.")
2391
+ }).describe(
2392
+ "Unsigned mpc-auth multiSignRequest payload. Sign messageToSign and POST { ...bodyForSign, clientSig, signedMessage } to /multiSignRequest."
2393
+ );
2394
+ var jsonObjectSchema = zod.z.record(zod.z.unknown());
2395
+ var uniswapQuoteTradeTypeSchema = zod.z.enum(["EXACT_INPUT", "EXACT_OUTPUT"]);
2396
+ var mcpUniswapV4QuoteInputSchema = zod.z.object({
2397
+ type: uniswapQuoteTradeTypeSchema.describe("EXACT_INPUT or EXACT_OUTPUT"),
2398
+ amount: zod.z.string().min(1).describe("Amount in token-in base units (wei string for ERC-20)"),
2399
+ tokenIn: zod.z.string().min(1).describe("Input token; 0x0 for native ETH"),
2400
+ tokenOut: zod.z.string().min(1).describe("Output token address"),
2401
+ chainId: zod.z.union([zod.z.number().int().positive(), zod.z.string().min(1)]).describe("tokenInChainId / same-chain default"),
2402
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API x-api-key"),
2403
+ swapper: evmAddressSchema.optional().describe("MPC executor; omit if keyGen + managementNodeUrl provided"),
2404
+ slippage: zod.z.union([zod.z.number(), zod.z.string()]).optional().describe("Slippage percent; omit for API auto slippage"),
2405
+ keyGen: zod.z.string().optional().describe("KeyGen id \u2014 resolves swapper via GET /getKeyGenResultById when swapper omitted"),
2406
+ managementNodeUrl: zod.z.string().min(1).optional().describe("MPC node base URL; required with keyGen when swapper is omitted"),
2407
+ tokenInChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
2408
+ tokenOutChainId: zod.z.union([zod.z.number(), zod.z.string()]).optional(),
2409
+ permit2Disabled: zod.z.boolean().optional(),
2410
+ baseUrl: zod.z.string().optional(),
2411
+ universalRouterVersion: zod.z.string().optional()
2412
+ });
2413
+ var mcpUniswapV4QuoteOutputSchema = jsonObjectSchema.describe(
2414
+ "Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
2415
+ );
2416
+ var mcpUniswapV4CreateSwapInputSchema = zod.z.object({
2417
+ uniswapApiKey: zod.z.string().min(1).describe("Uniswap Trade API key"),
2418
+ fullQuoteFromPermit: jsonObjectSchema.describe("Full quote JSON from ctm_uniswap_v4_quote"),
2419
+ swapTransactionDeadlineUnix: zod.z.number().int().positive().optional().describe("On-chain deadline unix seconds; default ~30 min from now"),
2420
+ useServerProxy: zod.z.boolean().optional().describe("Set false in Node/agents; true only in browser via Next API route"),
2421
+ baseUrl: zod.z.string().optional(),
2422
+ universalRouterVersion: zod.z.string().optional()
2423
+ });
2424
+ var mcpUniswapV4CreateSwapOutputSchema = zod.z.object({
2425
+ swap: jsonObjectSchema.describe("Universal Router tx: { to, data, value, gasLimit? }"),
2426
+ requestId: zod.z.string().optional(),
2427
+ gasFee: zod.z.string().optional()
2428
+ }).passthrough().describe("{ swap: TransactionRequest, requestId?, gasFee? }");
2429
+ var swapTxRequestSchema = jsonObjectSchema.describe("swap field from create_swap response (to, data, value)");
2430
+ var mcpUniswapV4BuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
2431
+ tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
2432
+ swap: swapTxRequestSchema,
2433
+ createSwapResponse: zod.z.object({
2434
+ swap: swapTxRequestSchema,
2435
+ requestId: zod.z.string().optional(),
2436
+ gasFee: zod.z.string().optional()
2437
+ }).passthrough().describe("Full create_swap response"),
2438
+ fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
2439
+ swapDeadlineUnix: zod.z.number().describe("Same deadline passed to create_swap"),
2440
+ slippagePercent: zod.z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
2441
+ });
2442
+ var mcpCurveDaoBuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
2443
+ tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
2444
+ tokenOut: zod.z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
2445
+ amountHuman: zod.z.string().min(1).describe("Human-readable amount of tokenIn"),
2446
+ slippagePercent: zod.z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
2447
+ });
2448
+ function mcpMultisignInput(fields) {
2449
+ return evmMultisignCommonInputSchema.extend(fields);
2450
+ }
2451
+ var mcpLidoSubmitInputSchema = mcpMultisignInput({
2452
+ valueWei: zod.z.string().min(1).describe("ETH to stake (wei decimal string)"),
2453
+ referral: evmAddressSchema.optional()
2454
+ });
2455
+ var mcpLidoRequestWithdrawalsInputSchema = mcpMultisignInput({
2456
+ stEthAmountsWei: zod.z.array(zod.z.string()).min(1).describe("stETH amounts per withdrawal request (wei strings)")
2457
+ });
2458
+ var mcpLidoClaimWithdrawalInputSchema = mcpMultisignInput({
2459
+ requestId: zod.z.union([zod.z.string(), zod.z.number()]).describe("Withdrawal queue request id")
2460
+ });
2461
+ var mcpLidoWrapStEthInputSchema = mcpMultisignInput({
2462
+ stEthAmountWei: zod.z.string().min(1)
2463
+ });
2464
+ var mcpLidoUnwrapWstEthInputSchema = mcpMultisignInput({
2465
+ wstEthAmountWei: zod.z.string().min(1)
2466
+ });
2467
+ var mcpEthenaStakeInputSchema = mcpMultisignInput({
2468
+ usdeAmountHuman: zod.z.string().min(1),
2469
+ susdeVault: evmAddressSchema.optional()
2470
+ });
2471
+ var mcpEthenaRedeemInputSchema = mcpMultisignInput({
2472
+ susdeSharesHuman: zod.z.string().min(1),
2473
+ susdeVault: evmAddressSchema.optional()
2474
+ });
2475
+ var mcpEthenaCooldownInputSchema = mcpMultisignInput({
2476
+ susdeSharesHuman: zod.z.string().min(1),
2477
+ susdeVault: evmAddressSchema.optional()
2478
+ });
2479
+ var mcpEthenaClaimInputSchema = mcpMultisignInput({
2480
+ susdeVault: evmAddressSchema.optional()
2481
+ });
2482
+ var mcpMapleDepositInputSchema = mcpMultisignInput({
2483
+ syrupRouter: evmAddressSchema,
2484
+ pool: evmAddressSchema,
2485
+ asset: evmAddressSchema,
2486
+ amountHuman: zod.z.string().min(1),
2487
+ authorizeSig: jsonObjectSchema.optional()
2488
+ });
2489
+ var mcpMapleRequestRedeemInputSchema = mcpMultisignInput({
2490
+ pool: evmAddressSchema,
2491
+ sharesHuman: zod.z.string().min(1),
2492
+ receiver: evmAddressSchema
2493
+ });
2494
+ var mcpSkyLockstakeStakeInputSchema = mcpMultisignInput({
2495
+ skyAmountHuman: zod.z.string().min(1),
2496
+ usdsDrawHuman: zod.z.string().optional(),
2497
+ farmRef: zod.z.string().optional()
2498
+ });
2499
+ var mcpSkyLockstakeDrawInputSchema = mcpMultisignInput({
2500
+ usdsAmountHuman: zod.z.string().min(1),
2501
+ urnIndex: zod.z.number().int().nonnegative()
2502
+ });
2503
+ var mcpSkyLockstakeWipeInputSchema = mcpMultisignInput({
2504
+ usdsAmountHuman: zod.z.string().min(1),
2505
+ urnIndex: zod.z.number().int().nonnegative()
2506
+ });
2507
+ var mcpSkyLockstakeCloseInputSchema = mcpMultisignInput({
2508
+ urnIndex: zod.z.number().int().nonnegative()
2509
+ });
2510
+ var mcpSkyLockstakeGetRewardInputSchema = mcpMultisignInput({
2511
+ urnIndex: zod.z.number().int().nonnegative()
2512
+ });
2513
+ var mcpSkySusdsDepositInputSchema = mcpMultisignInput({
2514
+ usdsAmountHuman: zod.z.string().min(1)
2515
+ });
2516
+ var mcpSkySusdsRedeemInputSchema = mcpMultisignInput({
2517
+ sharesHuman: zod.z.string().min(1)
2518
+ });
2519
+ var mcpAaveV4DepositInputSchema = mcpMultisignInput({
2520
+ spoke: evmAddressSchema,
2521
+ underlying: evmAddressSchema,
2522
+ amountHuman: zod.z.string().min(1),
2523
+ marketId: zod.z.string().min(1)
2524
+ });
2525
+ var mcpAaveV4WithdrawInputSchema = mcpMultisignInput({
2526
+ spoke: evmAddressSchema,
2527
+ underlying: evmAddressSchema,
2528
+ amountHuman: zod.z.string().min(1),
2529
+ marketId: zod.z.string().min(1)
2530
+ });
2531
+ var mcpAaveV4BorrowInputSchema = mcpMultisignInput({
2532
+ spoke: evmAddressSchema,
2533
+ underlying: evmAddressSchema,
2534
+ amountHuman: zod.z.string().min(1),
2535
+ marketId: zod.z.string().min(1)
2536
+ });
2537
+ var mcpAaveV4RepayInputSchema = mcpMultisignInput({
2538
+ spoke: evmAddressSchema,
2539
+ underlying: evmAddressSchema,
2540
+ amountHuman: zod.z.string().min(1),
2541
+ marketId: zod.z.string().min(1)
2542
+ });
2543
+ var mcpEulerV2IsolatedLendInputSchema = mcpMultisignInput({
2544
+ vault: evmAddressSchema,
2545
+ assetAmountHuman: zod.z.string().min(1)
2546
+ });
2547
+ var mcpEulerV2IsolatedBorrowInputSchema = mcpMultisignInput({
2548
+ vault: evmAddressSchema,
2549
+ collateralAsset: evmAddressSchema,
2550
+ borrowAsset: evmAddressSchema,
2551
+ collateralAmountHuman: zod.z.string().min(1),
2552
+ loopBorrowWeis: zod.z.array(zod.z.string()).min(1)
2553
+ });
2554
+ var mcpEulerV2VaultWithdrawInputSchema = mcpMultisignInput({
2555
+ vault: evmAddressSchema,
2556
+ sharesHuman: zod.z.string().min(1)
2557
+ });
2558
+ var mcpEulerV2BorrowRepayInputSchema = mcpMultisignInput({
2559
+ vault: evmAddressSchema,
2560
+ amountHuman: zod.z.string().min(1)
2561
+ });
2562
+ var mcpEulerV2CollateralDepositInputSchema = mcpMultisignInput({
2563
+ vault: evmAddressSchema,
2564
+ collateralAsset: evmAddressSchema,
2565
+ amountHuman: zod.z.string().min(1)
2566
+ });
2567
+ var mcpEulerV2CollateralWithdrawInputSchema = mcpMultisignInput({
2568
+ vault: evmAddressSchema,
2569
+ collateralAsset: evmAddressSchema,
2570
+ amountHuman: zod.z.string().min(1)
2571
+ });
2572
+
2573
+ // src/agent/mcpProtocolTools.ts
2574
+ function defineProtocolMcpTool(def) {
2575
+ return {
2576
+ ...def,
2577
+ outputZod: multisignOutputSchema,
2578
+ inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
2579
+ outputSchema: zodSchemaToMcpJsonSchema(multisignOutputSchema),
2580
+ parseInput: (data) => def.inputZod.parse(data),
2581
+ parseOutput: (data) => multisignOutputSchema.parse(data)
2582
+ };
2330
2583
  }
2331
- function requiredKeys(params, includeCommon = []) {
2332
- const req = [];
2333
- for (const k of includeCommon) {
2334
- if (EVM_COMMON_PARAM_DOCS[k]?.required) req.push(k);
2335
- }
2336
- for (const [k, d] of Object.entries(params)) {
2337
- if (d.required) req.push(k);
2338
- }
2339
- return req;
2584
+ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
2585
+ defineProtocolMcpTool({
2586
+ name: "ctm_lido_build_submit_multisign",
2587
+ actionId: "lido.submit",
2588
+ protocolId: "lido",
2589
+ chainCategory: "evm",
2590
+ description: "Build mpc-auth multiSignRequest for Lido ETH stake (submit).",
2591
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2592
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2593
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoSubmit" },
2594
+ inputZod: mcpLidoSubmitInputSchema
2595
+ }),
2596
+ defineProtocolMcpTool({
2597
+ name: "ctm_lido_build_request_withdrawals_multisign",
2598
+ actionId: "lido.request-withdrawals",
2599
+ protocolId: "lido",
2600
+ chainCategory: "evm",
2601
+ description: "Build batch for Lido withdrawal queue (approve + requestWithdrawals).",
2602
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2603
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2604
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoRequestWithdrawals" },
2605
+ inputZod: mcpLidoRequestWithdrawalsInputSchema
2606
+ }),
2607
+ defineProtocolMcpTool({
2608
+ name: "ctm_lido_build_claim_withdrawal_multisign",
2609
+ actionId: "lido.claim-withdrawal",
2610
+ protocolId: "lido",
2611
+ chainCategory: "evm",
2612
+ description: "Build tx for Lido claimWithdrawal.",
2613
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2614
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2615
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoClaimWithdrawal" },
2616
+ inputZod: mcpLidoClaimWithdrawalInputSchema
2617
+ }),
2618
+ defineProtocolMcpTool({
2619
+ name: "ctm_lido_build_wrap_steth_multisign",
2620
+ actionId: "lido.wrap-steth",
2621
+ protocolId: "lido",
2622
+ chainCategory: "evm",
2623
+ description: "Build batch for wstETH wrap.",
2624
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2625
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2626
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoWrapStEth" },
2627
+ inputZod: mcpLidoWrapStEthInputSchema
2628
+ }),
2629
+ defineProtocolMcpTool({
2630
+ name: "ctm_lido_build_unwrap_wsteth_multisign",
2631
+ actionId: "lido.unwrap-wsteth",
2632
+ protocolId: "lido",
2633
+ chainCategory: "evm",
2634
+ description: "Build tx for wstETH unwrap.",
2635
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2636
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2637
+ handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoUnwrapWstEth" },
2638
+ inputZod: mcpLidoUnwrapWstEthInputSchema
2639
+ }),
2640
+ defineProtocolMcpTool({
2641
+ name: "ctm_ethena_build_stake_multisign",
2642
+ actionId: "ethena.stake-usde",
2643
+ protocolId: "ethena",
2644
+ chainCategory: "evm",
2645
+ description: "Build batch: USDe approve + sUSDe deposit.",
2646
+ prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
2647
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2648
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUsdeStakeToSusde" },
2649
+ inputZod: mcpEthenaStakeInputSchema
2650
+ }),
2651
+ defineProtocolMcpTool({
2652
+ name: "ctm_ethena_build_redeem_multisign",
2653
+ actionId: "ethena.redeem-susde",
2654
+ protocolId: "ethena",
2655
+ chainCategory: "evm",
2656
+ description: "Build sUSDe redeem when cooldown is off.",
2657
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2658
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2659
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeRedeemToUsde" },
2660
+ inputZod: mcpEthenaRedeemInputSchema
2661
+ }),
2662
+ defineProtocolMcpTool({
2663
+ name: "ctm_ethena_build_cooldown_multisign",
2664
+ actionId: "ethena.cooldown-shares",
2665
+ protocolId: "ethena",
2666
+ chainCategory: "evm",
2667
+ description: "Build sUSDe cooldownShares batch step.",
2668
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2669
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2670
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeCooldownShares" },
2671
+ inputZod: mcpEthenaCooldownInputSchema
2672
+ }),
2673
+ defineProtocolMcpTool({
2674
+ name: "ctm_ethena_build_claim_multisign",
2675
+ actionId: "ethena.claim-unstake",
2676
+ protocolId: "ethena",
2677
+ chainCategory: "evm",
2678
+ description: "Build unstake claim after cooldown.",
2679
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2680
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2681
+ handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUnstakeClaim" },
2682
+ inputZod: mcpEthenaClaimInputSchema
2683
+ }),
2684
+ defineProtocolMcpTool({
2685
+ name: "ctm_maple_build_deposit_multisign",
2686
+ actionId: "maple-syrup.deposit",
2687
+ protocolId: "maple-syrup",
2688
+ chainCategory: "evm",
2689
+ description: "Build Maple Syrup router deposit batch.",
2690
+ prerequisites: ["keyGen", "executorAddress", "router + pool addresses"],
2691
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2692
+ handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMapleSyrupDeposit" },
2693
+ inputZod: mcpMapleDepositInputSchema
2694
+ }),
2695
+ defineProtocolMcpTool({
2696
+ name: "ctm_maple_build_request_redeem_multisign",
2697
+ actionId: "maple-syrup.request-redeem",
2698
+ protocolId: "maple-syrup",
2699
+ chainCategory: "evm",
2700
+ description: "Build Maple PoolV2 requestRedeem batch.",
2701
+ prerequisites: ["keyGen", "executorAddress", "pool address"],
2702
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2703
+ handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMaplePoolRequestRedeem" },
2704
+ inputZod: mcpMapleRequestRedeemInputSchema
2705
+ }),
2706
+ defineProtocolMcpTool({
2707
+ name: "ctm_sky_build_lockstake_stake_multisign",
2708
+ actionId: "sky.lockstake-stake",
2709
+ protocolId: "sky",
2710
+ chainCategory: "evm",
2711
+ description: "Build Sky Lockstake open/stake batch.",
2712
+ prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
2713
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2714
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeStakePositionBatch" },
2715
+ inputZod: mcpSkyLockstakeStakeInputSchema
2716
+ }),
2717
+ defineProtocolMcpTool({
2718
+ name: "ctm_sky_build_lockstake_draw_multisign",
2719
+ actionId: "sky.lockstake-draw",
2720
+ protocolId: "sky",
2721
+ chainCategory: "evm",
2722
+ description: "Build Lockstake draw (borrow USDS).",
2723
+ prerequisites: ["keyGen", "executorAddress", "open urn"],
2724
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2725
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeDrawBatch" },
2726
+ inputZod: mcpSkyLockstakeDrawInputSchema
2727
+ }),
2728
+ defineProtocolMcpTool({
2729
+ name: "ctm_sky_build_lockstake_wipe_multisign",
2730
+ actionId: "sky.lockstake-wipe",
2731
+ protocolId: "sky",
2732
+ chainCategory: "evm",
2733
+ description: "Build Lockstake repay/wipe batch.",
2734
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
2735
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2736
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeWipeBatch" },
2737
+ inputZod: mcpSkyLockstakeWipeInputSchema
2738
+ }),
2739
+ defineProtocolMcpTool({
2740
+ name: "ctm_sky_build_lockstake_close_multisign",
2741
+ actionId: "sky.lockstake-close",
2742
+ protocolId: "sky",
2743
+ chainCategory: "evm",
2744
+ description: "Build Lockstake close position batch.",
2745
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
2746
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2747
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeCloseBatch" },
2748
+ inputZod: mcpSkyLockstakeCloseInputSchema
2749
+ }),
2750
+ defineProtocolMcpTool({
2751
+ name: "ctm_sky_build_lockstake_get_reward_multisign",
2752
+ actionId: "sky.lockstake-get-reward",
2753
+ protocolId: "sky",
2754
+ chainCategory: "evm",
2755
+ description: "Build Lockstake getReward batch.",
2756
+ prerequisites: ["keyGen", "executorAddress", "urn index"],
2757
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2758
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeGetRewardBatch" },
2759
+ inputZod: mcpSkyLockstakeGetRewardInputSchema
2760
+ }),
2761
+ defineProtocolMcpTool({
2762
+ name: "ctm_sky_build_susds_deposit_multisign",
2763
+ actionId: "sky.susds-deposit",
2764
+ protocolId: "sky",
2765
+ chainCategory: "evm",
2766
+ description: "Build USDS \u2192 sUSDS ERC-4626 deposit batch.",
2767
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2768
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2769
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsDepositFromUsdsBatch" },
2770
+ inputZod: mcpSkySusdsDepositInputSchema
2771
+ }),
2772
+ defineProtocolMcpTool({
2773
+ name: "ctm_sky_build_susds_redeem_multisign",
2774
+ actionId: "sky.susds-redeem",
2775
+ protocolId: "sky",
2776
+ chainCategory: "evm",
2777
+ description: "Build sUSDS redeem to USDS batch.",
2778
+ prerequisites: ["keyGen", "executorAddress", "RPC URL"],
2779
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2780
+ handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsRedeemToUsdsBatch" },
2781
+ inputZod: mcpSkySusdsRedeemInputSchema
2782
+ }),
2783
+ defineProtocolMcpTool({
2784
+ name: "ctm_aave_v4_build_deposit_multisign",
2785
+ actionId: "aave-v4.deposit",
2786
+ protocolId: "aave-v4",
2787
+ chainCategory: "evm",
2788
+ description: "Build Aave v4 Spoke supply/deposit batch.",
2789
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
2790
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2791
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4DepositBatch" },
2792
+ inputZod: mcpAaveV4DepositInputSchema
2793
+ }),
2794
+ defineProtocolMcpTool({
2795
+ name: "ctm_aave_v4_build_withdraw_multisign",
2796
+ actionId: "aave-v4.withdraw",
2797
+ protocolId: "aave-v4",
2798
+ chainCategory: "evm",
2799
+ description: "Build Aave v4 Spoke withdraw batch.",
2800
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
2801
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2802
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeWithdraw" },
2803
+ inputZod: mcpAaveV4WithdrawInputSchema
2804
+ }),
2805
+ defineProtocolMcpTool({
2806
+ name: "ctm_aave_v4_build_borrow_multisign",
2807
+ actionId: "aave-v4.borrow",
2808
+ protocolId: "aave-v4",
2809
+ chainCategory: "evm",
2810
+ description: "Build Aave v4 Spoke borrow batch.",
2811
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
2812
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2813
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeBorrow" },
2814
+ inputZod: mcpAaveV4BorrowInputSchema
2815
+ }),
2816
+ defineProtocolMcpTool({
2817
+ name: "ctm_aave_v4_build_repay_multisign",
2818
+ actionId: "aave-v4.repay",
2819
+ protocolId: "aave-v4",
2820
+ chainCategory: "evm",
2821
+ description: "Build Aave v4 Spoke repay batch.",
2822
+ prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
2823
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2824
+ handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeRepay" },
2825
+ inputZod: mcpAaveV4RepayInputSchema
2826
+ }),
2827
+ defineProtocolMcpTool({
2828
+ name: "ctm_euler_v2_build_isolated_lend_multisign",
2829
+ actionId: "euler-v2.isolated-lend",
2830
+ protocolId: "euler-v2",
2831
+ chainCategory: "evm",
2832
+ description: "Build Euler v2 vault deposit/lend batch.",
2833
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
2834
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2835
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedLendDepositBatch" },
2836
+ inputZod: mcpEulerV2IsolatedLendInputSchema
2837
+ }),
2838
+ defineProtocolMcpTool({
2839
+ name: "ctm_euler_v2_build_isolated_borrow_multisign",
2840
+ actionId: "euler-v2.isolated-borrow",
2841
+ protocolId: "euler-v2",
2842
+ chainCategory: "evm",
2843
+ description: "Build Euler v2 isolated borrow loop batch.",
2844
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral"],
2845
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2846
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedBorrowBatch" },
2847
+ inputZod: mcpEulerV2IsolatedBorrowInputSchema
2848
+ }),
2849
+ defineProtocolMcpTool({
2850
+ name: "ctm_euler_v2_build_vault_withdraw_multisign",
2851
+ actionId: "euler-v2.vault-withdraw",
2852
+ protocolId: "euler-v2",
2853
+ chainCategory: "evm",
2854
+ description: "Build Euler v2 vault withdraw/redeem batch.",
2855
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
2856
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2857
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2VaultWithdrawBatch" },
2858
+ inputZod: mcpEulerV2VaultWithdrawInputSchema
2859
+ }),
2860
+ defineProtocolMcpTool({
2861
+ name: "ctm_euler_v2_build_borrow_repay_multisign",
2862
+ actionId: "euler-v2.borrow-repay",
2863
+ protocolId: "euler-v2",
2864
+ chainCategory: "evm",
2865
+ description: "Build Euler v2 borrow repay batch.",
2866
+ prerequisites: ["keyGen", "executorAddress", "vault address"],
2867
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2868
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowRepayBatch" },
2869
+ inputZod: mcpEulerV2BorrowRepayInputSchema
2870
+ }),
2871
+ defineProtocolMcpTool({
2872
+ name: "ctm_euler_v2_build_collateral_deposit_multisign",
2873
+ actionId: "euler-v2.collateral-deposit",
2874
+ protocolId: "euler-v2",
2875
+ chainCategory: "evm",
2876
+ description: "Build Euler v2 borrow collateral deposit batch.",
2877
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
2878
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2879
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralDepositBatch" },
2880
+ inputZod: mcpEulerV2CollateralDepositInputSchema
2881
+ }),
2882
+ defineProtocolMcpTool({
2883
+ name: "ctm_euler_v2_build_collateral_withdraw_multisign",
2884
+ actionId: "euler-v2.collateral-withdraw",
2885
+ protocolId: "euler-v2",
2886
+ chainCategory: "evm",
2887
+ description: "Build Euler v2 borrow collateral withdraw batch.",
2888
+ prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
2889
+ followUp: ["Sign messageToSign", "POST /multiSignRequest"],
2890
+ handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralWithdrawBatch" },
2891
+ inputZod: mcpEulerV2CollateralWithdrawInputSchema
2892
+ })
2893
+ ];
2894
+
2895
+ // src/agent/mcpTools.ts
2896
+ function defineMcpTool(def) {
2897
+ return {
2898
+ ...def,
2899
+ inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
2900
+ outputSchema: zodSchemaToMcpJsonSchema(def.outputZod),
2901
+ parseInput: (data) => def.inputZod.parse(data),
2902
+ parseOutput: (data) => def.outputZod.parse(data)
2903
+ };
2340
2904
  }
2341
- var multisignOutputSchema = {
2342
- type: "object",
2343
- description: MULTISIGN_OUTPUT_DOC.description,
2344
- properties: {
2345
- bodyForSign: {
2346
- type: "object",
2347
- description: MULTISIGN_OUTPUT_DOC.fields.bodyForSign.description
2348
- },
2349
- messageToSign: {
2350
- type: "string",
2351
- description: MULTISIGN_OUTPUT_DOC.fields.messageToSign.description
2352
- }
2353
- },
2354
- required: ["bodyForSign", "messageToSign"]
2355
- };
2356
- var MCP_TOOL_DEFINITIONS = [
2357
- {
2905
+ var CORE_MCP_TOOL_DEFINITIONS = [
2906
+ defineMcpTool({
2358
2907
  name: "ctm_uniswap_v4_quote",
2359
2908
  actionId: "uniswap-v4.quote",
2360
2909
  protocolId: "uniswap-v4",
@@ -2363,33 +2912,10 @@ var MCP_TOOL_DEFINITIONS = [
2363
2912
  prerequisites: ["Chain must be supported by Uniswap V4 (Universal Router map)."],
2364
2913
  followUp: ["ctm_uniswap_v4_create_swap", "ctm_uniswap_v4_build_swap_multisign"],
2365
2914
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapTradeQuote" },
2366
- inputSchema: {
2367
- type: "object",
2368
- properties: paramProperties({
2369
- type: { type: "string", required: true, description: "EXACT_INPUT or EXACT_OUTPUT" },
2370
- amount: { type: "string", required: true, description: "Amount in token-in base units (wei string for ERC-20)" },
2371
- tokenIn: { type: "address", required: true, description: "Input token; 0x0 for native ETH" },
2372
- tokenOut: { type: "address", required: true, description: "Output token address" },
2373
- chainId: { type: "number", required: true, description: "tokenInChainId / same-chain default" },
2374
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API x-api-key" },
2375
- swapper: { type: "address", required: false, description: "MPC executor; omit if keyGen + managementNodeUrl provided" },
2376
- slippage: { type: "number", required: false, description: "Slippage percent; omit for API auto slippage" }
2377
- }),
2378
- required: requiredKeys({
2379
- type: { type: "string", required: true, description: "" },
2380
- amount: { type: "string", required: true, description: "" },
2381
- tokenIn: { type: "address", required: true, description: "" },
2382
- tokenOut: { type: "address", required: true, description: "" },
2383
- chainId: { type: "number", required: true, description: "" },
2384
- uniswapApiKey: { type: "string", required: true, description: "" }
2385
- })
2386
- },
2387
- outputSchema: {
2388
- type: "object",
2389
- description: "Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
2390
- }
2391
- },
2392
- {
2915
+ inputZod: mcpUniswapV4QuoteInputSchema,
2916
+ outputZod: mcpUniswapV4QuoteOutputSchema
2917
+ }),
2918
+ defineMcpTool({
2393
2919
  name: "ctm_uniswap_v4_create_swap",
2394
2920
  actionId: "uniswap-v4.create-swap",
2395
2921
  protocolId: "uniswap-v4",
@@ -2398,33 +2924,10 @@ var MCP_TOOL_DEFINITIONS = [
2398
2924
  prerequisites: ["ctm_uniswap_v4_quote output (fullQuoteFromPermit)"],
2399
2925
  followUp: ["ctm_uniswap_v4_build_swap_multisign"],
2400
2926
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapCreateSwap" },
2401
- inputSchema: {
2402
- type: "object",
2403
- properties: paramProperties({
2404
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" },
2405
- fullQuoteFromPermit: { type: "object", required: true, description: "Full quote JSON from ctm_uniswap_v4_quote" },
2406
- swapTransactionDeadlineUnix: {
2407
- type: "number",
2408
- required: false,
2409
- description: "On-chain deadline unix seconds; default ~30 min from now"
2410
- },
2411
- useServerProxy: {
2412
- type: "boolean",
2413
- required: false,
2414
- description: "Set false in Node/agents; true only in browser via Next API route"
2415
- }
2416
- }),
2417
- required: requiredKeys({
2418
- uniswapApiKey: { type: "string", required: true, description: "" },
2419
- fullQuoteFromPermit: { type: "object", required: true, description: "" }
2420
- })
2421
- },
2422
- outputSchema: {
2423
- type: "object",
2424
- description: "{ swap: TransactionRequest, requestId?, gasFee? }"
2425
- }
2426
- },
2427
- {
2927
+ inputZod: mcpUniswapV4CreateSwapInputSchema,
2928
+ outputZod: mcpUniswapV4CreateSwapOutputSchema
2929
+ }),
2930
+ defineMcpTool({
2428
2931
  name: "ctm_uniswap_v4_build_swap_multisign",
2429
2932
  actionId: "uniswap-v4.swap-exact-input",
2430
2933
  protocolId: "uniswap-v4",
@@ -2438,33 +2941,10 @@ var MCP_TOOL_DEFINITIONS = [
2438
2941
  ],
2439
2942
  followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
2440
2943
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
2441
- inputSchema: {
2442
- type: "object",
2443
- properties: paramProperties(
2444
- {
2445
- tokenIn: { type: "address", required: true, description: "Token in; 0x0 for native ETH" },
2446
- swap: { type: "object", required: true, description: "swap field from create_swap response" },
2447
- createSwapResponse: { type: "object", required: true, description: "Full create_swap response" },
2448
- fullQuoteSnapshot: { type: "object", required: true, description: "Quote JSON used for the swap" },
2449
- swapDeadlineUnix: { type: "number", required: true, description: "Same deadline passed to create_swap" },
2450
- slippagePercent: { type: "number", required: false, description: "Extra approve headroom for EXACT_OUTPUT" }
2451
- },
2452
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
2453
- ),
2454
- required: requiredKeys(
2455
- {
2456
- tokenIn: { type: "address", required: true, description: "" },
2457
- swap: { type: "object", required: true, description: "" },
2458
- createSwapResponse: { type: "object", required: true, description: "" },
2459
- fullQuoteSnapshot: { type: "object", required: true, description: "" },
2460
- swapDeadlineUnix: { type: "number", required: true, description: "" }
2461
- },
2462
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
2463
- )
2464
- },
2465
- outputSchema: multisignOutputSchema
2466
- },
2467
- {
2944
+ inputZod: mcpUniswapV4BuildSwapMultisignInputSchema,
2945
+ outputZod: multisignOutputSchema
2946
+ }),
2947
+ defineMcpTool({
2468
2948
  name: "ctm_curve_dao_build_swap_multisign",
2469
2949
  actionId: "curve-dao.swap",
2470
2950
  protocolId: "curve-dao",
@@ -2473,30 +2953,23 @@ var MCP_TOOL_DEFINITIONS = [
2473
2953
  prerequisites: ["keyGen", "executorAddress", "tokenIn/tokenOut/amountHuman/slippage", "RPC URL"],
2474
2954
  followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
2475
2955
  handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
2476
- inputSchema: {
2477
- type: "object",
2478
- properties: paramProperties(
2479
- {
2480
- tokenIn: { type: "address", required: true, description: "ERC-20 sold (native in uses WETH path in UI)" },
2481
- tokenOut: { type: "string", required: true, description: "Output token or 0xeeee\u2026 native placeholder" },
2482
- amountHuman: { type: "string", required: true, description: "Human-readable amount of tokenIn" },
2483
- slippagePercent: { type: "number", required: true, description: "Slippage 0\u2013100 exclusive" }
2484
- },
2485
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
2486
- ),
2487
- required: requiredKeys(
2488
- {
2489
- tokenIn: { type: "address", required: true, description: "" },
2490
- tokenOut: { type: "string", required: true, description: "" },
2491
- amountHuman: { type: "string", required: true, description: "" },
2492
- slippagePercent: { type: "number", required: true, description: "" }
2493
- },
2494
- ["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
2495
- )
2496
- },
2497
- outputSchema: multisignOutputSchema
2498
- }
2956
+ inputZod: mcpCurveDaoBuildSwapMultisignInputSchema,
2957
+ outputZod: multisignOutputSchema
2958
+ })
2959
+ ];
2960
+ var MCP_TOOL_DEFINITIONS = [
2961
+ ...CORE_MCP_TOOL_DEFINITIONS,
2962
+ ...MCP_PROTOCOL_TOOL_DEFINITIONS
2499
2963
  ];
2964
+ function buildToolSchemaMap(kind) {
2965
+ const out = {};
2966
+ for (const tool of MCP_TOOL_DEFINITIONS) {
2967
+ out[tool.name] = kind === "input" ? tool.inputZod : tool.outputZod;
2968
+ }
2969
+ return out;
2970
+ }
2971
+ var MCP_TOOL_INPUT_SCHEMAS = buildToolSchemaMap("input");
2972
+ var MCP_TOOL_OUTPUT_SCHEMAS = buildToolSchemaMap("output");
2500
2973
  function getAgentCatalogForMcp() {
2501
2974
  return {
2502
2975
  tools: MCP_TOOL_DEFINITIONS,
@@ -2504,6 +2977,9 @@ function getAgentCatalogForMcp() {
2504
2977
  commonParams: EVM_COMMON_PARAM_DOCS,
2505
2978
  multisignOutput: MULTISIGN_OUTPUT_DOC,
2506
2979
  managementSig: MANAGEMENT_SIG_DOC,
2980
+ /** Zod schemas for MCP tool I/O — source of truth for continuum-mcp-server validation. */
2981
+ inputSchemas: MCP_TOOL_INPUT_SCHEMAS,
2982
+ outputSchemas: MCP_TOOL_OUTPUT_SCHEMAS,
2507
2983
  workflow: {
2508
2984
  evmSwapTypical: [
2509
2985
  "1. Quote (protocol-specific API if needed)",
@@ -2522,10 +2998,211 @@ function getAgentCatalogForMcp() {
2522
2998
  }
2523
2999
  };
2524
3000
  }
3001
+ viem.getAddress(
3002
+ "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
3003
+ );
3004
+ viem.getAddress(
3005
+ "0x7f39C581F595B853cBbF37C12FfeeA971C5a5bEa"
3006
+ );
3007
+ viem.getAddress("0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1");
3008
+ var LIDO_ETHEREUM_MAINNET_CHAIN_ID = 1;
3009
+
3010
+ // src/protocols/evm/lido/index.ts
3011
+ var LIDO_PROTOCOL_ID = "lido";
3012
+ var lidoProtocolModule = {
3013
+ id: LIDO_PROTOCOL_ID,
3014
+ chainCategory: "evm",
3015
+ isChainSupported(ctx) {
3016
+ if (ctx.chainCategory !== "evm") return false;
3017
+ return Number(ctx.chainId) === LIDO_ETHEREUM_MAINNET_CHAIN_ID;
3018
+ },
3019
+ isTokenSupported(token) {
3020
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
3021
+ },
3022
+ actions: [
3023
+ { 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)" } } },
3024
+ { id: "lido.request-withdrawals", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Queue stETH withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3025
+ { id: "lido.claim-withdrawal", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Claim finalized withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3026
+ { id: "lido.wrap-steth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Wrap stETH to wstETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3027
+ { id: "lido.unwrap-wsteth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Unwrap wstETH to stETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3028
+ ]
3029
+ };
3030
+ registerProtocolModule(lidoProtocolModule);
3031
+ var USDE_ETHEREUM_MAINNET = "0x4c9edd5852cd905f086c759e8383e09bff1e68b3";
3032
+ var USDE_MOST_L2S = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
3033
+ var USDE_ZKSYNC_ERA = "0x39Fe7a0DACcE31Bd90418e3e659fb0b5f0B3Db0d";
3034
+ var L2_SAME_ADDRESS_CHAIN_IDS = /* @__PURE__ */ new Set([
3035
+ 42161,
3036
+ // Arbitrum One
3037
+ 10,
3038
+ // Optimism
3039
+ 8453,
3040
+ // Base
3041
+ 56,
3042
+ // BNB Chain
3043
+ 59144,
3044
+ // Linea
3045
+ 5e3,
3046
+ // Mantle
3047
+ 81457,
3048
+ // Blast
3049
+ 169,
3050
+ // Manta Pacific
3051
+ 534352,
3052
+ // Scroll
3053
+ 252,
3054
+ // Fraxtal
3055
+ 34443,
3056
+ // Mode
3057
+ 196,
3058
+ // X Layer
3059
+ 1088,
3060
+ // Metis
3061
+ 80084,
3062
+ // Berachain
3063
+ 2222,
3064
+ // Kava
3065
+ 2818,
3066
+ // Morph
3067
+ 1923,
3068
+ // Swell
3069
+ 48900
3070
+ // Zircuit
3071
+ ]);
3072
+ function usdeTokenAddressOnEvmChain(chainId) {
3073
+ if (chainId === 1) return USDE_ETHEREUM_MAINNET;
3074
+ if (chainId === 324) return USDE_ZKSYNC_ERA;
3075
+ if (L2_SAME_ADDRESS_CHAIN_IDS.has(chainId)) return USDE_MOST_L2S;
3076
+ return null;
3077
+ }
3078
+ function isEvmChainInEthenaUsdeList(chainId) {
3079
+ return usdeTokenAddressOnEvmChain(chainId) != null;
3080
+ }
3081
+
3082
+ // src/protocols/evm/ethena/index.ts
3083
+ var ETHENA_PROTOCOL_ID = "ethena";
3084
+ var ethenaProtocolModule = {
3085
+ id: ETHENA_PROTOCOL_ID,
3086
+ chainCategory: "evm",
3087
+ isChainSupported(ctx) {
3088
+ if (ctx.chainCategory !== "evm") return false;
3089
+ const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
3090
+ return isEvmChainInEthenaUsdeList(n);
3091
+ },
3092
+ isTokenSupported(token) {
3093
+ return token.category === "evm" && token.kind === "erc20";
3094
+ },
3095
+ actions: [
3096
+ { 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" } } },
3097
+ { id: "ethena.redeem-susde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDe \u2192 USDe (no cooldown)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3098
+ { id: "ethena.cooldown-shares", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Start sUSDe cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3099
+ { id: "ethena.claim-unstake", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Claim after cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3100
+ ]
3101
+ };
3102
+ registerProtocolModule(ethenaProtocolModule);
3103
+
3104
+ // src/protocols/evm/maple/constants.ts
3105
+ function isMapleSyrupSupportedChain(chainId) {
3106
+ return chainId === 1 || chainId === 11155111;
3107
+ }
3108
+
3109
+ // src/protocols/evm/maple/index.ts
3110
+ var MAPLE_PROTOCOL_ID = "maple-syrup";
3111
+ var mapleProtocolModule = {
3112
+ id: MAPLE_PROTOCOL_ID,
3113
+ chainCategory: "evm",
3114
+ isChainSupported(ctx) {
3115
+ if (ctx.chainCategory !== "evm") return false;
3116
+ const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
3117
+ return isMapleSyrupSupportedChain(n);
3118
+ },
3119
+ isTokenSupported(token) {
3120
+ return token.category === "evm" && token.kind === "erc20";
3121
+ },
3122
+ actions: [
3123
+ { id: "maple-syrup.deposit", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Maple Syrup pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3124
+ { id: "maple-syrup.request-redeem", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Request redeem from pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3125
+ ]
3126
+ };
3127
+ registerProtocolModule(mapleProtocolModule);
3128
+
3129
+ // src/protocols/evm/sky/mainnet.ts
3130
+ var SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
3131
+
3132
+ // src/protocols/evm/sky/index.ts
3133
+ var SKY_PROTOCOL_ID = "sky";
3134
+ var skyProtocolModule = {
3135
+ id: SKY_PROTOCOL_ID,
3136
+ chainCategory: "evm",
3137
+ isChainSupported(ctx) {
3138
+ if (ctx.chainCategory !== "evm") return false;
3139
+ return Number(ctx.chainId) === SKY_ETHEREUM_MAINNET_CHAIN_ID;
3140
+ },
3141
+ isTokenSupported(token) {
3142
+ return token.category === "evm" && token.kind === "erc20";
3143
+ },
3144
+ actions: [
3145
+ { id: "sky.lockstake-stake", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Open Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3146
+ { id: "sky.lockstake-draw", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Borrow USDS from Lockstake", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3147
+ { id: "sky.lockstake-wipe", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Repay Lockstake debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3148
+ { id: "sky.lockstake-close", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Close Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3149
+ { id: "sky.susds-deposit", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Deposit USDS into sUSDS vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3150
+ { id: "sky.susds-redeem", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDS to USDS", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3151
+ ]
3152
+ };
3153
+ registerProtocolModule(skyProtocolModule);
3154
+
3155
+ // src/protocols/evm/aave-v4/index.ts
3156
+ var AAVE_V4_PROTOCOL_ID = "aave-v4";
3157
+ var aaveV4ProtocolModule = {
3158
+ id: AAVE_V4_PROTOCOL_ID,
3159
+ chainCategory: "evm",
3160
+ isChainSupported(ctx) {
3161
+ return ctx.chainCategory === "evm";
3162
+ },
3163
+ isTokenSupported(token) {
3164
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
3165
+ },
3166
+ actions: [
3167
+ { id: "aave-v4.deposit", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Supply to Aave v4 Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3168
+ { id: "aave-v4.withdraw", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3169
+ { id: "aave-v4.borrow", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3170
+ { id: "aave-v4.repay", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Repay Spoke debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3171
+ ]
3172
+ };
3173
+ registerProtocolModule(aaveV4ProtocolModule);
3174
+
3175
+ // src/protocols/evm/euler-v2/index.ts
3176
+ var EULER_V2_PROTOCOL_ID = "euler-v2";
3177
+ var eulerV2ProtocolModule = {
3178
+ id: EULER_V2_PROTOCOL_ID,
3179
+ chainCategory: "evm",
3180
+ isChainSupported(ctx) {
3181
+ return ctx.chainCategory === "evm";
3182
+ },
3183
+ isTokenSupported(token) {
3184
+ return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
3185
+ },
3186
+ actions: [
3187
+ { id: "euler-v2.isolated-lend", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3188
+ { id: "euler-v2.isolated-borrow", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3189
+ { id: "euler-v2.vault-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3190
+ { id: "euler-v2.borrow-repay", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Repay Euler borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3191
+ { id: "euler-v2.collateral-deposit", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
3192
+ { id: "euler-v2.collateral-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
3193
+ ]
3194
+ };
3195
+ registerProtocolModule(eulerV2ProtocolModule);
2525
3196
 
2526
3197
  // src/agent/catalog.ts
2527
3198
  registerProtocolModule(uniswapV4ProtocolModule);
2528
3199
  registerProtocolModule(curveDaoProtocolModule);
3200
+ registerProtocolModule(lidoProtocolModule);
3201
+ registerProtocolModule(ethenaProtocolModule);
3202
+ registerProtocolModule(mapleProtocolModule);
3203
+ registerProtocolModule(skyProtocolModule);
3204
+ registerProtocolModule(aaveV4ProtocolModule);
3205
+ registerProtocolModule(eulerV2ProtocolModule);
2529
3206
  function getAgentCatalog() {
2530
3207
  return {
2531
3208
  protocols: getProtocolModules(),
@@ -2536,6 +3213,12 @@ function getAgentCatalog() {
2536
3213
  },
2537
3214
  uniswapV4: uniswapV4ProtocolModule,
2538
3215
  curveDao: curveDaoProtocolModule,
3216
+ lido: lidoProtocolModule,
3217
+ ethena: ethenaProtocolModule,
3218
+ maple: mapleProtocolModule,
3219
+ sky: skyProtocolModule,
3220
+ aaveV4: aaveV4ProtocolModule,
3221
+ eulerV2: eulerV2ProtocolModule,
2539
3222
  /** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
2540
3223
  mcp: getAgentCatalogForMcp()
2541
3224
  };
@@ -2568,6 +3251,7 @@ exports.getProtocolModule = getProtocolModule;
2568
3251
  exports.getProtocolModules = getProtocolModules;
2569
3252
  exports.gweiToDecimalString = gweiToDecimalString;
2570
3253
  exports.isEvmNativeToken = isEvmNativeToken;
3254
+ exports.isValidRpcUrl = isValidRpcUrl;
2571
3255
  exports.keyListFromKeyGen = keyListFromKeyGen;
2572
3256
  exports.managementSigFields = managementSigFields;
2573
3257
  exports.matchEvmTokenKind = matchEvmTokenKind;