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