@continuumdao/ctm-mpc-defi 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/catalog.cjs +638 -4
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +458 -14
- package/dist/agent/catalog.js +615 -5
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/gmx/SKILL.md +45 -0
- package/dist/agent/skills/uniswap-v4/SKILL.md +9 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +2251 -0
- package/dist/protocols/evm/gmx/index.cjs.map +1 -0
- package/dist/protocols/evm/gmx/index.d.ts +469 -0
- package/dist/protocols/evm/gmx/index.js +2181 -0
- package/dist/protocols/evm/gmx/index.js.map +1 -0
- package/dist/protocols/evm/uniswap-v4/index.cjs +227 -3
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +63 -1
- package/dist/protocols/evm/uniswap-v4/index.js +222 -5
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +7 -1
package/dist/agent/catalog.cjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
var viem = require('viem');
|
|
4
4
|
var zodToJsonSchema = require('zod-to-json-schema');
|
|
5
5
|
var zod = require('zod');
|
|
6
|
+
var module$1 = require('module');
|
|
7
|
+
var url = require('url');
|
|
6
8
|
var fs = require('fs');
|
|
7
9
|
var path = require('path');
|
|
8
|
-
var url = require('url');
|
|
9
10
|
|
|
10
11
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
11
12
|
// src/core/registry.ts
|
|
@@ -611,6 +612,33 @@ var mcpUniswapV4LpCreatePositionInputSchema = lpCommonApiInputSchema.extend({
|
|
|
611
612
|
priceBounds: lpPriceBoundsSchema.optional(),
|
|
612
613
|
tickBounds: lpTickBoundsSchema.optional()
|
|
613
614
|
});
|
|
615
|
+
var mcpUniswapV4LpListPoolsInputSchema = zod.z.object({
|
|
616
|
+
chainId: zod.z.union([zod.z.number().int().positive(), zod.z.string().min(1)]),
|
|
617
|
+
pair: zod.z.string().optional().describe("Optional filter, e.g. eth-usdc or ETH/USDC")
|
|
618
|
+
});
|
|
619
|
+
var mcpUniswapV4LpListPoolsOutputSchema = zod.z.object({
|
|
620
|
+
chainId: zod.z.number().int().positive(),
|
|
621
|
+
chainLabel: zod.z.string(),
|
|
622
|
+
pools: zod.z.array(
|
|
623
|
+
zod.z.object({
|
|
624
|
+
presetId: zod.z.string(),
|
|
625
|
+
pairSlug: zod.z.string(),
|
|
626
|
+
pairLabel: zod.z.string(),
|
|
627
|
+
fee: zod.z.number().int(),
|
|
628
|
+
feeLabel: zod.z.string(),
|
|
629
|
+
tickSpacing: zod.z.number().int(),
|
|
630
|
+
token0Symbol: zod.z.string(),
|
|
631
|
+
token1Symbol: zod.z.string(),
|
|
632
|
+
token0Address: evmAddressSchema,
|
|
633
|
+
token1Address: evmAddressSchema,
|
|
634
|
+
poolReference: zod.z.string(),
|
|
635
|
+
hooks: evmAddressSchema,
|
|
636
|
+
nativeWrapped: evmAddressSchema.optional(),
|
|
637
|
+
usesNativeEth: zod.z.boolean()
|
|
638
|
+
})
|
|
639
|
+
),
|
|
640
|
+
notes: zod.z.string()
|
|
641
|
+
});
|
|
614
642
|
var mcpUniswapV4LpCreatePositionOutputSchema = jsonObjectSchema;
|
|
615
643
|
var mcpUniswapV4LpIncreaseInputSchema = lpCommonApiInputSchema.extend({
|
|
616
644
|
token0Address: evmAddressSchema,
|
|
@@ -852,6 +880,154 @@ var mcpEulerV2CollateralWithdrawInputSchema = mcpMultisignInput({
|
|
|
852
880
|
collateralAsset: evmAddressSchema,
|
|
853
881
|
amountHuman: zod.z.string().min(1)
|
|
854
882
|
});
|
|
883
|
+
function mcpGmxMultisignInput(fields) {
|
|
884
|
+
return evmMultisignCommonInputSchema.extend(fields);
|
|
885
|
+
}
|
|
886
|
+
var gmxDirectionSchema = zod.z.enum(["long", "short"]);
|
|
887
|
+
var gmxOrderTypeSchema = zod.z.enum(["market", "limit"]);
|
|
888
|
+
var mcpGmxFetchMarketsInputSchema = zod.z.object({
|
|
889
|
+
chainId: zod.z.number().int().positive()
|
|
890
|
+
});
|
|
891
|
+
var mcpGmxFetchMarketsOutputSchema = zod.z.object({
|
|
892
|
+
markets: zod.z.array(
|
|
893
|
+
zod.z.object({
|
|
894
|
+
symbol: zod.z.string(),
|
|
895
|
+
marketTokenAddress: zod.z.string(),
|
|
896
|
+
maxLeverageLabel: zod.z.string().nullable()
|
|
897
|
+
})
|
|
898
|
+
)
|
|
899
|
+
});
|
|
900
|
+
var mcpGmxFetchPositionsInputSchema = zod.z.object({
|
|
901
|
+
chainId: zod.z.number().int().positive(),
|
|
902
|
+
executorAddress: evmAddressSchema
|
|
903
|
+
});
|
|
904
|
+
var mcpGmxFetchPositionsOutputSchema = zod.z.object({
|
|
905
|
+
positions: zod.z.array(zod.z.record(zod.z.unknown()))
|
|
906
|
+
});
|
|
907
|
+
var mcpGmxIncreaseInputSchema = mcpGmxMultisignInput({
|
|
908
|
+
symbol: zod.z.string().min(1),
|
|
909
|
+
direction: gmxDirectionSchema,
|
|
910
|
+
orderType: gmxOrderTypeSchema,
|
|
911
|
+
sizeUsdHuman: zod.z.string().min(1),
|
|
912
|
+
collateralToken: zod.z.string().min(1),
|
|
913
|
+
collateralAmountHuman: zod.z.string().min(1),
|
|
914
|
+
triggerPriceUsdHuman: zod.z.string().optional(),
|
|
915
|
+
slippageBps: zod.z.number().int().nonnegative().optional(),
|
|
916
|
+
executionFeeBufferBps: zod.z.number().int().nonnegative().optional()
|
|
917
|
+
});
|
|
918
|
+
var mcpGmxDecreaseInputSchema = mcpGmxMultisignInput({
|
|
919
|
+
symbol: zod.z.string().min(1),
|
|
920
|
+
direction: gmxDirectionSchema,
|
|
921
|
+
orderType: gmxOrderTypeSchema,
|
|
922
|
+
sizeUsdHuman: zod.z.string().min(1),
|
|
923
|
+
collateralToken: zod.z.string().min(1),
|
|
924
|
+
receiveToken: zod.z.string().optional(),
|
|
925
|
+
triggerPriceUsdHuman: zod.z.string().optional(),
|
|
926
|
+
keepLeverage: zod.z.boolean().optional(),
|
|
927
|
+
slippageBps: zod.z.number().int().nonnegative().optional(),
|
|
928
|
+
executionFeeBufferBps: zod.z.number().int().nonnegative().optional()
|
|
929
|
+
});
|
|
930
|
+
var mcpGmxCancelInputSchema = mcpGmxMultisignInput({
|
|
931
|
+
orderId: zod.z.string().min(1)
|
|
932
|
+
});
|
|
933
|
+
var mcpGmxGmDepositInputSchema = mcpGmxMultisignInput({
|
|
934
|
+
marketSymbol: zod.z.string().min(1),
|
|
935
|
+
collateralToken: zod.z.string().min(1),
|
|
936
|
+
collateralAmountHuman: zod.z.string().min(1),
|
|
937
|
+
executionFeeBufferBps: zod.z.number().int().nonnegative().optional(),
|
|
938
|
+
isNativeIn: zod.z.boolean().optional(),
|
|
939
|
+
nativeWrapped: evmAddressSchema.optional()
|
|
940
|
+
});
|
|
941
|
+
var mcpGmxGmWithdrawInputSchema = mcpGmxMultisignInput({
|
|
942
|
+
marketSymbol: zod.z.string().min(1),
|
|
943
|
+
gmAmountHuman: zod.z.string().min(1),
|
|
944
|
+
gmDecimals: zod.z.number().int().nonnegative().optional(),
|
|
945
|
+
executionFeeBufferBps: zod.z.number().int().nonnegative().optional(),
|
|
946
|
+
isNativeOut: zod.z.boolean().optional()
|
|
947
|
+
});
|
|
948
|
+
var mcpGmxStakeGmxInputSchema = mcpGmxMultisignInput({
|
|
949
|
+
amountHuman: zod.z.string().min(1),
|
|
950
|
+
gmxDecimals: zod.z.number().int().nonnegative().optional()
|
|
951
|
+
});
|
|
952
|
+
var mcpGmxUnstakeGmxInputSchema = mcpGmxMultisignInput({
|
|
953
|
+
amountHuman: zod.z.string().min(1),
|
|
954
|
+
gmxDecimals: zod.z.number().int().nonnegative().optional()
|
|
955
|
+
});
|
|
956
|
+
var mcpGmxFetchGmMarketsInputSchema = zod.z.object({
|
|
957
|
+
chainId: zod.z.number().int().positive()
|
|
958
|
+
});
|
|
959
|
+
var mcpGmxGmMarketApyRowSchema = zod.z.object({
|
|
960
|
+
symbol: zod.z.string(),
|
|
961
|
+
marketTokenAddress: zod.z.string(),
|
|
962
|
+
longTokenSymbol: zod.z.string().nullable(),
|
|
963
|
+
shortTokenSymbol: zod.z.string().nullable(),
|
|
964
|
+
apy: zod.z.number().nullable(),
|
|
965
|
+
baseApy: zod.z.number().nullable(),
|
|
966
|
+
bonusApr: zod.z.number().nullable(),
|
|
967
|
+
apyPercentLabel: zod.z.string().nullable()
|
|
968
|
+
});
|
|
969
|
+
var mcpGmxFetchGmMarketsOutputSchema = zod.z.object({
|
|
970
|
+
markets: zod.z.array(mcpGmxGmMarketApyRowSchema)
|
|
971
|
+
});
|
|
972
|
+
var mcpGmxFetchGmApyInputSchema = zod.z.object({
|
|
973
|
+
chainId: zod.z.number().int().positive()
|
|
974
|
+
});
|
|
975
|
+
var mcpGmxFetchGmApyOutputSchema = zod.z.object({
|
|
976
|
+
markets: zod.z.array(
|
|
977
|
+
zod.z.object({
|
|
978
|
+
symbol: zod.z.string(),
|
|
979
|
+
marketTokenAddress: zod.z.string(),
|
|
980
|
+
longTokenSymbol: zod.z.string().nullable(),
|
|
981
|
+
shortTokenSymbol: zod.z.string().nullable(),
|
|
982
|
+
apy: zod.z.number().nullable(),
|
|
983
|
+
baseApy: zod.z.number().nullable(),
|
|
984
|
+
bonusApr: zod.z.number().nullable(),
|
|
985
|
+
apyPercentLabel: zod.z.string().nullable()
|
|
986
|
+
})
|
|
987
|
+
)
|
|
988
|
+
});
|
|
989
|
+
var mcpGmxFetchStakingPowerInputSchema = zod.z.object({
|
|
990
|
+
chainId: zod.z.number().int().positive(),
|
|
991
|
+
executorAddress: evmAddressSchema
|
|
992
|
+
});
|
|
993
|
+
var mcpGmxFetchStakingPowerOutputSchema = zod.z.object({
|
|
994
|
+
stakingPower: zod.z.record(zod.z.unknown())
|
|
995
|
+
});
|
|
996
|
+
var gmxOhlcvTimeframeSchema = zod.z.enum(["1m", "5m", "15m", "1h", "4h", "1d", "1w", "1M"]);
|
|
997
|
+
var gmxOhlcvCandleSchema = zod.z.object({
|
|
998
|
+
timestampMs: zod.z.number(),
|
|
999
|
+
timeLabel: zod.z.string(),
|
|
1000
|
+
open: zod.z.string(),
|
|
1001
|
+
high: zod.z.string(),
|
|
1002
|
+
low: zod.z.string(),
|
|
1003
|
+
close: zod.z.string()
|
|
1004
|
+
});
|
|
1005
|
+
var mcpGmxFetchMarketPricesInputSchema = zod.z.object({
|
|
1006
|
+
chainId: zod.z.number().int().positive(),
|
|
1007
|
+
symbol: zod.z.string().min(1),
|
|
1008
|
+
collateralSymbol: zod.z.string().min(1)
|
|
1009
|
+
});
|
|
1010
|
+
var mcpGmxFetchMarketPricesOutputSchema = zod.z.object({
|
|
1011
|
+
symbol: zod.z.string(),
|
|
1012
|
+
indexLabel: zod.z.string(),
|
|
1013
|
+
collateralSymbol: zod.z.string(),
|
|
1014
|
+
indexMarkUsd: zod.z.string().nullable(),
|
|
1015
|
+
collateralUsd: zod.z.string().nullable(),
|
|
1016
|
+
indexPerCollateral: zod.z.string().nullable(),
|
|
1017
|
+
fetchedAtMs: zod.z.number()
|
|
1018
|
+
});
|
|
1019
|
+
var mcpGmxFetchOhlcvInputSchema = zod.z.object({
|
|
1020
|
+
chainId: zod.z.number().int().positive(),
|
|
1021
|
+
symbol: zod.z.string().min(1),
|
|
1022
|
+
timeframe: gmxOhlcvTimeframeSchema.optional(),
|
|
1023
|
+
limit: zod.z.number().int().positive().max(500).optional(),
|
|
1024
|
+
sort: zod.z.enum(["asc", "desc"]).optional()
|
|
1025
|
+
});
|
|
1026
|
+
var mcpGmxFetchOhlcvOutputSchema = zod.z.object({
|
|
1027
|
+
symbol: zod.z.string(),
|
|
1028
|
+
timeframe: gmxOhlcvTimeframeSchema,
|
|
1029
|
+
candles: zod.z.array(gmxOhlcvCandleSchema)
|
|
1030
|
+
});
|
|
855
1031
|
|
|
856
1032
|
// src/agent/mcpProtocolTools.ts
|
|
857
1033
|
function defineProtocolMcpTool(def) {
|
|
@@ -1178,6 +1354,83 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
|
1178
1354
|
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1179
1355
|
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralWithdrawBatch" },
|
|
1180
1356
|
inputZod: mcpEulerV2CollateralWithdrawInputSchema
|
|
1357
|
+
}),
|
|
1358
|
+
defineProtocolMcpTool({
|
|
1359
|
+
name: "ctm_gmx_build_increase_multisign",
|
|
1360
|
+
actionId: "gmx.increase",
|
|
1361
|
+
protocolId: "gmx",
|
|
1362
|
+
chainCategory: "evm",
|
|
1363
|
+
description: "Build mpc-auth multiSignRequest for GMX classic increase order (open/add perp). Keeper executes asynchronously after on-chain broadcast.",
|
|
1364
|
+
prerequisites: ["keyGen", "executorAddress", "GMX market symbol", "classic mode only \u2014 no subaccounts"],
|
|
1365
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1366
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxIncreaseBatch" },
|
|
1367
|
+
inputZod: mcpGmxIncreaseInputSchema
|
|
1368
|
+
}),
|
|
1369
|
+
defineProtocolMcpTool({
|
|
1370
|
+
name: "ctm_gmx_build_decrease_multisign",
|
|
1371
|
+
actionId: "gmx.decrease",
|
|
1372
|
+
protocolId: "gmx",
|
|
1373
|
+
chainCategory: "evm",
|
|
1374
|
+
description: "Build mpc-auth multiSignRequest for GMX classic decrease order (close/reduce perp).",
|
|
1375
|
+
prerequisites: ["keyGen", "executorAddress", "position market symbol"],
|
|
1376
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1377
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxDecreaseBatch" },
|
|
1378
|
+
inputZod: mcpGmxDecreaseInputSchema
|
|
1379
|
+
}),
|
|
1380
|
+
defineProtocolMcpTool({
|
|
1381
|
+
name: "ctm_gmx_build_cancel_multisign",
|
|
1382
|
+
actionId: "gmx.cancel",
|
|
1383
|
+
protocolId: "gmx",
|
|
1384
|
+
chainCategory: "evm",
|
|
1385
|
+
description: "Build mpc-auth multiSignRequest to cancel a pending GMX order (classic on-chain).",
|
|
1386
|
+
prerequisites: ["keyGen", "executorAddress", "orderId from fetchOrders"],
|
|
1387
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1388
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxCancelBatch" },
|
|
1389
|
+
inputZod: mcpGmxCancelInputSchema
|
|
1390
|
+
}),
|
|
1391
|
+
defineProtocolMcpTool({
|
|
1392
|
+
name: "ctm_gmx_build_gm_deposit_multisign",
|
|
1393
|
+
actionId: "gmx.gmDeposit",
|
|
1394
|
+
protocolId: "gmx",
|
|
1395
|
+
chainCategory: "evm",
|
|
1396
|
+
description: "Build mpc-auth multiSignRequest for GMX GM pool deposit (ExchangeRouter multicall). Keeper executes asynchronously.",
|
|
1397
|
+
prerequisites: ["keyGen", "executorAddress", "marketSymbol", "collateral token"],
|
|
1398
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1399
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxGmDepositBatch" },
|
|
1400
|
+
inputZod: mcpGmxGmDepositInputSchema
|
|
1401
|
+
}),
|
|
1402
|
+
defineProtocolMcpTool({
|
|
1403
|
+
name: "ctm_gmx_build_gm_withdraw_multisign",
|
|
1404
|
+
actionId: "gmx.gmWithdraw",
|
|
1405
|
+
protocolId: "gmx",
|
|
1406
|
+
chainCategory: "evm",
|
|
1407
|
+
description: "Build mpc-auth multiSignRequest for GMX GM pool withdrawal (ExchangeRouter multicall). Keeper executes asynchronously.",
|
|
1408
|
+
prerequisites: ["keyGen", "executorAddress", "GM market token balance"],
|
|
1409
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1410
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxGmWithdrawBatch" },
|
|
1411
|
+
inputZod: mcpGmxGmWithdrawInputSchema
|
|
1412
|
+
}),
|
|
1413
|
+
defineProtocolMcpTool({
|
|
1414
|
+
name: "ctm_gmx_build_stake_gmx_multisign",
|
|
1415
|
+
actionId: "gmx.stakeGmx",
|
|
1416
|
+
protocolId: "gmx",
|
|
1417
|
+
chainCategory: "evm",
|
|
1418
|
+
description: "Build mpc-auth multiSignRequest to stake GMX via RewardRouter.",
|
|
1419
|
+
prerequisites: ["keyGen", "executorAddress", "GMX token balance"],
|
|
1420
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1421
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxStakeGmxBatch" },
|
|
1422
|
+
inputZod: mcpGmxStakeGmxInputSchema
|
|
1423
|
+
}),
|
|
1424
|
+
defineProtocolMcpTool({
|
|
1425
|
+
name: "ctm_gmx_build_unstake_gmx_multisign",
|
|
1426
|
+
actionId: "gmx.unstakeGmx",
|
|
1427
|
+
protocolId: "gmx",
|
|
1428
|
+
chainCategory: "evm",
|
|
1429
|
+
description: "Build mpc-auth multiSignRequest to unstake GMX via RewardRouter.",
|
|
1430
|
+
prerequisites: ["keyGen", "executorAddress", "staked GMX balance"],
|
|
1431
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
1432
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxUnstakeGmxBatch" },
|
|
1433
|
+
inputZod: mcpGmxUnstakeGmxInputSchema
|
|
1181
1434
|
})
|
|
1182
1435
|
];
|
|
1183
1436
|
|
|
@@ -1238,13 +1491,29 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
1238
1491
|
inputZod: mcpUniswapV4BuildSwapMultisignInputSchema,
|
|
1239
1492
|
outputZod: multisignOutputSchema
|
|
1240
1493
|
}),
|
|
1494
|
+
defineMcpTool({
|
|
1495
|
+
name: "ctm_uniswap_v4_list_lp_pools",
|
|
1496
|
+
actionId: "uniswap-v4.lp-list-pools",
|
|
1497
|
+
protocolId: "uniswap-v4",
|
|
1498
|
+
chainCategory: "evm",
|
|
1499
|
+
description: "List standard Uniswap V4 LP pools for a chain (ETH/USDC and other main pairs at common fee tiers). Returns presetId, token addresses, fee, tickSpacing, and computed poolReference (bytes32 pool id). Use presetId as poolPreset on lp_create_position.",
|
|
1500
|
+
prerequisites: ["chainId"],
|
|
1501
|
+
followUp: ["ctm_uniswap_v4_lp_create_position"],
|
|
1502
|
+
handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapV4ListStandardLpPools" },
|
|
1503
|
+
inputZod: mcpUniswapV4LpListPoolsInputSchema,
|
|
1504
|
+
outputZod: mcpUniswapV4LpListPoolsOutputSchema
|
|
1505
|
+
}),
|
|
1241
1506
|
defineMcpTool({
|
|
1242
1507
|
name: "ctm_uniswap_v4_lp_create_position",
|
|
1243
1508
|
actionId: "uniswap-v4.lp-create",
|
|
1244
1509
|
protocolId: "uniswap-v4",
|
|
1245
1510
|
chainCategory: "evm",
|
|
1246
|
-
description: "Call Uniswap LP API POST /lp/create for a new V4 position. Returns token amounts and `create` transaction calldata. Does NOT create a sign request \u2014 call ctm_uniswap_v4_build_mint_liquidity_multisign next.",
|
|
1247
|
-
prerequisites: [
|
|
1511
|
+
description: "Call Uniswap LP API POST /lp/create for a new V4 position. Returns token amounts and `create` transaction calldata. Does NOT create a sign request \u2014 call ctm_uniswap_v4_build_mint_liquidity_multisign next. Pass poolPreset from list_lp_pools, or existingPool with poolReference (or fee+tickSpacing to derive pool id).",
|
|
1512
|
+
prerequisites: [
|
|
1513
|
+
"UNISWAP_API_KEY",
|
|
1514
|
+
"ctm_uniswap_v4_list_lp_pools for standard pairs",
|
|
1515
|
+
"get_defi_protocol_skill for LP flow"
|
|
1516
|
+
],
|
|
1248
1517
|
followUp: ["ctm_uniswap_v4_build_mint_liquidity_multisign"],
|
|
1249
1518
|
handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapLpCreatePosition" },
|
|
1250
1519
|
inputZod: mcpUniswapV4LpCreatePositionInputSchema,
|
|
@@ -1426,6 +1695,90 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
1426
1695
|
handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
|
|
1427
1696
|
inputZod: mcpCurveDaoBuildSwapMultisignInputSchema,
|
|
1428
1697
|
outputZod: multisignOutputSchema
|
|
1698
|
+
}),
|
|
1699
|
+
defineMcpTool({
|
|
1700
|
+
name: "ctm_gmx_fetch_markets",
|
|
1701
|
+
actionId: "gmx.fetch-markets",
|
|
1702
|
+
protocolId: "gmx",
|
|
1703
|
+
chainCategory: "evm",
|
|
1704
|
+
description: "List GMX V2 perp markets for a chain (symbol, market token, maxLeverageLabel). Read-only; uses GMX HTTP API.",
|
|
1705
|
+
prerequisites: ["chainId"],
|
|
1706
|
+
followUp: ["ctm_gmx_build_increase_multisign", "ctm_gmx_build_decrease_multisign"],
|
|
1707
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchMarketsSummary" },
|
|
1708
|
+
inputZod: mcpGmxFetchMarketsInputSchema,
|
|
1709
|
+
outputZod: mcpGmxFetchMarketsOutputSchema
|
|
1710
|
+
}),
|
|
1711
|
+
defineMcpTool({
|
|
1712
|
+
name: "ctm_gmx_fetch_positions",
|
|
1713
|
+
actionId: "gmx.fetch-positions",
|
|
1714
|
+
protocolId: "gmx",
|
|
1715
|
+
chainCategory: "evm",
|
|
1716
|
+
description: "Fetch open GMX perp positions for an executor address. Read-only.",
|
|
1717
|
+
prerequisites: ["chainId", "executorAddress (MPC ethereumaddress)"],
|
|
1718
|
+
followUp: ["ctm_gmx_build_decrease_multisign"],
|
|
1719
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchPositionsForExecutor" },
|
|
1720
|
+
inputZod: mcpGmxFetchPositionsInputSchema,
|
|
1721
|
+
outputZod: mcpGmxFetchPositionsOutputSchema
|
|
1722
|
+
}),
|
|
1723
|
+
defineMcpTool({
|
|
1724
|
+
name: "ctm_gmx_fetch_market_prices",
|
|
1725
|
+
actionId: "gmx.fetch-market-prices",
|
|
1726
|
+
protocolId: "gmx",
|
|
1727
|
+
chainCategory: "evm",
|
|
1728
|
+
description: "Latest GMX index mark and collateral USD prices for a perp market. Read-only via GMX HTTP API.",
|
|
1729
|
+
prerequisites: ["chainId", "symbol from ctm_gmx_fetch_markets", "collateralSymbol e.g. USDC"],
|
|
1730
|
+
followUp: ["ctm_gmx_fetch_ohlcv", "ctm_gmx_build_increase_multisign"],
|
|
1731
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchMarketPrices" },
|
|
1732
|
+
inputZod: mcpGmxFetchMarketPricesInputSchema,
|
|
1733
|
+
outputZod: mcpGmxFetchMarketPricesOutputSchema
|
|
1734
|
+
}),
|
|
1735
|
+
defineMcpTool({
|
|
1736
|
+
name: "ctm_gmx_fetch_ohlcv",
|
|
1737
|
+
actionId: "gmx.fetch-ohlcv",
|
|
1738
|
+
protocolId: "gmx",
|
|
1739
|
+
chainCategory: "evm",
|
|
1740
|
+
description: "OHLCV candle table for a GMX perp index (USD). Default timeframe 15m. Read-only via GMX HTTP API.",
|
|
1741
|
+
prerequisites: ["chainId", "symbol from ctm_gmx_fetch_markets"],
|
|
1742
|
+
followUp: ["ctm_gmx_fetch_market_prices"],
|
|
1743
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchOhlcv" },
|
|
1744
|
+
inputZod: mcpGmxFetchOhlcvInputSchema,
|
|
1745
|
+
outputZod: mcpGmxFetchOhlcvOutputSchema
|
|
1746
|
+
}),
|
|
1747
|
+
defineMcpTool({
|
|
1748
|
+
name: "ctm_gmx_fetch_gm_markets",
|
|
1749
|
+
actionId: "gmx.fetch-gm-markets",
|
|
1750
|
+
protocolId: "gmx",
|
|
1751
|
+
chainCategory: "evm",
|
|
1752
|
+
description: "List GMX GM liquidity pool markets with long/short collateral symbols and estimated APY. Read-only.",
|
|
1753
|
+
prerequisites: ["chainId"],
|
|
1754
|
+
followUp: ["ctm_gmx_build_gm_deposit_multisign", "ctm_gmx_build_gm_withdraw_multisign"],
|
|
1755
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchGmMarkets" },
|
|
1756
|
+
inputZod: mcpGmxFetchGmMarketsInputSchema,
|
|
1757
|
+
outputZod: mcpGmxFetchGmMarketsOutputSchema
|
|
1758
|
+
}),
|
|
1759
|
+
defineMcpTool({
|
|
1760
|
+
name: "ctm_gmx_fetch_gm_apy",
|
|
1761
|
+
actionId: "gmx.fetch-gm-apy",
|
|
1762
|
+
protocolId: "gmx",
|
|
1763
|
+
chainCategory: "evm",
|
|
1764
|
+
description: "Fetch estimated GM liquidity pool APY for each GMX market (sorted highest first). Read-only.",
|
|
1765
|
+
prerequisites: ["chainId"],
|
|
1766
|
+
followUp: ["ctm_gmx_build_gm_deposit_multisign", "ctm_gmx_fetch_gm_markets"],
|
|
1767
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchGmApy" },
|
|
1768
|
+
inputZod: mcpGmxFetchGmApyInputSchema,
|
|
1769
|
+
outputZod: mcpGmxFetchGmApyOutputSchema
|
|
1770
|
+
}),
|
|
1771
|
+
defineMcpTool({
|
|
1772
|
+
name: "ctm_gmx_fetch_staking_power",
|
|
1773
|
+
actionId: "gmx.fetch-staking-power",
|
|
1774
|
+
protocolId: "gmx",
|
|
1775
|
+
chainCategory: "evm",
|
|
1776
|
+
description: "Fetch GMX token staking power for an executor address. Read-only.",
|
|
1777
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
1778
|
+
followUp: ["ctm_gmx_build_stake_gmx_multisign", "ctm_gmx_build_unstake_gmx_multisign"],
|
|
1779
|
+
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchStakingPower" },
|
|
1780
|
+
inputZod: mcpGmxFetchStakingPowerInputSchema,
|
|
1781
|
+
outputZod: mcpGmxFetchStakingPowerOutputSchema
|
|
1429
1782
|
})
|
|
1430
1783
|
];
|
|
1431
1784
|
var MCP_TOOL_DEFINITIONS = [
|
|
@@ -1817,6 +2170,231 @@ var eulerV2ProtocolModule = {
|
|
|
1817
2170
|
]
|
|
1818
2171
|
};
|
|
1819
2172
|
registerProtocolModule(eulerV2ProtocolModule);
|
|
2173
|
+
|
|
2174
|
+
// src/protocols/evm/gmx/support.ts
|
|
2175
|
+
var GMX_SUPPORTED_CHAIN_IDS = [42161, 43114];
|
|
2176
|
+
function isGmxChainSupported(chainId) {
|
|
2177
|
+
return GMX_SUPPORTED_CHAIN_IDS.includes(chainId);
|
|
2178
|
+
}
|
|
2179
|
+
var require2 = module$1.createRequire(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href))));
|
|
2180
|
+
var { GmxApiSdk } = require2("@gmx-io/sdk/v2");
|
|
2181
|
+
var GMX_HTTP_TIMEOUT_MS = 3e4;
|
|
2182
|
+
var GMX_API_BASE_URLS = {
|
|
2183
|
+
42161: ["https://arbitrum.gmxapi.io/v1", "https://arbitrum.gmxapi.ai/v1"],
|
|
2184
|
+
43114: ["https://avalanche.gmxapi.io/v1", "https://avalanche.gmxapi.ai/v1"]
|
|
2185
|
+
};
|
|
2186
|
+
function buildGmxUrl(baseUrl, path, query) {
|
|
2187
|
+
const base = baseUrl.replace(/\/$/, "");
|
|
2188
|
+
if (!query) return `${base}${path}`;
|
|
2189
|
+
const params = new URLSearchParams();
|
|
2190
|
+
for (const [key, value] of Object.entries(query)) {
|
|
2191
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
2192
|
+
}
|
|
2193
|
+
const qs = params.toString();
|
|
2194
|
+
return qs ? `${base}${path}?${qs}` : `${base}${path}`;
|
|
2195
|
+
}
|
|
2196
|
+
function bigintReplacer(_key, value) {
|
|
2197
|
+
return typeof value === "bigint" ? value.toString() : value;
|
|
2198
|
+
}
|
|
2199
|
+
async function gmxHttpFetchJson(baseUrl, path, opts) {
|
|
2200
|
+
const url = buildGmxUrl(baseUrl, path, opts?.query);
|
|
2201
|
+
const controller = new AbortController();
|
|
2202
|
+
const timeoutId = setTimeout(() => controller.abort(), GMX_HTTP_TIMEOUT_MS);
|
|
2203
|
+
try {
|
|
2204
|
+
const response = await fetch(url, {
|
|
2205
|
+
headers: { Accept: "application/json" },
|
|
2206
|
+
signal: controller.signal
|
|
2207
|
+
});
|
|
2208
|
+
if (!response.ok) {
|
|
2209
|
+
let message = `HTTP ${response.status}: ${response.statusText}`;
|
|
2210
|
+
try {
|
|
2211
|
+
const body = await response.json();
|
|
2212
|
+
if (body?.message) message = `HTTP ${response.status}: ${body.message}`;
|
|
2213
|
+
} catch {
|
|
2214
|
+
}
|
|
2215
|
+
throw new Error(`${message} (${url})`);
|
|
2216
|
+
}
|
|
2217
|
+
const json = await response.json();
|
|
2218
|
+
return opts?.transform ? opts.transform(json) : json;
|
|
2219
|
+
} finally {
|
|
2220
|
+
clearTimeout(timeoutId);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
async function gmxHttpPostJson(baseUrl, path, body, opts) {
|
|
2224
|
+
const url = buildGmxUrl(baseUrl, path);
|
|
2225
|
+
const controller = new AbortController();
|
|
2226
|
+
const timeoutId = setTimeout(() => controller.abort(), GMX_HTTP_TIMEOUT_MS);
|
|
2227
|
+
try {
|
|
2228
|
+
const response = await fetch(url, {
|
|
2229
|
+
method: "POST",
|
|
2230
|
+
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
2231
|
+
body: JSON.stringify(body, bigintReplacer),
|
|
2232
|
+
signal: controller.signal
|
|
2233
|
+
});
|
|
2234
|
+
if (!response.ok) {
|
|
2235
|
+
let message = `HTTP ${response.status}: ${response.statusText}`;
|
|
2236
|
+
try {
|
|
2237
|
+
const errBody = await response.json();
|
|
2238
|
+
if (errBody?.message) message = `HTTP ${response.status}: ${errBody.message}`;
|
|
2239
|
+
} catch {
|
|
2240
|
+
}
|
|
2241
|
+
throw new Error(`${message} (${url})`);
|
|
2242
|
+
}
|
|
2243
|
+
const json = await response.json();
|
|
2244
|
+
return opts?.transform ? opts.transform(json) : json;
|
|
2245
|
+
} finally {
|
|
2246
|
+
clearTimeout(timeoutId);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
function createIoFirstGmxHttpApi(chainId) {
|
|
2250
|
+
const urls = GMX_API_BASE_URLS[chainId];
|
|
2251
|
+
if (!urls) {
|
|
2252
|
+
throw new Error(`GMX API URLs are not configured for chain ${chainId}.`);
|
|
2253
|
+
}
|
|
2254
|
+
async function withIoFirstFallback(fn) {
|
|
2255
|
+
let lastError;
|
|
2256
|
+
for (const baseUrl of urls) {
|
|
2257
|
+
try {
|
|
2258
|
+
return await fn(baseUrl);
|
|
2259
|
+
} catch (e) {
|
|
2260
|
+
lastError = e;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
const detail = lastError instanceof Error ? lastError.message : String(lastError);
|
|
2264
|
+
throw new Error(
|
|
2265
|
+
`GMX API request failed on all endpoints (${urls.join(", ")}). Last error: ${detail}`
|
|
2266
|
+
);
|
|
2267
|
+
}
|
|
2268
|
+
return {
|
|
2269
|
+
fetchJson: (path, opts) => withIoFirstFallback((baseUrl) => gmxHttpFetchJson(baseUrl, path, opts)),
|
|
2270
|
+
postJson: (path, body, opts) => withIoFirstFallback((baseUrl) => gmxHttpPostJson(baseUrl, path, body, opts))
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
var sdkByChain = /* @__PURE__ */ new Map();
|
|
2274
|
+
function getGmxApiSdk(chainId) {
|
|
2275
|
+
if (!isGmxChainSupported(chainId)) {
|
|
2276
|
+
throw new Error(`GMX is not supported on chain ${chainId}. Supported: 42161 (Arbitrum), 43114 (Avalanche).`);
|
|
2277
|
+
}
|
|
2278
|
+
let sdk = sdkByChain.get(chainId);
|
|
2279
|
+
if (!sdk) {
|
|
2280
|
+
sdk = new GmxApiSdk({ chainId, api: createIoFirstGmxHttpApi(chainId) });
|
|
2281
|
+
sdkByChain.set(chainId, sdk);
|
|
2282
|
+
}
|
|
2283
|
+
return sdk;
|
|
2284
|
+
}
|
|
2285
|
+
async function gmxFetchTokens(chainId) {
|
|
2286
|
+
const sdk = getGmxApiSdk(chainId);
|
|
2287
|
+
return sdk.fetchTokens();
|
|
2288
|
+
}
|
|
2289
|
+
async function gmxFetchCollateralTokens(args) {
|
|
2290
|
+
const tokens = await gmxFetchTokens(args.chainId);
|
|
2291
|
+
return tokens.map((t) => ({
|
|
2292
|
+
symbol: t.symbol,
|
|
2293
|
+
address: t.address,
|
|
2294
|
+
decimals: t.decimals
|
|
2295
|
+
}));
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
// src/protocols/evm/gmx/index.ts
|
|
2299
|
+
var GMX_PROTOCOL_ID = "gmx";
|
|
2300
|
+
var gmxProtocolModule = {
|
|
2301
|
+
id: GMX_PROTOCOL_ID,
|
|
2302
|
+
chainCategory: "evm",
|
|
2303
|
+
isChainSupported(ctx) {
|
|
2304
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
2305
|
+
const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
|
|
2306
|
+
return Number.isFinite(chainId) && isGmxChainSupported(chainId);
|
|
2307
|
+
},
|
|
2308
|
+
isTokenSupported(token) {
|
|
2309
|
+
if (token.category !== "evm") return false;
|
|
2310
|
+
return token.kind === "erc20";
|
|
2311
|
+
},
|
|
2312
|
+
actions: [
|
|
2313
|
+
{
|
|
2314
|
+
id: "gmx.increase",
|
|
2315
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2316
|
+
chainCategory: "evm",
|
|
2317
|
+
description: "Open or add to a GMX perp position (classic on-chain order)",
|
|
2318
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2319
|
+
params: {
|
|
2320
|
+
symbol: { type: "string", required: true, description: "GMX market symbol e.g. ETH/USD [WETH-USDC]" },
|
|
2321
|
+
direction: { type: "string", required: true, description: "long or short" },
|
|
2322
|
+
orderType: { type: "string", required: true, description: "market or limit" },
|
|
2323
|
+
sizeUsdHuman: { type: "string", required: true, description: "Position size in USD" },
|
|
2324
|
+
collateralToken: { type: "string", required: true, description: "Collateral token symbol e.g. USDC" },
|
|
2325
|
+
collateralAmountHuman: { type: "string", required: true, description: "Collateral amount in token units" }
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
{
|
|
2329
|
+
id: "gmx.decrease",
|
|
2330
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2331
|
+
chainCategory: "evm",
|
|
2332
|
+
description: "Close or reduce a GMX perp position (classic on-chain order)",
|
|
2333
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2334
|
+
params: {
|
|
2335
|
+
symbol: { type: "string", required: true, description: "GMX market symbol" },
|
|
2336
|
+
direction: { type: "string", required: true, description: "long or short" },
|
|
2337
|
+
orderType: { type: "string", required: true, description: "market or limit" },
|
|
2338
|
+
sizeUsdHuman: { type: "string", required: true, description: "Size to close in USD" },
|
|
2339
|
+
collateralToken: { type: "string", required: true, description: "Position collateral token symbol" }
|
|
2340
|
+
}
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
id: "gmx.cancel",
|
|
2344
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2345
|
+
chainCategory: "evm",
|
|
2346
|
+
description: "Cancel a pending GMX order (classic on-chain)",
|
|
2347
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2348
|
+
params: {
|
|
2349
|
+
orderId: { type: "string", required: true, description: "Order key from fetchOrders" }
|
|
2350
|
+
}
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
id: "gmx.gmDeposit",
|
|
2354
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2355
|
+
chainCategory: "evm",
|
|
2356
|
+
description: "Deposit collateral into a GMX GM liquidity pool (ExchangeRouter multicall)",
|
|
2357
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2358
|
+
params: {
|
|
2359
|
+
marketSymbol: { type: "string", required: true, description: "GM market symbol e.g. ETH/USD [WETH-USDC]" },
|
|
2360
|
+
collateralToken: { type: "string", required: true, description: "Pool collateral token symbol" },
|
|
2361
|
+
collateralAmountHuman: { type: "string", required: true, description: "Amount in token units" }
|
|
2362
|
+
}
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
id: "gmx.gmWithdraw",
|
|
2366
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2367
|
+
chainCategory: "evm",
|
|
2368
|
+
description: "Withdraw GM market tokens from a GMX liquidity pool",
|
|
2369
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2370
|
+
params: {
|
|
2371
|
+
marketSymbol: { type: "string", required: true, description: "GM market symbol" },
|
|
2372
|
+
gmAmountHuman: { type: "string", required: true, description: "GM token amount to withdraw" }
|
|
2373
|
+
}
|
|
2374
|
+
},
|
|
2375
|
+
{
|
|
2376
|
+
id: "gmx.stakeGmx",
|
|
2377
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2378
|
+
chainCategory: "evm",
|
|
2379
|
+
description: "Stake GMX tokens via RewardRouter",
|
|
2380
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2381
|
+
params: {
|
|
2382
|
+
amountHuman: { type: "string", required: true, description: "GMX amount to stake" }
|
|
2383
|
+
}
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
id: "gmx.unstakeGmx",
|
|
2387
|
+
protocolId: GMX_PROTOCOL_ID,
|
|
2388
|
+
chainCategory: "evm",
|
|
2389
|
+
description: "Unstake GMX tokens via RewardRouter",
|
|
2390
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
2391
|
+
params: {
|
|
2392
|
+
amountHuman: { type: "string", required: true, description: "GMX amount to unstake" }
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
]
|
|
2396
|
+
};
|
|
2397
|
+
registerProtocolModule(gmxProtocolModule);
|
|
1820
2398
|
var skillsDir = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href)))), "skills");
|
|
1821
2399
|
var SKILL_PROTOCOL_IDS = [
|
|
1822
2400
|
"aave-v4",
|
|
@@ -1826,7 +2404,8 @@ var SKILL_PROTOCOL_IDS = [
|
|
|
1826
2404
|
"ethena",
|
|
1827
2405
|
"euler-v2",
|
|
1828
2406
|
"maple-syrup",
|
|
1829
|
-
"sky"
|
|
2407
|
+
"sky",
|
|
2408
|
+
"gmx"
|
|
1830
2409
|
];
|
|
1831
2410
|
function getToolsForProtocol(protocolId) {
|
|
1832
2411
|
return MCP_TOOL_DEFINITIONS.filter((t) => t.protocolId === protocolId);
|
|
@@ -2058,6 +2637,35 @@ var PROTOCOL_SUPPORT_ADVISORS = {
|
|
|
2058
2637
|
notes: "Sky Lockstake and sUSDS use fixed mainnet contract addresses in protocol builders."
|
|
2059
2638
|
};
|
|
2060
2639
|
}
|
|
2640
|
+
}),
|
|
2641
|
+
[GMX_PROTOCOL_ID]: advisor(GMX_PROTOCOL_ID, "api_underlyings", {
|
|
2642
|
+
async supportedChainIds() {
|
|
2643
|
+
return [42161, 43114];
|
|
2644
|
+
},
|
|
2645
|
+
async supportedTokens(chainId) {
|
|
2646
|
+
if (!isGmxChainSupported(chainId)) {
|
|
2647
|
+
return { tokens: [], notes: "GMX v1 supports Arbitrum (42161) and Avalanche (43114)." };
|
|
2648
|
+
}
|
|
2649
|
+
const tokens = await gmxFetchCollateralTokens({ chainId });
|
|
2650
|
+
return {
|
|
2651
|
+
tokens: tokens.map((t) => ({
|
|
2652
|
+
address: t.address,
|
|
2653
|
+
symbol: t.symbol,
|
|
2654
|
+
roles: ["collateral"]
|
|
2655
|
+
})),
|
|
2656
|
+
notes: "Collateral ERC-20 tokens from GMX API. Perp markets listed via fetch_markets."
|
|
2657
|
+
};
|
|
2658
|
+
},
|
|
2659
|
+
async isTokenSupported(chainId, address) {
|
|
2660
|
+
if (!isGmxChainSupported(chainId)) return false;
|
|
2661
|
+
const tokens = await gmxFetchCollateralTokens({ chainId });
|
|
2662
|
+
try {
|
|
2663
|
+
const normalized = viem.getAddress(address).toLowerCase();
|
|
2664
|
+
return tokens.some((t) => t.address.toLowerCase() === normalized);
|
|
2665
|
+
} catch {
|
|
2666
|
+
return false;
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2061
2669
|
})
|
|
2062
2670
|
};
|
|
2063
2671
|
function getProtocolSupportAdvisor(protocolId) {
|
|
@@ -2092,6 +2700,7 @@ registerProtocolModule(mapleProtocolModule);
|
|
|
2092
2700
|
registerProtocolModule(skyProtocolModule);
|
|
2093
2701
|
registerProtocolModule(aaveV4ProtocolModule);
|
|
2094
2702
|
registerProtocolModule(eulerV2ProtocolModule);
|
|
2703
|
+
registerProtocolModule(gmxProtocolModule);
|
|
2095
2704
|
function getAgentCatalog() {
|
|
2096
2705
|
return {
|
|
2097
2706
|
protocols: getProtocolModules(),
|
|
@@ -2108,6 +2717,7 @@ function getAgentCatalog() {
|
|
|
2108
2717
|
sky: skyProtocolModule,
|
|
2109
2718
|
aaveV4: aaveV4ProtocolModule,
|
|
2110
2719
|
eulerV2: eulerV2ProtocolModule,
|
|
2720
|
+
gmx: gmxProtocolModule,
|
|
2111
2721
|
/** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
|
|
2112
2722
|
mcp: getAgentCatalogForMcp()
|
|
2113
2723
|
};
|
|
@@ -2157,6 +2767,28 @@ exports.mcpEulerV2CollateralWithdrawInputSchema = mcpEulerV2CollateralWithdrawIn
|
|
|
2157
2767
|
exports.mcpEulerV2IsolatedBorrowInputSchema = mcpEulerV2IsolatedBorrowInputSchema;
|
|
2158
2768
|
exports.mcpEulerV2IsolatedLendInputSchema = mcpEulerV2IsolatedLendInputSchema;
|
|
2159
2769
|
exports.mcpEulerV2VaultWithdrawInputSchema = mcpEulerV2VaultWithdrawInputSchema;
|
|
2770
|
+
exports.mcpGmxCancelInputSchema = mcpGmxCancelInputSchema;
|
|
2771
|
+
exports.mcpGmxDecreaseInputSchema = mcpGmxDecreaseInputSchema;
|
|
2772
|
+
exports.mcpGmxFetchGmApyInputSchema = mcpGmxFetchGmApyInputSchema;
|
|
2773
|
+
exports.mcpGmxFetchGmApyOutputSchema = mcpGmxFetchGmApyOutputSchema;
|
|
2774
|
+
exports.mcpGmxFetchGmMarketsInputSchema = mcpGmxFetchGmMarketsInputSchema;
|
|
2775
|
+
exports.mcpGmxFetchGmMarketsOutputSchema = mcpGmxFetchGmMarketsOutputSchema;
|
|
2776
|
+
exports.mcpGmxFetchMarketPricesInputSchema = mcpGmxFetchMarketPricesInputSchema;
|
|
2777
|
+
exports.mcpGmxFetchMarketPricesOutputSchema = mcpGmxFetchMarketPricesOutputSchema;
|
|
2778
|
+
exports.mcpGmxFetchMarketsInputSchema = mcpGmxFetchMarketsInputSchema;
|
|
2779
|
+
exports.mcpGmxFetchMarketsOutputSchema = mcpGmxFetchMarketsOutputSchema;
|
|
2780
|
+
exports.mcpGmxFetchOhlcvInputSchema = mcpGmxFetchOhlcvInputSchema;
|
|
2781
|
+
exports.mcpGmxFetchOhlcvOutputSchema = mcpGmxFetchOhlcvOutputSchema;
|
|
2782
|
+
exports.mcpGmxFetchPositionsInputSchema = mcpGmxFetchPositionsInputSchema;
|
|
2783
|
+
exports.mcpGmxFetchPositionsOutputSchema = mcpGmxFetchPositionsOutputSchema;
|
|
2784
|
+
exports.mcpGmxFetchStakingPowerInputSchema = mcpGmxFetchStakingPowerInputSchema;
|
|
2785
|
+
exports.mcpGmxFetchStakingPowerOutputSchema = mcpGmxFetchStakingPowerOutputSchema;
|
|
2786
|
+
exports.mcpGmxGmDepositInputSchema = mcpGmxGmDepositInputSchema;
|
|
2787
|
+
exports.mcpGmxGmWithdrawInputSchema = mcpGmxGmWithdrawInputSchema;
|
|
2788
|
+
exports.mcpGmxIncreaseInputSchema = mcpGmxIncreaseInputSchema;
|
|
2789
|
+
exports.mcpGmxMultisignOutputSchema = multisignOutputSchema;
|
|
2790
|
+
exports.mcpGmxStakeGmxInputSchema = mcpGmxStakeGmxInputSchema;
|
|
2791
|
+
exports.mcpGmxUnstakeGmxInputSchema = mcpGmxUnstakeGmxInputSchema;
|
|
2160
2792
|
exports.mcpLidoClaimWithdrawalInputSchema = mcpLidoClaimWithdrawalInputSchema;
|
|
2161
2793
|
exports.mcpLidoRequestWithdrawalsInputSchema = mcpLidoRequestWithdrawalsInputSchema;
|
|
2162
2794
|
exports.mcpLidoSubmitInputSchema = mcpLidoSubmitInputSchema;
|
|
@@ -2191,6 +2823,8 @@ exports.mcpUniswapV4LpDecreaseInputSchema = mcpUniswapV4LpDecreaseInputSchema;
|
|
|
2191
2823
|
exports.mcpUniswapV4LpDecreaseOutputSchema = mcpUniswapV4LpDecreaseOutputSchema;
|
|
2192
2824
|
exports.mcpUniswapV4LpIncreaseInputSchema = mcpUniswapV4LpIncreaseInputSchema;
|
|
2193
2825
|
exports.mcpUniswapV4LpIncreaseOutputSchema = mcpUniswapV4LpIncreaseOutputSchema;
|
|
2826
|
+
exports.mcpUniswapV4LpListPoolsInputSchema = mcpUniswapV4LpListPoolsInputSchema;
|
|
2827
|
+
exports.mcpUniswapV4LpListPoolsOutputSchema = mcpUniswapV4LpListPoolsOutputSchema;
|
|
2194
2828
|
exports.mcpUniswapV4LpListPositionsInputSchema = mcpUniswapV4LpListPositionsInputSchema;
|
|
2195
2829
|
exports.mcpUniswapV4LpListPositionsOutputSchema = mcpUniswapV4LpListPositionsOutputSchema;
|
|
2196
2830
|
exports.mcpUniswapV4QuoteInputSchema = mcpUniswapV4QuoteInputSchema;
|