@continuumdao/ctm-mpc-defi 0.2.8 → 0.2.10
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 +1133 -2
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1268 -9
- package/dist/agent/catalog.js +1091 -3
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/hyperliquid/SKILL.md +205 -0
- package/dist/agent/skills/morpho/SKILL.md +48 -0
- package/dist/core/index.cjs +9 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.js +8 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +1550 -0
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -0
- package/dist/protocols/evm/hyperliquid/index.d.ts +668 -0
- package/dist/protocols/evm/hyperliquid/index.js +1464 -0
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -0
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +1971 -0
- package/dist/protocols/evm/morpho/index.cjs.map +1 -0
- package/dist/protocols/evm/morpho/index.d.ts +522 -0
- package/dist/protocols/evm/morpho/index.js +1918 -0
- package/dist/protocols/evm/morpho/index.js.map +1 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/package.json +11 -1
package/dist/agent/catalog.cjs
CHANGED
|
@@ -927,6 +927,74 @@ var mcpEulerV2CollateralWithdrawInputSchema = mcpMultisignInput({
|
|
|
927
927
|
collateralAsset: evmAddressSchema,
|
|
928
928
|
amountHuman: zod.z.string().min(1)
|
|
929
929
|
});
|
|
930
|
+
var mcpMorphoVaultDepositInputSchema = mcpMultisignInput({
|
|
931
|
+
vault: evmAddressSchema,
|
|
932
|
+
underlying: evmAddressSchema.describe("Underlying asset; use wrapped native with isNativeIn for ETH."),
|
|
933
|
+
amountHuman: zod.z.string().min(1),
|
|
934
|
+
isNativeIn: zod.z.boolean().optional()
|
|
935
|
+
});
|
|
936
|
+
var mcpMorphoVaultWithdrawInputSchema = mcpMultisignInput({
|
|
937
|
+
vault: evmAddressSchema,
|
|
938
|
+
amountHuman: zod.z.string().min(1)
|
|
939
|
+
});
|
|
940
|
+
var mcpMorphoBlueCollateralDepositInputSchema = mcpMultisignInput({
|
|
941
|
+
marketId: zod.z.string().min(1).describe("Morpho Blue marketId from API."),
|
|
942
|
+
collateralToken: evmAddressSchema,
|
|
943
|
+
amountHuman: zod.z.string().min(1),
|
|
944
|
+
isNativeIn: zod.z.boolean().optional()
|
|
945
|
+
});
|
|
946
|
+
var mcpMorphoBlueBorrowInputSchema = mcpMultisignInput({
|
|
947
|
+
marketId: zod.z.string().min(1),
|
|
948
|
+
loanToken: evmAddressSchema,
|
|
949
|
+
amountHuman: zod.z.string().min(1)
|
|
950
|
+
});
|
|
951
|
+
var mcpMorphoBlueRepayInputSchema = mcpMultisignInput({
|
|
952
|
+
marketId: zod.z.string().min(1),
|
|
953
|
+
loanToken: evmAddressSchema,
|
|
954
|
+
amountHuman: zod.z.string().min(1)
|
|
955
|
+
});
|
|
956
|
+
var mcpMorphoBlueCollateralWithdrawInputSchema = mcpMultisignInput({
|
|
957
|
+
marketId: zod.z.string().min(1),
|
|
958
|
+
amountHuman: zod.z.string().min(1),
|
|
959
|
+
collateralDecimals: zod.z.number().int().min(0).max(36).optional()
|
|
960
|
+
});
|
|
961
|
+
var mcpMorphoMerklClaimInputSchema = mcpMultisignInput({
|
|
962
|
+
claimData: zod.z.string().min(1).describe("Hex calldata for Merkl Distributor.claim from Merkl API."),
|
|
963
|
+
distributor: evmAddressSchema.optional(),
|
|
964
|
+
valueWei: zod.z.string().optional()
|
|
965
|
+
});
|
|
966
|
+
var morphoExposureRowSchema = zod.z.object({
|
|
967
|
+
label: zod.z.string(),
|
|
968
|
+
allocatedUsdLabel: zod.z.string(),
|
|
969
|
+
allocationPercentLabel: zod.z.string()
|
|
970
|
+
});
|
|
971
|
+
var mcpMorphoFetchEarnVaultsInputSchema = zod.z.object({
|
|
972
|
+
chainId: zod.z.number().int().positive(),
|
|
973
|
+
underlying: zod.z.string().trim().min(1).optional().describe("Deposit asset symbol (e.g. USDC) or ERC-20 address. Omit to search all listed vaults on the chain."),
|
|
974
|
+
query: zod.z.string().trim().min(1).optional().describe("Case-insensitive filter on vault name, symbol, address, or underlying symbol (e.g. Steakhouse, bbqUSDC)."),
|
|
975
|
+
limit: zod.z.number().int().min(1).max(200).optional().describe("Max rows (default 50).")
|
|
976
|
+
});
|
|
977
|
+
var mcpMorphoFetchEarnVaultsOutputSchema = zod.z.object({
|
|
978
|
+
vaults: zod.z.array(
|
|
979
|
+
zod.z.object({
|
|
980
|
+
vaultAddress: zod.z.string(),
|
|
981
|
+
vaultName: zod.z.string(),
|
|
982
|
+
vaultSymbol: zod.z.string(),
|
|
983
|
+
underlyingAddress: zod.z.string(),
|
|
984
|
+
underlyingSymbol: zod.z.string(),
|
|
985
|
+
apy: zod.z.string(),
|
|
986
|
+
netApy: zod.z.string(),
|
|
987
|
+
netApy7d: zod.z.string(),
|
|
988
|
+
netApy30d: zod.z.string(),
|
|
989
|
+
netApy90d: zod.z.string(),
|
|
990
|
+
performanceFee: zod.z.string(),
|
|
991
|
+
managementFee: zod.z.string().nullable(),
|
|
992
|
+
totalDepositsUsd: zod.z.string(),
|
|
993
|
+
liquidityUsd: zod.z.string(),
|
|
994
|
+
exposure: zod.z.array(morphoExposureRowSchema)
|
|
995
|
+
})
|
|
996
|
+
)
|
|
997
|
+
});
|
|
930
998
|
function mcpGmxMultisignInput(fields) {
|
|
931
999
|
return evmMultisignCommonInputSchema.extend(fields);
|
|
932
1000
|
}
|
|
@@ -1075,6 +1143,311 @@ var mcpGmxFetchOhlcvOutputSchema = zod.z.object({
|
|
|
1075
1143
|
timeframe: gmxOhlcvTimeframeSchema,
|
|
1076
1144
|
candles: zod.z.array(gmxOhlcvCandleSchema)
|
|
1077
1145
|
});
|
|
1146
|
+
function mcpHyperliquidMultisignInput(fields) {
|
|
1147
|
+
return evmMultisignCommonInputSchema.extend(fields);
|
|
1148
|
+
}
|
|
1149
|
+
var hyperliquidTifSchema = zod.z.enum(["alo", "gtc", "ioc"]);
|
|
1150
|
+
var hyperliquidOhlcvIntervalSchema = zod.z.enum([
|
|
1151
|
+
"1m",
|
|
1152
|
+
"3m",
|
|
1153
|
+
"5m",
|
|
1154
|
+
"15m",
|
|
1155
|
+
"30m",
|
|
1156
|
+
"1h",
|
|
1157
|
+
"2h",
|
|
1158
|
+
"4h",
|
|
1159
|
+
"8h",
|
|
1160
|
+
"12h",
|
|
1161
|
+
"1d",
|
|
1162
|
+
"3d",
|
|
1163
|
+
"1w",
|
|
1164
|
+
"1M"
|
|
1165
|
+
]);
|
|
1166
|
+
var hyperliquidPositionRowSchema = zod.z.object({
|
|
1167
|
+
key: zod.z.string(),
|
|
1168
|
+
coin: zod.z.string(),
|
|
1169
|
+
isLong: zod.z.boolean(),
|
|
1170
|
+
size: zod.z.string().nullable(),
|
|
1171
|
+
entryPx: zod.z.string().nullable(),
|
|
1172
|
+
positionValueUsd: zod.z.string().nullable(),
|
|
1173
|
+
unrealizedPnlUsd: zod.z.string().nullable(),
|
|
1174
|
+
liquidationPx: zod.z.string().nullable(),
|
|
1175
|
+
leverageLabel: zod.z.string().nullable(),
|
|
1176
|
+
maxLeverage: zod.z.number().nullable(),
|
|
1177
|
+
marginUsedUsd: zod.z.string().nullable(),
|
|
1178
|
+
returnOnEquity: zod.z.string().nullable()
|
|
1179
|
+
});
|
|
1180
|
+
var hyperliquidActiveAssetSchema = zod.z.object({
|
|
1181
|
+
markPx: zod.z.string().nullable(),
|
|
1182
|
+
leverageLabel: zod.z.string().nullable(),
|
|
1183
|
+
availableToBuy: zod.z.string().nullable(),
|
|
1184
|
+
availableToSell: zod.z.string().nullable()
|
|
1185
|
+
});
|
|
1186
|
+
var hyperliquidAccountSummarySchema = zod.z.object({
|
|
1187
|
+
accountValueUsd: zod.z.string().nullable(),
|
|
1188
|
+
totalMarginUsedUsd: zod.z.string().nullable(),
|
|
1189
|
+
withdrawableUsd: zod.z.string().nullable()
|
|
1190
|
+
});
|
|
1191
|
+
var mcpHyperliquidFetchMarketsInputSchema = zod.z.object({
|
|
1192
|
+
chainId: zod.z.number().int().positive(),
|
|
1193
|
+
dex: zod.z.string().optional()
|
|
1194
|
+
});
|
|
1195
|
+
var mcpHyperliquidFetchMarketsOutputSchema = zod.z.object({
|
|
1196
|
+
markets: zod.z.array(
|
|
1197
|
+
zod.z.object({
|
|
1198
|
+
name: zod.z.string(),
|
|
1199
|
+
asset: zod.z.number(),
|
|
1200
|
+
szDecimals: zod.z.number(),
|
|
1201
|
+
maxLeverage: zod.z.number(),
|
|
1202
|
+
onlyIsolated: zod.z.boolean().optional(),
|
|
1203
|
+
dex: zod.z.string().optional()
|
|
1204
|
+
})
|
|
1205
|
+
),
|
|
1206
|
+
dexes: zod.z.array(
|
|
1207
|
+
zod.z.object({
|
|
1208
|
+
name: zod.z.string(),
|
|
1209
|
+
fullName: zod.z.string()
|
|
1210
|
+
})
|
|
1211
|
+
)
|
|
1212
|
+
});
|
|
1213
|
+
var mcpHyperliquidSearchMarketsInputSchema = zod.z.object({
|
|
1214
|
+
chainId: zod.z.number().int().positive(),
|
|
1215
|
+
query: zod.z.string().min(1),
|
|
1216
|
+
dex: zod.z.string().optional(),
|
|
1217
|
+
limit: zod.z.number().int().positive().max(50).optional()
|
|
1218
|
+
});
|
|
1219
|
+
var mcpHyperliquidSearchMarketsOutputSchema = zod.z.object({
|
|
1220
|
+
matches: zod.z.array(
|
|
1221
|
+
zod.z.object({
|
|
1222
|
+
coin: zod.z.string(),
|
|
1223
|
+
symbol: zod.z.string(),
|
|
1224
|
+
dex: zod.z.string().optional(),
|
|
1225
|
+
asset: zod.z.number(),
|
|
1226
|
+
szDecimals: zod.z.number(),
|
|
1227
|
+
maxLeverage: zod.z.number(),
|
|
1228
|
+
onlyIsolated: zod.z.boolean().optional(),
|
|
1229
|
+
displayName: zod.z.string().optional(),
|
|
1230
|
+
category: zod.z.string().optional(),
|
|
1231
|
+
keywords: zod.z.array(zod.z.string()).optional(),
|
|
1232
|
+
matchScore: zod.z.number(),
|
|
1233
|
+
matchReason: zod.z.string()
|
|
1234
|
+
})
|
|
1235
|
+
)
|
|
1236
|
+
});
|
|
1237
|
+
var mcpHyperliquidFetchOpenContextInputSchema = zod.z.object({
|
|
1238
|
+
chainId: zod.z.number().int().positive(),
|
|
1239
|
+
executorAddress: evmAddressSchema,
|
|
1240
|
+
coin: zod.z.string().min(1),
|
|
1241
|
+
dex: zod.z.string().optional()
|
|
1242
|
+
});
|
|
1243
|
+
var mcpHyperliquidFetchOpenContextOutputSchema = zod.z.object({
|
|
1244
|
+
context: zod.z.object({
|
|
1245
|
+
account: hyperliquidAccountSummarySchema,
|
|
1246
|
+
activeAsset: hyperliquidActiveAssetSchema
|
|
1247
|
+
})
|
|
1248
|
+
});
|
|
1249
|
+
var mcpHyperliquidFetchPositionsInputSchema = zod.z.object({
|
|
1250
|
+
chainId: zod.z.number().int().positive(),
|
|
1251
|
+
executorAddress: evmAddressSchema,
|
|
1252
|
+
dex: zod.z.string().optional()
|
|
1253
|
+
});
|
|
1254
|
+
var mcpHyperliquidFetchPositionsOutputSchema = zod.z.object({
|
|
1255
|
+
positions: zod.z.array(hyperliquidPositionRowSchema)
|
|
1256
|
+
});
|
|
1257
|
+
var mcpHyperliquidFetchOpenOrdersInputSchema = zod.z.object({
|
|
1258
|
+
chainId: zod.z.number().int().positive(),
|
|
1259
|
+
executorAddress: evmAddressSchema,
|
|
1260
|
+
dex: zod.z.string().optional()
|
|
1261
|
+
});
|
|
1262
|
+
var mcpHyperliquidFetchOpenOrdersOutputSchema = zod.z.object({
|
|
1263
|
+
orders: zod.z.array(
|
|
1264
|
+
zod.z.object({
|
|
1265
|
+
coin: zod.z.string(),
|
|
1266
|
+
side: zod.z.string(),
|
|
1267
|
+
limitPx: zod.z.string(),
|
|
1268
|
+
sz: zod.z.string(),
|
|
1269
|
+
oid: zod.z.number(),
|
|
1270
|
+
timestamp: zod.z.number(),
|
|
1271
|
+
reduceOnly: zod.z.boolean().optional()
|
|
1272
|
+
})
|
|
1273
|
+
)
|
|
1274
|
+
});
|
|
1275
|
+
var mcpHyperliquidFetchMarketSnapshotInputSchema = zod.z.object({
|
|
1276
|
+
chainId: zod.z.number().int().positive(),
|
|
1277
|
+
coin: zod.z.string().min(1),
|
|
1278
|
+
interval: hyperliquidOhlcvIntervalSchema.optional(),
|
|
1279
|
+
dex: zod.z.string().optional(),
|
|
1280
|
+
/** Recent OHLCV bars to return (default 48, max 200). Live price is always current. */
|
|
1281
|
+
candleLimit: zod.z.number().int().positive().max(200).optional()
|
|
1282
|
+
});
|
|
1283
|
+
var hyperliquidOhlcvCandleSchema = zod.z.object({
|
|
1284
|
+
timestampMs: zod.z.number(),
|
|
1285
|
+
open: zod.z.string(),
|
|
1286
|
+
high: zod.z.string(),
|
|
1287
|
+
low: zod.z.string(),
|
|
1288
|
+
close: zod.z.string(),
|
|
1289
|
+
volume: zod.z.string()
|
|
1290
|
+
});
|
|
1291
|
+
var hyperliquidLivePriceSchema = zod.z.object({
|
|
1292
|
+
markPx: zod.z.string().nullable(),
|
|
1293
|
+
midPx: zod.z.string().nullable(),
|
|
1294
|
+
oraclePx: zod.z.string().nullable(),
|
|
1295
|
+
prevDayPx: zod.z.string().nullable(),
|
|
1296
|
+
midUsd: zod.z.string(),
|
|
1297
|
+
source: zod.z.enum(["midPx", "markPx", "allMids"])
|
|
1298
|
+
});
|
|
1299
|
+
var mcpHyperliquidFetchMarketSnapshotOutputSchema = zod.z.object({
|
|
1300
|
+
snapshot: zod.z.object({
|
|
1301
|
+
coin: zod.z.string(),
|
|
1302
|
+
dex: zod.z.string().nullable(),
|
|
1303
|
+
livePrice: hyperliquidLivePriceSchema,
|
|
1304
|
+
midUsd: zod.z.string(),
|
|
1305
|
+
fetchedAtMs: zod.z.number(),
|
|
1306
|
+
interval: hyperliquidOhlcvIntervalSchema,
|
|
1307
|
+
latestCandle: hyperliquidOhlcvCandleSchema.nullable(),
|
|
1308
|
+
candles: zod.z.array(hyperliquidOhlcvCandleSchema),
|
|
1309
|
+
candleCount: zod.z.number()
|
|
1310
|
+
}),
|
|
1311
|
+
resolvedCoin: zod.z.string(),
|
|
1312
|
+
dex: zod.z.string().nullable()
|
|
1313
|
+
});
|
|
1314
|
+
var mcpHyperliquidFetchOhlcvInputSchema = zod.z.object({
|
|
1315
|
+
chainId: zod.z.number().int().positive(),
|
|
1316
|
+
coin: zod.z.string().min(1),
|
|
1317
|
+
interval: hyperliquidOhlcvIntervalSchema.optional(),
|
|
1318
|
+
dex: zod.z.string().optional(),
|
|
1319
|
+
/** Calendar-day lookback ending now (e.g. 7 = last week). Preferred for agent requests. */
|
|
1320
|
+
lookbackDays: zod.z.number().positive().max(90).optional(),
|
|
1321
|
+
/** Hour lookback ending now. Alternative to lookbackDays. */
|
|
1322
|
+
lookbackHours: zod.z.number().positive().max(90 * 24).optional(),
|
|
1323
|
+
/** Explicit range start (ms since epoch). Use with endTimeMs. */
|
|
1324
|
+
startTimeMs: zod.z.number().int().positive().optional(),
|
|
1325
|
+
/** Explicit range end (ms since epoch). Defaults to now. */
|
|
1326
|
+
endTimeMs: zod.z.number().int().positive().optional()
|
|
1327
|
+
});
|
|
1328
|
+
var mcpHyperliquidFetchOhlcvOutputSchema = zod.z.object({
|
|
1329
|
+
ohlcv: zod.z.object({
|
|
1330
|
+
coin: zod.z.string(),
|
|
1331
|
+
dex: zod.z.string().nullable(),
|
|
1332
|
+
interval: hyperliquidOhlcvIntervalSchema,
|
|
1333
|
+
startTimeMs: zod.z.number(),
|
|
1334
|
+
endTimeMs: zod.z.number(),
|
|
1335
|
+
expectedBars: zod.z.number(),
|
|
1336
|
+
candleCount: zod.z.number(),
|
|
1337
|
+
latestCandle: hyperliquidOhlcvCandleSchema.nullable(),
|
|
1338
|
+
candles: zod.z.array(hyperliquidOhlcvCandleSchema),
|
|
1339
|
+
fetchedAtMs: zod.z.number()
|
|
1340
|
+
}),
|
|
1341
|
+
resolvedCoin: zod.z.string(),
|
|
1342
|
+
dex: zod.z.string().nullable()
|
|
1343
|
+
});
|
|
1344
|
+
var mcpHyperliquidFetchUsdClassBalancesInputSchema = zod.z.object({
|
|
1345
|
+
chainId: zod.z.number().int().positive(),
|
|
1346
|
+
executorAddress: evmAddressSchema
|
|
1347
|
+
});
|
|
1348
|
+
var mcpHyperliquidFetchUsdClassBalancesOutputSchema = zod.z.object({
|
|
1349
|
+
balances: zod.z.object({
|
|
1350
|
+
spotUsdcAvailable: zod.z.string(),
|
|
1351
|
+
perpWithdrawable: zod.z.string()
|
|
1352
|
+
})
|
|
1353
|
+
});
|
|
1354
|
+
var mcpHyperliquidFetchVaultsInputSchema = zod.z.object({
|
|
1355
|
+
chainId: zod.z.number().int().positive(),
|
|
1356
|
+
executorAddress: evmAddressSchema.optional()
|
|
1357
|
+
});
|
|
1358
|
+
var mcpHyperliquidFetchVaultsOutputSchema = zod.z.object({
|
|
1359
|
+
vaults: zod.z.array(
|
|
1360
|
+
zod.z.object({
|
|
1361
|
+
vaultAddress: zod.z.string(),
|
|
1362
|
+
name: zod.z.string(),
|
|
1363
|
+
apr: zod.z.number().nullable(),
|
|
1364
|
+
tvlUsd: zod.z.string().nullable()
|
|
1365
|
+
})
|
|
1366
|
+
)
|
|
1367
|
+
});
|
|
1368
|
+
var mcpHyperliquidFetchUserVaultEquitiesInputSchema = zod.z.object({
|
|
1369
|
+
chainId: zod.z.number().int().positive(),
|
|
1370
|
+
executorAddress: evmAddressSchema
|
|
1371
|
+
});
|
|
1372
|
+
var mcpHyperliquidFetchUserVaultEquitiesOutputSchema = zod.z.object({
|
|
1373
|
+
rows: zod.z.array(
|
|
1374
|
+
zod.z.object({
|
|
1375
|
+
vaultAddress: zod.z.string(),
|
|
1376
|
+
equity: zod.z.string()
|
|
1377
|
+
})
|
|
1378
|
+
)
|
|
1379
|
+
});
|
|
1380
|
+
var mcpHyperliquidFetchStakingSummaryInputSchema = zod.z.object({
|
|
1381
|
+
chainId: zod.z.number().int().positive(),
|
|
1382
|
+
executorAddress: evmAddressSchema
|
|
1383
|
+
});
|
|
1384
|
+
var mcpHyperliquidFetchStakingSummaryOutputSchema = zod.z.object({
|
|
1385
|
+
summary: zod.z.object({
|
|
1386
|
+
delegated: zod.z.string(),
|
|
1387
|
+
undelegated: zod.z.string()
|
|
1388
|
+
})
|
|
1389
|
+
});
|
|
1390
|
+
var mcpHyperliquidFetchDelegationsInputSchema = zod.z.object({
|
|
1391
|
+
chainId: zod.z.number().int().positive(),
|
|
1392
|
+
executorAddress: evmAddressSchema
|
|
1393
|
+
});
|
|
1394
|
+
var mcpHyperliquidFetchDelegationsOutputSchema = zod.z.object({
|
|
1395
|
+
delegations: zod.z.array(
|
|
1396
|
+
zod.z.object({
|
|
1397
|
+
validator: zod.z.string(),
|
|
1398
|
+
amount: zod.z.string()
|
|
1399
|
+
})
|
|
1400
|
+
)
|
|
1401
|
+
});
|
|
1402
|
+
var mcpHyperliquidLimitOrderInputSchema = mcpHyperliquidMultisignInput({
|
|
1403
|
+
coin: zod.z.string().min(1),
|
|
1404
|
+
isBuy: zod.z.boolean(),
|
|
1405
|
+
limitPxHuman: zod.z.string().min(1),
|
|
1406
|
+
szHuman: zod.z.string().min(1),
|
|
1407
|
+
marketKind: zod.z.enum(["perp", "spot"]).optional(),
|
|
1408
|
+
tif: hyperliquidTifSchema.optional(),
|
|
1409
|
+
dex: zod.z.string().optional()
|
|
1410
|
+
});
|
|
1411
|
+
var mcpHyperliquidCloseInputSchema = mcpHyperliquidMultisignInput({
|
|
1412
|
+
coin: zod.z.string().min(1),
|
|
1413
|
+
isLong: zod.z.boolean(),
|
|
1414
|
+
limitPxHuman: zod.z.string().min(1),
|
|
1415
|
+
szHuman: zod.z.string().min(1),
|
|
1416
|
+
dex: zod.z.string().optional(),
|
|
1417
|
+
tif: hyperliquidTifSchema.optional()
|
|
1418
|
+
});
|
|
1419
|
+
var mcpHyperliquidCancelInputSchema = mcpHyperliquidMultisignInput({
|
|
1420
|
+
coin: zod.z.string().min(1),
|
|
1421
|
+
oid: zod.z.number().int().positive(),
|
|
1422
|
+
marketKind: zod.z.enum(["perp", "spot"]).optional(),
|
|
1423
|
+
dex: zod.z.string().optional()
|
|
1424
|
+
});
|
|
1425
|
+
var mcpHyperliquidUsdTransferInputSchema = mcpHyperliquidMultisignInput({
|
|
1426
|
+
usdHuman: zod.z.string().min(1),
|
|
1427
|
+
toPerp: zod.z.boolean()
|
|
1428
|
+
});
|
|
1429
|
+
var mcpHyperliquidVaultDepositInputSchema = mcpHyperliquidMultisignInput({
|
|
1430
|
+
vaultAddress: evmAddressSchema,
|
|
1431
|
+
usdHuman: zod.z.string().min(1)
|
|
1432
|
+
});
|
|
1433
|
+
var mcpHyperliquidVaultWithdrawInputSchema = mcpHyperliquidMultisignInput({
|
|
1434
|
+
vaultAddress: evmAddressSchema,
|
|
1435
|
+
usdHuman: zod.z.string().min(1)
|
|
1436
|
+
});
|
|
1437
|
+
var mcpHyperliquidStakeInputSchema = mcpHyperliquidMultisignInput({
|
|
1438
|
+
hypeHuman: zod.z.string().min(1)
|
|
1439
|
+
});
|
|
1440
|
+
var mcpHyperliquidUnstakeInputSchema = mcpHyperliquidMultisignInput({
|
|
1441
|
+
hypeHuman: zod.z.string().min(1)
|
|
1442
|
+
});
|
|
1443
|
+
var mcpHyperliquidDelegateInputSchema = mcpHyperliquidMultisignInput({
|
|
1444
|
+
hypeHuman: zod.z.string().min(1),
|
|
1445
|
+
validator: evmAddressSchema
|
|
1446
|
+
});
|
|
1447
|
+
var mcpHyperliquidUndelegateInputSchema = mcpHyperliquidMultisignInput({
|
|
1448
|
+
hypeHuman: zod.z.string().min(1),
|
|
1449
|
+
validator: evmAddressSchema
|
|
1450
|
+
});
|
|
1078
1451
|
|
|
1079
1452
|
// src/agent/mcpProtocolTools.ts
|
|
1080
1453
|
function defineProtocolMcpTool(def) {
|
|
@@ -1377,6 +1750,87 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
|
1377
1750
|
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralWithdrawBatch" },
|
|
1378
1751
|
inputZod: mcpEulerV2CollateralWithdrawInputSchema
|
|
1379
1752
|
}),
|
|
1753
|
+
defineProtocolMcpTool({
|
|
1754
|
+
name: "ctm_morpho_build_vault_deposit_multisign",
|
|
1755
|
+
actionId: "morpho.vault-deposit",
|
|
1756
|
+
protocolId: "morpho",
|
|
1757
|
+
chainCategory: "evm",
|
|
1758
|
+
description: "Build Morpho vault deposit batch (wrap/approve + deposit). Works with listed V1 and V2 vaults.",
|
|
1759
|
+
prerequisites: [
|
|
1760
|
+
"keyGenId",
|
|
1761
|
+
"chainId",
|
|
1762
|
+
"vaultAddress from ctm_morpho_fetch_earn_vaults",
|
|
1763
|
+
"underlying",
|
|
1764
|
+
"amountHuman"
|
|
1765
|
+
],
|
|
1766
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoVaultDepositBatch" },
|
|
1767
|
+
inputZod: mcpMorphoVaultDepositInputSchema
|
|
1768
|
+
}),
|
|
1769
|
+
defineProtocolMcpTool({
|
|
1770
|
+
name: "ctm_morpho_build_vault_withdraw_multisign",
|
|
1771
|
+
actionId: "morpho.vault-withdraw",
|
|
1772
|
+
protocolId: "morpho",
|
|
1773
|
+
chainCategory: "evm",
|
|
1774
|
+
description: "Build Morpho vault withdraw batch. Works with listed V1 and V2 vaults.",
|
|
1775
|
+
prerequisites: [
|
|
1776
|
+
"keyGenId",
|
|
1777
|
+
"chainId",
|
|
1778
|
+
"vaultAddress from ctm_morpho_fetch_earn_vaults or user positions",
|
|
1779
|
+
"amountHuman"
|
|
1780
|
+
],
|
|
1781
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoVaultWithdraw" },
|
|
1782
|
+
inputZod: mcpMorphoVaultWithdrawInputSchema
|
|
1783
|
+
}),
|
|
1784
|
+
defineProtocolMcpTool({
|
|
1785
|
+
name: "ctm_morpho_build_blue_collateral_deposit_multisign",
|
|
1786
|
+
actionId: "morpho.blue-collateral-deposit",
|
|
1787
|
+
protocolId: "morpho",
|
|
1788
|
+
chainCategory: "evm",
|
|
1789
|
+
description: "Build Morpho Blue supplyCollateral batch.",
|
|
1790
|
+
prerequisites: ["keyGenId", "chainId", "marketId", "collateralToken", "amountHuman"],
|
|
1791
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoBlueSupplyCollateralBatch" },
|
|
1792
|
+
inputZod: mcpMorphoBlueCollateralDepositInputSchema
|
|
1793
|
+
}),
|
|
1794
|
+
defineProtocolMcpTool({
|
|
1795
|
+
name: "ctm_morpho_build_blue_borrow_multisign",
|
|
1796
|
+
actionId: "morpho.blue-borrow",
|
|
1797
|
+
protocolId: "morpho",
|
|
1798
|
+
chainCategory: "evm",
|
|
1799
|
+
description: "Build Morpho Blue borrow batch.",
|
|
1800
|
+
prerequisites: ["keyGenId", "chainId", "marketId", "loanToken", "amountHuman"],
|
|
1801
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoBlueBorrowBatch" },
|
|
1802
|
+
inputZod: mcpMorphoBlueBorrowInputSchema
|
|
1803
|
+
}),
|
|
1804
|
+
defineProtocolMcpTool({
|
|
1805
|
+
name: "ctm_morpho_build_blue_repay_multisign",
|
|
1806
|
+
actionId: "morpho.blue-repay",
|
|
1807
|
+
protocolId: "morpho",
|
|
1808
|
+
chainCategory: "evm",
|
|
1809
|
+
description: "Build Morpho Blue repay batch.",
|
|
1810
|
+
prerequisites: ["keyGenId", "chainId", "marketId", "loanToken", "amountHuman"],
|
|
1811
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoBlueRepayBatch" },
|
|
1812
|
+
inputZod: mcpMorphoBlueRepayInputSchema
|
|
1813
|
+
}),
|
|
1814
|
+
defineProtocolMcpTool({
|
|
1815
|
+
name: "ctm_morpho_build_blue_collateral_withdraw_multisign",
|
|
1816
|
+
actionId: "morpho.blue-collateral-withdraw",
|
|
1817
|
+
protocolId: "morpho",
|
|
1818
|
+
chainCategory: "evm",
|
|
1819
|
+
description: "Build Morpho Blue withdrawCollateral batch.",
|
|
1820
|
+
prerequisites: ["keyGenId", "chainId", "marketId", "amountHuman"],
|
|
1821
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoBlueWithdrawCollateralBatch" },
|
|
1822
|
+
inputZod: mcpMorphoBlueCollateralWithdrawInputSchema
|
|
1823
|
+
}),
|
|
1824
|
+
defineProtocolMcpTool({
|
|
1825
|
+
name: "ctm_morpho_build_merkl_claim_multisign",
|
|
1826
|
+
actionId: "morpho.merkl-claim",
|
|
1827
|
+
protocolId: "morpho",
|
|
1828
|
+
chainCategory: "evm",
|
|
1829
|
+
description: "Build Morpho Merkl Distributor.claim transaction.",
|
|
1830
|
+
prerequisites: ["keyGenId", "chainId", "claim calldata from Merkl API"],
|
|
1831
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "buildEvmMultisignBodyMorphoMerklDistributorClaim" },
|
|
1832
|
+
inputZod: mcpMorphoMerklClaimInputSchema
|
|
1833
|
+
}),
|
|
1380
1834
|
defineProtocolMcpTool({
|
|
1381
1835
|
name: "ctm_gmx_build_increase_multisign",
|
|
1382
1836
|
actionId: "gmx.increase",
|
|
@@ -1446,6 +1900,109 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
|
1446
1900
|
prerequisites: ["keyGen", "executorAddress", "staked GMX balance"],
|
|
1447
1901
|
handler: { importPath: "protocols/evm/gmx", exportName: "buildEvmMultisignBodyGmxUnstakeGmxBatch" },
|
|
1448
1902
|
inputZod: mcpGmxUnstakeGmxInputSchema
|
|
1903
|
+
}),
|
|
1904
|
+
defineProtocolMcpTool({
|
|
1905
|
+
name: "ctm_hyperliquid_build_limit_order_multisign",
|
|
1906
|
+
actionId: "hyperliquid.limitOrder",
|
|
1907
|
+
protocolId: "hyperliquid",
|
|
1908
|
+
chainCategory: "evm",
|
|
1909
|
+
description: "Create and submit mpc-auth multiSignRequest for a Hyperliquid limit/IoC order via HyperEVM CoreWriter.",
|
|
1910
|
+
prerequisites: ["keyGen", "executorAddress", "chainId 999 or 998", "coin", "limitPxHuman", "szHuman"],
|
|
1911
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidLimitOrderBatch" },
|
|
1912
|
+
inputZod: mcpHyperliquidLimitOrderInputSchema
|
|
1913
|
+
}),
|
|
1914
|
+
defineProtocolMcpTool({
|
|
1915
|
+
name: "ctm_hyperliquid_build_close_multisign",
|
|
1916
|
+
actionId: "hyperliquid.close",
|
|
1917
|
+
protocolId: "hyperliquid",
|
|
1918
|
+
chainCategory: "evm",
|
|
1919
|
+
description: "Create and submit mpc-auth multiSignRequest to close/reduce a perp (IoC reduce-only limit via CoreWriter).",
|
|
1920
|
+
prerequisites: ["keyGen", "executorAddress", "open position from fetch_positions", "isLong matches position"],
|
|
1921
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidCloseBatch" },
|
|
1922
|
+
inputZod: mcpHyperliquidCloseInputSchema
|
|
1923
|
+
}),
|
|
1924
|
+
defineProtocolMcpTool({
|
|
1925
|
+
name: "ctm_hyperliquid_build_cancel_multisign",
|
|
1926
|
+
actionId: "hyperliquid.cancel",
|
|
1927
|
+
protocolId: "hyperliquid",
|
|
1928
|
+
chainCategory: "evm",
|
|
1929
|
+
description: "Create and submit mpc-auth multiSignRequest to cancel a Hyperliquid open order.",
|
|
1930
|
+
prerequisites: ["keyGen", "executorAddress", "oid from fetch_open_orders"],
|
|
1931
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidCancelBatch" },
|
|
1932
|
+
inputZod: mcpHyperliquidCancelInputSchema
|
|
1933
|
+
}),
|
|
1934
|
+
defineProtocolMcpTool({
|
|
1935
|
+
name: "ctm_hyperliquid_build_usd_transfer_multisign",
|
|
1936
|
+
actionId: "hyperliquid.usdTransfer",
|
|
1937
|
+
protocolId: "hyperliquid",
|
|
1938
|
+
chainCategory: "evm",
|
|
1939
|
+
description: "Create and submit mpc-auth multiSignRequest to move USDC between spot and perp margin.",
|
|
1940
|
+
prerequisites: ["keyGen", "executorAddress", "usdHuman", "toPerp boolean"],
|
|
1941
|
+
handler: {
|
|
1942
|
+
importPath: "protocols/evm/hyperliquid",
|
|
1943
|
+
exportName: "buildEvmMultisignBodyHyperliquidUsdClassTransferBatch"
|
|
1944
|
+
},
|
|
1945
|
+
inputZod: mcpHyperliquidUsdTransferInputSchema
|
|
1946
|
+
}),
|
|
1947
|
+
defineProtocolMcpTool({
|
|
1948
|
+
name: "ctm_hyperliquid_build_vault_deposit_multisign",
|
|
1949
|
+
actionId: "hyperliquid.vaultDeposit",
|
|
1950
|
+
protocolId: "hyperliquid",
|
|
1951
|
+
chainCategory: "evm",
|
|
1952
|
+
description: "Create and submit mpc-auth multiSignRequest for Hyperliquid vault deposit.",
|
|
1953
|
+
prerequisites: ["keyGen", "executorAddress", "vaultAddress from fetch_vaults"],
|
|
1954
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidVaultDepositBatch" },
|
|
1955
|
+
inputZod: mcpHyperliquidVaultDepositInputSchema
|
|
1956
|
+
}),
|
|
1957
|
+
defineProtocolMcpTool({
|
|
1958
|
+
name: "ctm_hyperliquid_build_vault_withdraw_multisign",
|
|
1959
|
+
actionId: "hyperliquid.vaultWithdraw",
|
|
1960
|
+
protocolId: "hyperliquid",
|
|
1961
|
+
chainCategory: "evm",
|
|
1962
|
+
description: "Create and submit mpc-auth multiSignRequest for Hyperliquid vault withdraw (includes accrued PnL).",
|
|
1963
|
+
prerequisites: ["keyGen", "executorAddress", "vaultAddress", "equity from fetch_user_vault_equities"],
|
|
1964
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidVaultWithdrawBatch" },
|
|
1965
|
+
inputZod: mcpHyperliquidVaultWithdrawInputSchema
|
|
1966
|
+
}),
|
|
1967
|
+
defineProtocolMcpTool({
|
|
1968
|
+
name: "ctm_hyperliquid_build_stake_multisign",
|
|
1969
|
+
actionId: "hyperliquid.stake",
|
|
1970
|
+
protocolId: "hyperliquid",
|
|
1971
|
+
chainCategory: "evm",
|
|
1972
|
+
description: "Create and submit mpc-auth multiSignRequest to stake HYPE via CoreWriter.",
|
|
1973
|
+
prerequisites: ["keyGen", "executorAddress", "HYPE balance on Hyperliquid account"],
|
|
1974
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidStakeDepositBatch" },
|
|
1975
|
+
inputZod: mcpHyperliquidStakeInputSchema
|
|
1976
|
+
}),
|
|
1977
|
+
defineProtocolMcpTool({
|
|
1978
|
+
name: "ctm_hyperliquid_build_unstake_multisign",
|
|
1979
|
+
actionId: "hyperliquid.unstake",
|
|
1980
|
+
protocolId: "hyperliquid",
|
|
1981
|
+
chainCategory: "evm",
|
|
1982
|
+
description: "Create and submit mpc-auth multiSignRequest to unstake HYPE via CoreWriter.",
|
|
1983
|
+
prerequisites: ["keyGen", "executorAddress", "staked HYPE"],
|
|
1984
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidStakeWithdrawBatch" },
|
|
1985
|
+
inputZod: mcpHyperliquidUnstakeInputSchema
|
|
1986
|
+
}),
|
|
1987
|
+
defineProtocolMcpTool({
|
|
1988
|
+
name: "ctm_hyperliquid_build_delegate_multisign",
|
|
1989
|
+
actionId: "hyperliquid.delegate",
|
|
1990
|
+
protocolId: "hyperliquid",
|
|
1991
|
+
chainCategory: "evm",
|
|
1992
|
+
description: "Create and submit mpc-auth multiSignRequest to delegate staked HYPE to a validator.",
|
|
1993
|
+
prerequisites: ["keyGen", "executorAddress", "validator address", "hypeHuman"],
|
|
1994
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidDelegateOnlyBatch" },
|
|
1995
|
+
inputZod: mcpHyperliquidDelegateInputSchema
|
|
1996
|
+
}),
|
|
1997
|
+
defineProtocolMcpTool({
|
|
1998
|
+
name: "ctm_hyperliquid_build_undelegate_multisign",
|
|
1999
|
+
actionId: "hyperliquid.undelegate",
|
|
2000
|
+
protocolId: "hyperliquid",
|
|
2001
|
+
chainCategory: "evm",
|
|
2002
|
+
description: "Create and submit mpc-auth multiSignRequest to undelegate HYPE from a validator.",
|
|
2003
|
+
prerequisites: ["keyGen", "executorAddress", "delegation from fetch_delegations"],
|
|
2004
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "buildEvmMultisignBodyHyperliquidUndelegateBatch" },
|
|
2005
|
+
inputZod: mcpHyperliquidUndelegateInputSchema
|
|
1449
2006
|
})
|
|
1450
2007
|
];
|
|
1451
2008
|
|
|
@@ -1791,6 +2348,165 @@ var CORE_MCP_TOOL_DEFINITIONS = [
|
|
|
1791
2348
|
handler: { importPath: "protocols/evm/gmx", exportName: "gmxFetchStakingPower" },
|
|
1792
2349
|
inputZod: mcpGmxFetchStakingPowerInputSchema,
|
|
1793
2350
|
outputZod: mcpGmxFetchStakingPowerOutputSchema
|
|
2351
|
+
}),
|
|
2352
|
+
defineMcpTool({
|
|
2353
|
+
name: "ctm_hyperliquid_fetch_markets",
|
|
2354
|
+
actionId: "hyperliquid.fetch-markets",
|
|
2355
|
+
protocolId: "hyperliquid",
|
|
2356
|
+
chainCategory: "evm",
|
|
2357
|
+
description: "List Hyperliquid perp markets (native + all HIP-3 dexes when dex omitted). Each market has coin name, maxLeverage, szDecimals, and optional dex (e.g. xyz for xyz:AAPL). chainId 999 mainnet or 998 testnet.",
|
|
2358
|
+
prerequisites: ["chainId 999 or 998"],
|
|
2359
|
+
followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
|
|
2360
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketsSummary" },
|
|
2361
|
+
inputZod: mcpHyperliquidFetchMarketsInputSchema,
|
|
2362
|
+
outputZod: mcpHyperliquidFetchMarketsOutputSchema
|
|
2363
|
+
}),
|
|
2364
|
+
defineMcpTool({
|
|
2365
|
+
name: "ctm_hyperliquid_search_markets",
|
|
2366
|
+
actionId: "hyperliquid.search-markets",
|
|
2367
|
+
protocolId: "hyperliquid",
|
|
2368
|
+
chainCategory: "evm",
|
|
2369
|
+
description: "Search Hyperliquid perp markets across all dexes by ticker (AAPL, BTC), display name, or keyword (Apple, tesla). Case-insensitive. Returns canonical coin names (e.g. xyz:AAPL).",
|
|
2370
|
+
prerequisites: ["chainId 999 or 998", "query"],
|
|
2371
|
+
followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
|
|
2372
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidSearchMarketsSummary" },
|
|
2373
|
+
inputZod: mcpHyperliquidSearchMarketsInputSchema,
|
|
2374
|
+
outputZod: mcpHyperliquidSearchMarketsOutputSchema
|
|
2375
|
+
}),
|
|
2376
|
+
defineMcpTool({
|
|
2377
|
+
name: "ctm_hyperliquid_fetch_open_context",
|
|
2378
|
+
actionId: "hyperliquid.fetch-open-context",
|
|
2379
|
+
protocolId: "hyperliquid",
|
|
2380
|
+
chainCategory: "evm",
|
|
2381
|
+
description: "Per-market trading context: account value, withdrawable, margin used, leverage setting, mark price, available buy/sell size. Resolves ticker/name (AAPL, Apple) across dexes.",
|
|
2382
|
+
prerequisites: ["chainId", "executorAddress", "coin from fetch_markets"],
|
|
2383
|
+
followUp: ["ctm_hyperliquid_build_limit_order_multisign"],
|
|
2384
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOpenContextSummary" },
|
|
2385
|
+
inputZod: mcpHyperliquidFetchOpenContextInputSchema,
|
|
2386
|
+
outputZod: mcpHyperliquidFetchOpenContextOutputSchema
|
|
2387
|
+
}),
|
|
2388
|
+
defineMcpTool({
|
|
2389
|
+
name: "ctm_hyperliquid_fetch_positions",
|
|
2390
|
+
actionId: "hyperliquid.fetch-positions",
|
|
2391
|
+
protocolId: "hyperliquid",
|
|
2392
|
+
chainCategory: "evm",
|
|
2393
|
+
description: "Open Hyperliquid perp positions for executor (size, entry, uPnL, liq price, leverage, margin).",
|
|
2394
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2395
|
+
followUp: ["ctm_hyperliquid_build_close_multisign"],
|
|
2396
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchPositionsForExecutor" },
|
|
2397
|
+
inputZod: mcpHyperliquidFetchPositionsInputSchema,
|
|
2398
|
+
outputZod: mcpHyperliquidFetchPositionsOutputSchema
|
|
2399
|
+
}),
|
|
2400
|
+
defineMcpTool({
|
|
2401
|
+
name: "ctm_hyperliquid_fetch_open_orders",
|
|
2402
|
+
actionId: "hyperliquid.fetch-open-orders",
|
|
2403
|
+
protocolId: "hyperliquid",
|
|
2404
|
+
chainCategory: "evm",
|
|
2405
|
+
description: "Pending Hyperliquid open orders for executor (oid, coin, side, price, size).",
|
|
2406
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2407
|
+
followUp: ["ctm_hyperliquid_build_cancel_multisign"],
|
|
2408
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOpenOrdersSummary" },
|
|
2409
|
+
inputZod: mcpHyperliquidFetchOpenOrdersInputSchema,
|
|
2410
|
+
outputZod: mcpHyperliquidFetchOpenOrdersOutputSchema
|
|
2411
|
+
}),
|
|
2412
|
+
defineMcpTool({
|
|
2413
|
+
name: "ctm_hyperliquid_fetch_market_snapshot",
|
|
2414
|
+
actionId: "hyperliquid.fetch-market-snapshot",
|
|
2415
|
+
protocolId: "hyperliquid",
|
|
2416
|
+
chainCategory: "evm",
|
|
2417
|
+
description: "Live mark/mid price plus recent OHLCV candles for a Hyperliquid perp. Uses metaAndAssetCtxs for live prices (not stale candle close). Default interval 15m, 48 bars. Throws if live price unavailable.",
|
|
2418
|
+
prerequisites: ["chainId", "coin"],
|
|
2419
|
+
followUp: ["ctm_hyperliquid_fetch_open_context", "ctm_hyperliquid_build_limit_order_multisign"],
|
|
2420
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchMarketSnapshotSummary" },
|
|
2421
|
+
inputZod: mcpHyperliquidFetchMarketSnapshotInputSchema,
|
|
2422
|
+
outputZod: mcpHyperliquidFetchMarketSnapshotOutputSchema
|
|
2423
|
+
}),
|
|
2424
|
+
defineMcpTool({
|
|
2425
|
+
name: "ctm_hyperliquid_fetch_ohlcv",
|
|
2426
|
+
actionId: "hyperliquid.fetch-ohlcv",
|
|
2427
|
+
protocolId: "hyperliquid",
|
|
2428
|
+
chainCategory: "evm",
|
|
2429
|
+
description: "OHLCV candle history for a Hyperliquid perp over an explicit lookback or time range. Requests only the needed window from Hyperliquid (e.g. lookbackDays: 7, interval: 15m \u2192 ~672 bars). Max 2000 bars \u2014 use coarser interval for longer history. Resolves ticker/name across dexes.",
|
|
2430
|
+
prerequisites: ["chainId 999 or 998", "coin", "lookbackDays or lookbackHours or startTimeMs"],
|
|
2431
|
+
followUp: ["ctm_hyperliquid_fetch_market_snapshot", "ctm_hyperliquid_build_limit_order_multisign"],
|
|
2432
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchOhlcvSummary" },
|
|
2433
|
+
inputZod: mcpHyperliquidFetchOhlcvInputSchema,
|
|
2434
|
+
outputZod: mcpHyperliquidFetchOhlcvOutputSchema
|
|
2435
|
+
}),
|
|
2436
|
+
defineMcpTool({
|
|
2437
|
+
name: "ctm_hyperliquid_fetch_usd_class_balances",
|
|
2438
|
+
actionId: "hyperliquid.fetch-usd-balances",
|
|
2439
|
+
protocolId: "hyperliquid",
|
|
2440
|
+
chainCategory: "evm",
|
|
2441
|
+
description: "Spot USDC available and perp withdrawable USD for spot\u2194perp transfers.",
|
|
2442
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2443
|
+
followUp: ["ctm_hyperliquid_build_usd_transfer_multisign"],
|
|
2444
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchUsdClassBalancesSummary" },
|
|
2445
|
+
inputZod: mcpHyperliquidFetchUsdClassBalancesInputSchema,
|
|
2446
|
+
outputZod: mcpHyperliquidFetchUsdClassBalancesOutputSchema
|
|
2447
|
+
}),
|
|
2448
|
+
defineMcpTool({
|
|
2449
|
+
name: "ctm_hyperliquid_fetch_vaults",
|
|
2450
|
+
actionId: "hyperliquid.fetch-vaults",
|
|
2451
|
+
protocolId: "hyperliquid",
|
|
2452
|
+
chainCategory: "evm",
|
|
2453
|
+
description: "Vault catalog by TVL with APR (mainnet only; may take ~10\u201315s). Pass executorAddress to merge user-held vaults.",
|
|
2454
|
+
prerequisites: ["chainId 999 for catalog"],
|
|
2455
|
+
followUp: ["ctm_hyperliquid_build_vault_deposit_multisign"],
|
|
2456
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchVaultCatalogSummary" },
|
|
2457
|
+
inputZod: mcpHyperliquidFetchVaultsInputSchema,
|
|
2458
|
+
outputZod: mcpHyperliquidFetchVaultsOutputSchema
|
|
2459
|
+
}),
|
|
2460
|
+
defineMcpTool({
|
|
2461
|
+
name: "ctm_hyperliquid_fetch_user_vault_equities",
|
|
2462
|
+
actionId: "hyperliquid.fetch-user-vault-equities",
|
|
2463
|
+
protocolId: "hyperliquid",
|
|
2464
|
+
chainCategory: "evm",
|
|
2465
|
+
description: "USD equity the user holds in Hyperliquid vaults.",
|
|
2466
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2467
|
+
followUp: ["ctm_hyperliquid_build_vault_withdraw_multisign"],
|
|
2468
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchUserVaultEquitiesSummary" },
|
|
2469
|
+
inputZod: mcpHyperliquidFetchUserVaultEquitiesInputSchema,
|
|
2470
|
+
outputZod: mcpHyperliquidFetchUserVaultEquitiesOutputSchema
|
|
2471
|
+
}),
|
|
2472
|
+
defineMcpTool({
|
|
2473
|
+
name: "ctm_hyperliquid_fetch_staking_summary",
|
|
2474
|
+
actionId: "hyperliquid.fetch-staking-summary",
|
|
2475
|
+
protocolId: "hyperliquid",
|
|
2476
|
+
chainCategory: "evm",
|
|
2477
|
+
description: "HYPE staking summary: delegated and undelegated amounts.",
|
|
2478
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2479
|
+
followUp: ["ctm_hyperliquid_build_stake_multisign", "ctm_hyperliquid_build_delegate_multisign"],
|
|
2480
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchStakingSummaryForExecutor" },
|
|
2481
|
+
inputZod: mcpHyperliquidFetchStakingSummaryInputSchema,
|
|
2482
|
+
outputZod: mcpHyperliquidFetchStakingSummaryOutputSchema
|
|
2483
|
+
}),
|
|
2484
|
+
defineMcpTool({
|
|
2485
|
+
name: "ctm_hyperliquid_fetch_delegations",
|
|
2486
|
+
actionId: "hyperliquid.fetch-delegations",
|
|
2487
|
+
protocolId: "hyperliquid",
|
|
2488
|
+
chainCategory: "evm",
|
|
2489
|
+
description: "HYPE delegations by validator for executor.",
|
|
2490
|
+
prerequisites: ["chainId", "executorAddress"],
|
|
2491
|
+
followUp: ["ctm_hyperliquid_build_undelegate_multisign"],
|
|
2492
|
+
handler: { importPath: "protocols/evm/hyperliquid", exportName: "hyperliquidFetchDelegationsForExecutor" },
|
|
2493
|
+
inputZod: mcpHyperliquidFetchDelegationsInputSchema,
|
|
2494
|
+
outputZod: mcpHyperliquidFetchDelegationsOutputSchema
|
|
2495
|
+
}),
|
|
2496
|
+
defineMcpTool({
|
|
2497
|
+
name: "ctm_morpho_fetch_earn_vaults",
|
|
2498
|
+
actionId: "morpho.fetch-earn-vaults",
|
|
2499
|
+
protocolId: "morpho",
|
|
2500
|
+
chainCategory: "evm",
|
|
2501
|
+
description: "Morpho-listed earn vaults (V1 + V2 unified). Filter by deposit asset symbol/address and/or case-insensitive vault name search. Returns vaultAddress for deposit/withdraw multisign tools.",
|
|
2502
|
+
prerequisites: ["chainId"],
|
|
2503
|
+
followUp: [
|
|
2504
|
+
"ctm_morpho_build_vault_deposit_multisign",
|
|
2505
|
+
"ctm_morpho_build_vault_withdraw_multisign"
|
|
2506
|
+
],
|
|
2507
|
+
handler: { importPath: "protocols/evm/morpho", exportName: "morphoFetchEarnVaultsSummary" },
|
|
2508
|
+
inputZod: mcpMorphoFetchEarnVaultsInputSchema,
|
|
2509
|
+
outputZod: mcpMorphoFetchEarnVaultsOutputSchema
|
|
1794
2510
|
})
|
|
1795
2511
|
];
|
|
1796
2512
|
var MCP_TOOL_DEFINITIONS = [
|
|
@@ -2017,7 +2733,30 @@ registerProtocolModule(ethenaProtocolModule);
|
|
|
2017
2733
|
function isMapleSyrupSupportedChain(chainId) {
|
|
2018
2734
|
return chainId === 1 || chainId === 11155111;
|
|
2019
2735
|
}
|
|
2736
|
+
|
|
2737
|
+
// src/core/defiProxy.ts
|
|
2738
|
+
var aaveGraphqlProxyUrl;
|
|
2739
|
+
var morphoGraphqlProxyUrl;
|
|
2740
|
+
function getAaveGraphqlProxyUrl() {
|
|
2741
|
+
return aaveGraphqlProxyUrl;
|
|
2742
|
+
}
|
|
2743
|
+
function getMorphoGraphqlProxyUrl() {
|
|
2744
|
+
return morphoGraphqlProxyUrl;
|
|
2745
|
+
}
|
|
2020
2746
|
async function postJsonViaOptionalProxy(args) {
|
|
2747
|
+
const proxy = args.proxyUrl?.trim();
|
|
2748
|
+
if (proxy) {
|
|
2749
|
+
const r2 = await fetch(proxy, {
|
|
2750
|
+
method: "POST",
|
|
2751
|
+
headers: { "content-type": "application/json" },
|
|
2752
|
+
body: JSON.stringify(args.proxyEnvelope ?? args.body)
|
|
2753
|
+
});
|
|
2754
|
+
if (!r2.ok) {
|
|
2755
|
+
const t = await r2.text().catch(() => "");
|
|
2756
|
+
throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
|
|
2757
|
+
}
|
|
2758
|
+
return await r2.json();
|
|
2759
|
+
}
|
|
2021
2760
|
const r = await fetch(args.directUrl, {
|
|
2022
2761
|
method: "POST",
|
|
2023
2762
|
headers: { "content-type": "application/json" },
|
|
@@ -2080,7 +2819,10 @@ async function aaveV4Gql(query, variables) {
|
|
|
2080
2819
|
const body = { query, variables: variables ?? {} };
|
|
2081
2820
|
const j = await postJsonViaOptionalProxy({
|
|
2082
2821
|
directUrl: AAVE_V4_GRAPHQL_URL,
|
|
2083
|
-
body
|
|
2822
|
+
body,
|
|
2823
|
+
proxyUrl: getAaveGraphqlProxyUrl(),
|
|
2824
|
+
proxyEnvelope: body
|
|
2825
|
+
});
|
|
2084
2826
|
if (j.errors?.length) {
|
|
2085
2827
|
const msg = j.errors.map((e) => e.message ?? "Unknown").join("; ");
|
|
2086
2828
|
throw new Error(msg);
|
|
@@ -2413,6 +3155,315 @@ var gmxProtocolModule = {
|
|
|
2413
3155
|
]
|
|
2414
3156
|
};
|
|
2415
3157
|
registerProtocolModule(gmxProtocolModule);
|
|
3158
|
+
|
|
3159
|
+
// src/protocols/evm/hyperliquid/support.ts
|
|
3160
|
+
var HYPERLIQUID_SUPPORTED_CHAIN_IDS = [999, 998];
|
|
3161
|
+
function isHyperliquidChainSupported(chainId) {
|
|
3162
|
+
return HYPERLIQUID_SUPPORTED_CHAIN_IDS.includes(chainId);
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
// src/protocols/evm/hyperliquid/index.ts
|
|
3166
|
+
var HYPERLIQUID_PROTOCOL_ID = "hyperliquid";
|
|
3167
|
+
var hyperliquidProtocolModule = {
|
|
3168
|
+
id: HYPERLIQUID_PROTOCOL_ID,
|
|
3169
|
+
chainCategory: "evm",
|
|
3170
|
+
isChainSupported(ctx) {
|
|
3171
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3172
|
+
const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
|
|
3173
|
+
return Number.isFinite(chainId) && isHyperliquidChainSupported(chainId);
|
|
3174
|
+
},
|
|
3175
|
+
isTokenSupported(token) {
|
|
3176
|
+
if (token.category !== "evm") return false;
|
|
3177
|
+
return token.kind === "erc20" || token.kind === "native";
|
|
3178
|
+
},
|
|
3179
|
+
actions: [
|
|
3180
|
+
{
|
|
3181
|
+
id: "hyperliquid.limitOrder",
|
|
3182
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3183
|
+
chainCategory: "evm",
|
|
3184
|
+
description: "Place a Hyperliquid limit/IoC order via HyperEVM CoreWriter",
|
|
3185
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3186
|
+
params: {
|
|
3187
|
+
coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
|
|
3188
|
+
isBuy: { type: "boolean", required: true, description: "true for buy/long, false for sell/short" },
|
|
3189
|
+
limitPxHuman: { type: "string", required: true, description: "Limit price" },
|
|
3190
|
+
szHuman: { type: "string", required: true, description: "Order size in coin units" },
|
|
3191
|
+
marketKind: { type: "string", required: false, description: "perp (default) or spot" },
|
|
3192
|
+
tif: { type: "string", required: false, description: "gtc, ioc, or alo" },
|
|
3193
|
+
dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" }
|
|
3194
|
+
}
|
|
3195
|
+
},
|
|
3196
|
+
{
|
|
3197
|
+
id: "hyperliquid.close",
|
|
3198
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3199
|
+
chainCategory: "evm",
|
|
3200
|
+
description: "Close or reduce a perp via IoC reduce-only limit order (CoreWriter)",
|
|
3201
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3202
|
+
params: {
|
|
3203
|
+
coin: { type: "string", required: true, description: "Market coin" },
|
|
3204
|
+
isLong: { type: "boolean", required: true, description: "true if closing a long position" },
|
|
3205
|
+
limitPxHuman: { type: "string", required: true, description: "Limit price" },
|
|
3206
|
+
szHuman: { type: "string", required: true, description: "Size to close in coin units" }
|
|
3207
|
+
}
|
|
3208
|
+
},
|
|
3209
|
+
{
|
|
3210
|
+
id: "hyperliquid.cancel",
|
|
3211
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3212
|
+
chainCategory: "evm",
|
|
3213
|
+
description: "Cancel a Hyperliquid open order via CoreWriter",
|
|
3214
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3215
|
+
params: {
|
|
3216
|
+
coin: { type: "string", required: true, description: "Market coin" },
|
|
3217
|
+
oid: { type: "number", required: true, description: "Order id from openOrders" }
|
|
3218
|
+
}
|
|
3219
|
+
},
|
|
3220
|
+
{
|
|
3221
|
+
id: "hyperliquid.usdTransfer",
|
|
3222
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3223
|
+
chainCategory: "evm",
|
|
3224
|
+
description: "Move USDC between Hyperliquid spot and perp margin accounts",
|
|
3225
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3226
|
+
params: {
|
|
3227
|
+
usdHuman: { type: "string", required: true, description: "USD amount" },
|
|
3228
|
+
toPerp: { type: "boolean", required: true, description: "true spot\u2192perp, false perp\u2192spot" }
|
|
3229
|
+
}
|
|
3230
|
+
},
|
|
3231
|
+
{
|
|
3232
|
+
id: "hyperliquid.vaultDeposit",
|
|
3233
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3234
|
+
chainCategory: "evm",
|
|
3235
|
+
description: "Deposit USD into a Hyperliquid vault",
|
|
3236
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3237
|
+
params: {
|
|
3238
|
+
vaultAddress: { type: "string", required: true, description: "Vault address" },
|
|
3239
|
+
usdHuman: { type: "string", required: true, description: "USD amount" }
|
|
3240
|
+
}
|
|
3241
|
+
},
|
|
3242
|
+
{
|
|
3243
|
+
id: "hyperliquid.vaultWithdraw",
|
|
3244
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3245
|
+
chainCategory: "evm",
|
|
3246
|
+
description: "Withdraw USD from a Hyperliquid vault (includes accrued PnL)",
|
|
3247
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3248
|
+
params: {
|
|
3249
|
+
vaultAddress: { type: "string", required: true, description: "Vault address" },
|
|
3250
|
+
usdHuman: { type: "string", required: true, description: "USD amount" }
|
|
3251
|
+
}
|
|
3252
|
+
},
|
|
3253
|
+
{
|
|
3254
|
+
id: "hyperliquid.stake",
|
|
3255
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3256
|
+
chainCategory: "evm",
|
|
3257
|
+
description: "Stake HYPE via CoreWriter",
|
|
3258
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3259
|
+
params: {
|
|
3260
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" }
|
|
3261
|
+
}
|
|
3262
|
+
},
|
|
3263
|
+
{
|
|
3264
|
+
id: "hyperliquid.unstake",
|
|
3265
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3266
|
+
chainCategory: "evm",
|
|
3267
|
+
description: "Unstake HYPE via CoreWriter",
|
|
3268
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3269
|
+
params: {
|
|
3270
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" }
|
|
3271
|
+
}
|
|
3272
|
+
},
|
|
3273
|
+
{
|
|
3274
|
+
id: "hyperliquid.delegate",
|
|
3275
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3276
|
+
chainCategory: "evm",
|
|
3277
|
+
description: "Delegate staked HYPE to a validator",
|
|
3278
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3279
|
+
params: {
|
|
3280
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" },
|
|
3281
|
+
validator: { type: "string", required: true, description: "Validator address" }
|
|
3282
|
+
}
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
id: "hyperliquid.undelegate",
|
|
3286
|
+
protocolId: HYPERLIQUID_PROTOCOL_ID,
|
|
3287
|
+
chainCategory: "evm",
|
|
3288
|
+
description: "Undelegate HYPE from a validator",
|
|
3289
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3290
|
+
params: {
|
|
3291
|
+
hypeHuman: { type: "string", required: true, description: "HYPE amount" },
|
|
3292
|
+
validator: { type: "string", required: true, description: "Validator address" }
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
]
|
|
3296
|
+
};
|
|
3297
|
+
registerProtocolModule(hyperliquidProtocolModule);
|
|
3298
|
+
var MORPHO_GRAPHQL_URL = "https://api.morpho.org/graphql";
|
|
3299
|
+
async function morphoGql(query, variables) {
|
|
3300
|
+
const body = { query, variables: variables ?? {} };
|
|
3301
|
+
const j = await postJsonViaOptionalProxy({
|
|
3302
|
+
directUrl: MORPHO_GRAPHQL_URL,
|
|
3303
|
+
body,
|
|
3304
|
+
proxyUrl: getMorphoGraphqlProxyUrl(),
|
|
3305
|
+
proxyEnvelope: body
|
|
3306
|
+
});
|
|
3307
|
+
if (j.errors?.length) {
|
|
3308
|
+
const msg = j.errors.map((e) => e.message ?? "Unknown").join("; ");
|
|
3309
|
+
throw new Error(msg);
|
|
3310
|
+
}
|
|
3311
|
+
if (j.data == null) throw new Error("Morpho API: empty response");
|
|
3312
|
+
return j.data;
|
|
3313
|
+
}
|
|
3314
|
+
async function fetchMorphoChains() {
|
|
3315
|
+
const d = await morphoGql(`
|
|
3316
|
+
query { chains { id network } }
|
|
3317
|
+
`);
|
|
3318
|
+
return d.chains ?? [];
|
|
3319
|
+
}
|
|
3320
|
+
async function loadMorphoSupportedChainIds() {
|
|
3321
|
+
const rows = await fetchMorphoChains();
|
|
3322
|
+
const s = /* @__PURE__ */ new Set();
|
|
3323
|
+
for (const c of rows) {
|
|
3324
|
+
if (typeof c.id === "number" && Number.isFinite(c.id)) s.add(c.id);
|
|
3325
|
+
}
|
|
3326
|
+
return s;
|
|
3327
|
+
}
|
|
3328
|
+
var VAULT_PAGE_SIZE = 100;
|
|
3329
|
+
async function fetchMorphoVaultsForChain(chainId, first = 100) {
|
|
3330
|
+
const d = await morphoGql(
|
|
3331
|
+
`
|
|
3332
|
+
query MorphoVaults($chainId: Int!, $first: Int!) {
|
|
3333
|
+
vaults(first: $first, where: { chainId_in: [$chainId], listed: true }, orderBy: TotalAssetsUsd, orderDirection: Desc) {
|
|
3334
|
+
items {
|
|
3335
|
+
address symbol name listed
|
|
3336
|
+
asset { address symbol decimals price { usd } }
|
|
3337
|
+
chain { id }
|
|
3338
|
+
state { apy netApy fee totalAssetsUsd allRewards { supplyApr asset { address symbol } } }
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
`,
|
|
3343
|
+
{ chainId, first }
|
|
3344
|
+
);
|
|
3345
|
+
return d.vaults?.items ?? [];
|
|
3346
|
+
}
|
|
3347
|
+
async function fetchMorphoVaultV2sForChain(chainId, first = 100, skip = 0) {
|
|
3348
|
+
const d = await morphoGql(
|
|
3349
|
+
`
|
|
3350
|
+
query MorphoVaultV2s($chainId: Int!, $first: Int!, $skip: Int!) {
|
|
3351
|
+
vaultV2s(
|
|
3352
|
+
first: $first
|
|
3353
|
+
skip: $skip
|
|
3354
|
+
where: { chainId_in: [$chainId], listed: true }
|
|
3355
|
+
orderBy: TotalAssetsUsd
|
|
3356
|
+
orderDirection: Desc
|
|
3357
|
+
) {
|
|
3358
|
+
items {
|
|
3359
|
+
address symbol name listed
|
|
3360
|
+
asset { address symbol decimals price { usd } }
|
|
3361
|
+
chain { id }
|
|
3362
|
+
apy netApy performanceFee managementFee totalAssetsUsd
|
|
3363
|
+
rewards { supplyApr asset { address symbol } }
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
`,
|
|
3368
|
+
{ chainId, first, skip }
|
|
3369
|
+
);
|
|
3370
|
+
return d.vaultV2s?.items ?? [];
|
|
3371
|
+
}
|
|
3372
|
+
async function fetchAllMorphoVaultV2AssetAddresses(chainId) {
|
|
3373
|
+
const out = /* @__PURE__ */ new Set();
|
|
3374
|
+
let skip = 0;
|
|
3375
|
+
for (let page = 0; page < 20; page++) {
|
|
3376
|
+
const batch = await fetchMorphoVaultV2sForChain(chainId, VAULT_PAGE_SIZE, skip);
|
|
3377
|
+
if (!batch.length) break;
|
|
3378
|
+
for (const v of batch) {
|
|
3379
|
+
const a = (v.asset?.address ?? "").trim();
|
|
3380
|
+
if (viem.isAddress(a)) out.add(viem.getAddress(a).toLowerCase());
|
|
3381
|
+
}
|
|
3382
|
+
if (batch.length < VAULT_PAGE_SIZE) break;
|
|
3383
|
+
skip += VAULT_PAGE_SIZE;
|
|
3384
|
+
}
|
|
3385
|
+
return out;
|
|
3386
|
+
}
|
|
3387
|
+
var chainAssetCache = /* @__PURE__ */ new Map();
|
|
3388
|
+
async function ensureMorphoChainAssetCache(chainId) {
|
|
3389
|
+
const hit = chainAssetCache.get(chainId);
|
|
3390
|
+
if (hit) return hit;
|
|
3391
|
+
const modes = /* @__PURE__ */ new Map();
|
|
3392
|
+
const [v1Vaults, v2Assets] = await Promise.all([
|
|
3393
|
+
fetchMorphoVaultsForChain(chainId, 300),
|
|
3394
|
+
fetchAllMorphoVaultV2AssetAddresses(chainId)
|
|
3395
|
+
]);
|
|
3396
|
+
for (const v of v1Vaults) {
|
|
3397
|
+
const a = (v.asset?.address ?? "").trim();
|
|
3398
|
+
if (!viem.isAddress(a)) continue;
|
|
3399
|
+
const k = viem.getAddress(a).toLowerCase();
|
|
3400
|
+
const prev = modes.get(k) ?? { earn: false, borrow: false, collateral: false };
|
|
3401
|
+
prev.earn = true;
|
|
3402
|
+
modes.set(k, prev);
|
|
3403
|
+
}
|
|
3404
|
+
for (const k of v2Assets) {
|
|
3405
|
+
const prev = modes.get(k) ?? { earn: false, borrow: false, collateral: false };
|
|
3406
|
+
prev.earn = true;
|
|
3407
|
+
modes.set(k, prev);
|
|
3408
|
+
}
|
|
3409
|
+
const marketsD = await morphoGql(
|
|
3410
|
+
`
|
|
3411
|
+
query MorphoMarketsAssets($chainId: Int!) {
|
|
3412
|
+
markets(first: 500, where: { chainId_in: [$chainId] }) {
|
|
3413
|
+
items {
|
|
3414
|
+
loanAsset { address }
|
|
3415
|
+
collateralAsset { address }
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
`,
|
|
3420
|
+
{ chainId }
|
|
3421
|
+
);
|
|
3422
|
+
for (const m of marketsD.markets?.items ?? []) {
|
|
3423
|
+
const loanAddr = (m.loanAsset?.address ?? "").trim();
|
|
3424
|
+
const colAddr = (m.collateralAsset?.address ?? "").trim();
|
|
3425
|
+
if (viem.isAddress(loanAddr)) {
|
|
3426
|
+
const k = viem.getAddress(loanAddr).toLowerCase();
|
|
3427
|
+
const prev = modes.get(k) ?? { earn: false, borrow: false, collateral: false };
|
|
3428
|
+
prev.borrow = true;
|
|
3429
|
+
modes.set(k, prev);
|
|
3430
|
+
}
|
|
3431
|
+
if (viem.isAddress(colAddr)) {
|
|
3432
|
+
const k = viem.getAddress(colAddr).toLowerCase();
|
|
3433
|
+
const prev = modes.get(k) ?? { earn: false, borrow: false, collateral: false };
|
|
3434
|
+
prev.collateral = true;
|
|
3435
|
+
modes.set(k, prev);
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
const cache = { modesByUnderlying: modes, nativeWrapped: null };
|
|
3439
|
+
chainAssetCache.set(chainId, cache);
|
|
3440
|
+
return cache;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
// src/protocols/evm/morpho/index.ts
|
|
3444
|
+
var MORPHO_PROTOCOL_ID = "morpho";
|
|
3445
|
+
var morphoProtocolModule = {
|
|
3446
|
+
id: MORPHO_PROTOCOL_ID,
|
|
3447
|
+
chainCategory: "evm",
|
|
3448
|
+
isChainSupported(ctx) {
|
|
3449
|
+
return ctx.chainCategory === "evm";
|
|
3450
|
+
},
|
|
3451
|
+
isTokenSupported(token) {
|
|
3452
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
3453
|
+
},
|
|
3454
|
+
actions: [
|
|
3455
|
+
{ id: "morpho.fetch-earn-vaults", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Search Morpho-listed earn vaults by asset or name", commonParams: [], params: {} },
|
|
3456
|
+
{ id: "morpho.vault-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Morpho-listed earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3457
|
+
{ id: "morpho.vault-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Morpho earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3458
|
+
{ id: "morpho.blue-collateral-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Supply collateral to Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3459
|
+
{ id: "morpho.blue-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3460
|
+
{ id: "morpho.blue-repay", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Repay Morpho Blue borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3461
|
+
{ id: "morpho.blue-collateral-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw Morpho Blue collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3462
|
+
{ id: "morpho.merkl-claim", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Claim Morpho Merkl rewards", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3463
|
+
{ id: "morpho.midnight-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight fixed-rate borrow (coming soon)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3464
|
+
]
|
|
3465
|
+
};
|
|
3466
|
+
registerProtocolModule(morphoProtocolModule);
|
|
2416
3467
|
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");
|
|
2417
3468
|
var SKILL_PROTOCOL_IDS = [
|
|
2418
3469
|
"aave-v4",
|
|
@@ -2423,7 +3474,9 @@ var SKILL_PROTOCOL_IDS = [
|
|
|
2423
3474
|
"euler-v2",
|
|
2424
3475
|
"maple-syrup",
|
|
2425
3476
|
"sky",
|
|
2426
|
-
"gmx"
|
|
3477
|
+
"gmx",
|
|
3478
|
+
"hyperliquid",
|
|
3479
|
+
"morpho"
|
|
2427
3480
|
];
|
|
2428
3481
|
function getToolsForProtocol(protocolId) {
|
|
2429
3482
|
return MCP_TOOL_DEFINITIONS.filter((t) => t.protocolId === protocolId);
|
|
@@ -2637,6 +3690,37 @@ var PROTOCOL_SUPPORT_ADVISORS = {
|
|
|
2637
3690
|
return { tokens: [] };
|
|
2638
3691
|
}
|
|
2639
3692
|
}),
|
|
3693
|
+
morpho: advisor("morpho", "api_underlyings", {
|
|
3694
|
+
async supportedChainIds() {
|
|
3695
|
+
const set = await loadMorphoSupportedChainIds();
|
|
3696
|
+
return [...set].sort((a, b) => a - b);
|
|
3697
|
+
},
|
|
3698
|
+
async supportedTokens(chainId) {
|
|
3699
|
+
const cache = await ensureMorphoChainAssetCache(chainId);
|
|
3700
|
+
const tokens = [...cache.modesByUnderlying.entries()].map(([address, modes]) => ({
|
|
3701
|
+
address,
|
|
3702
|
+
roles: [
|
|
3703
|
+
...modes.earn ? ["vault_underlying"] : [],
|
|
3704
|
+
...modes.borrow ? ["loan"] : [],
|
|
3705
|
+
...modes.collateral ? ["collateral"] : []
|
|
3706
|
+
]
|
|
3707
|
+
}));
|
|
3708
|
+
return {
|
|
3709
|
+
tokens,
|
|
3710
|
+
notes: "Morpho vault assets and Blue market loan/collateral tokens from api.morpho.org."
|
|
3711
|
+
};
|
|
3712
|
+
},
|
|
3713
|
+
async isTokenSupported(chainId, address) {
|
|
3714
|
+
const cache = await ensureMorphoChainAssetCache(chainId);
|
|
3715
|
+
let normalized;
|
|
3716
|
+
try {
|
|
3717
|
+
normalized = viem.getAddress(address).toLowerCase();
|
|
3718
|
+
} catch {
|
|
3719
|
+
return false;
|
|
3720
|
+
}
|
|
3721
|
+
return cache.modesByUnderlying.has(normalized);
|
|
3722
|
+
}
|
|
3723
|
+
}),
|
|
2640
3724
|
"euler-v2": advisor("euler-v2", "subgraph_vaults", {
|
|
2641
3725
|
async supportedChainIds() {
|
|
2642
3726
|
return [...EULER_V2_SUBGRAPH_CHAIN_IDS];
|
|
@@ -2717,6 +3801,8 @@ registerProtocolModule(skyProtocolModule);
|
|
|
2717
3801
|
registerProtocolModule(aaveV4ProtocolModule);
|
|
2718
3802
|
registerProtocolModule(eulerV2ProtocolModule);
|
|
2719
3803
|
registerProtocolModule(gmxProtocolModule);
|
|
3804
|
+
registerProtocolModule(hyperliquidProtocolModule);
|
|
3805
|
+
registerProtocolModule(morphoProtocolModule);
|
|
2720
3806
|
function getAgentCatalog() {
|
|
2721
3807
|
return {
|
|
2722
3808
|
protocols: getProtocolModules(),
|
|
@@ -2734,6 +3820,8 @@ function getAgentCatalog() {
|
|
|
2734
3820
|
aaveV4: aaveV4ProtocolModule,
|
|
2735
3821
|
eulerV2: eulerV2ProtocolModule,
|
|
2736
3822
|
gmx: gmxProtocolModule,
|
|
3823
|
+
hyperliquid: hyperliquidProtocolModule,
|
|
3824
|
+
morpho: morphoProtocolModule,
|
|
2737
3825
|
/** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
|
|
2738
3826
|
mcp: getAgentCatalogForMcp()
|
|
2739
3827
|
};
|
|
@@ -2806,6 +3894,40 @@ exports.mcpGmxIncreaseInputSchema = mcpGmxIncreaseInputSchema;
|
|
|
2806
3894
|
exports.mcpGmxMultisignOutputSchema = mcpServerSubmitOutputSchema;
|
|
2807
3895
|
exports.mcpGmxStakeGmxInputSchema = mcpGmxStakeGmxInputSchema;
|
|
2808
3896
|
exports.mcpGmxUnstakeGmxInputSchema = mcpGmxUnstakeGmxInputSchema;
|
|
3897
|
+
exports.mcpHyperliquidCancelInputSchema = mcpHyperliquidCancelInputSchema;
|
|
3898
|
+
exports.mcpHyperliquidCloseInputSchema = mcpHyperliquidCloseInputSchema;
|
|
3899
|
+
exports.mcpHyperliquidDelegateInputSchema = mcpHyperliquidDelegateInputSchema;
|
|
3900
|
+
exports.mcpHyperliquidFetchDelegationsInputSchema = mcpHyperliquidFetchDelegationsInputSchema;
|
|
3901
|
+
exports.mcpHyperliquidFetchDelegationsOutputSchema = mcpHyperliquidFetchDelegationsOutputSchema;
|
|
3902
|
+
exports.mcpHyperliquidFetchMarketSnapshotInputSchema = mcpHyperliquidFetchMarketSnapshotInputSchema;
|
|
3903
|
+
exports.mcpHyperliquidFetchMarketSnapshotOutputSchema = mcpHyperliquidFetchMarketSnapshotOutputSchema;
|
|
3904
|
+
exports.mcpHyperliquidFetchMarketsInputSchema = mcpHyperliquidFetchMarketsInputSchema;
|
|
3905
|
+
exports.mcpHyperliquidFetchMarketsOutputSchema = mcpHyperliquidFetchMarketsOutputSchema;
|
|
3906
|
+
exports.mcpHyperliquidFetchOhlcvInputSchema = mcpHyperliquidFetchOhlcvInputSchema;
|
|
3907
|
+
exports.mcpHyperliquidFetchOhlcvOutputSchema = mcpHyperliquidFetchOhlcvOutputSchema;
|
|
3908
|
+
exports.mcpHyperliquidFetchOpenContextInputSchema = mcpHyperliquidFetchOpenContextInputSchema;
|
|
3909
|
+
exports.mcpHyperliquidFetchOpenContextOutputSchema = mcpHyperliquidFetchOpenContextOutputSchema;
|
|
3910
|
+
exports.mcpHyperliquidFetchOpenOrdersInputSchema = mcpHyperliquidFetchOpenOrdersInputSchema;
|
|
3911
|
+
exports.mcpHyperliquidFetchOpenOrdersOutputSchema = mcpHyperliquidFetchOpenOrdersOutputSchema;
|
|
3912
|
+
exports.mcpHyperliquidFetchPositionsInputSchema = mcpHyperliquidFetchPositionsInputSchema;
|
|
3913
|
+
exports.mcpHyperliquidFetchPositionsOutputSchema = mcpHyperliquidFetchPositionsOutputSchema;
|
|
3914
|
+
exports.mcpHyperliquidFetchStakingSummaryInputSchema = mcpHyperliquidFetchStakingSummaryInputSchema;
|
|
3915
|
+
exports.mcpHyperliquidFetchStakingSummaryOutputSchema = mcpHyperliquidFetchStakingSummaryOutputSchema;
|
|
3916
|
+
exports.mcpHyperliquidFetchUsdClassBalancesInputSchema = mcpHyperliquidFetchUsdClassBalancesInputSchema;
|
|
3917
|
+
exports.mcpHyperliquidFetchUsdClassBalancesOutputSchema = mcpHyperliquidFetchUsdClassBalancesOutputSchema;
|
|
3918
|
+
exports.mcpHyperliquidFetchUserVaultEquitiesInputSchema = mcpHyperliquidFetchUserVaultEquitiesInputSchema;
|
|
3919
|
+
exports.mcpHyperliquidFetchUserVaultEquitiesOutputSchema = mcpHyperliquidFetchUserVaultEquitiesOutputSchema;
|
|
3920
|
+
exports.mcpHyperliquidFetchVaultsInputSchema = mcpHyperliquidFetchVaultsInputSchema;
|
|
3921
|
+
exports.mcpHyperliquidFetchVaultsOutputSchema = mcpHyperliquidFetchVaultsOutputSchema;
|
|
3922
|
+
exports.mcpHyperliquidLimitOrderInputSchema = mcpHyperliquidLimitOrderInputSchema;
|
|
3923
|
+
exports.mcpHyperliquidSearchMarketsInputSchema = mcpHyperliquidSearchMarketsInputSchema;
|
|
3924
|
+
exports.mcpHyperliquidSearchMarketsOutputSchema = mcpHyperliquidSearchMarketsOutputSchema;
|
|
3925
|
+
exports.mcpHyperliquidStakeInputSchema = mcpHyperliquidStakeInputSchema;
|
|
3926
|
+
exports.mcpHyperliquidUndelegateInputSchema = mcpHyperliquidUndelegateInputSchema;
|
|
3927
|
+
exports.mcpHyperliquidUnstakeInputSchema = mcpHyperliquidUnstakeInputSchema;
|
|
3928
|
+
exports.mcpHyperliquidUsdTransferInputSchema = mcpHyperliquidUsdTransferInputSchema;
|
|
3929
|
+
exports.mcpHyperliquidVaultDepositInputSchema = mcpHyperliquidVaultDepositInputSchema;
|
|
3930
|
+
exports.mcpHyperliquidVaultWithdrawInputSchema = mcpHyperliquidVaultWithdrawInputSchema;
|
|
2809
3931
|
exports.mcpLidoClaimWithdrawalInputSchema = mcpLidoClaimWithdrawalInputSchema;
|
|
2810
3932
|
exports.mcpLidoRequestWithdrawalsInputSchema = mcpLidoRequestWithdrawalsInputSchema;
|
|
2811
3933
|
exports.mcpLidoSubmitInputSchema = mcpLidoSubmitInputSchema;
|
|
@@ -2813,6 +3935,15 @@ exports.mcpLidoUnwrapWstEthInputSchema = mcpLidoUnwrapWstEthInputSchema;
|
|
|
2813
3935
|
exports.mcpLidoWrapStEthInputSchema = mcpLidoWrapStEthInputSchema;
|
|
2814
3936
|
exports.mcpMapleDepositInputSchema = mcpMapleDepositInputSchema;
|
|
2815
3937
|
exports.mcpMapleRequestRedeemInputSchema = mcpMapleRequestRedeemInputSchema;
|
|
3938
|
+
exports.mcpMorphoBlueBorrowInputSchema = mcpMorphoBlueBorrowInputSchema;
|
|
3939
|
+
exports.mcpMorphoBlueCollateralDepositInputSchema = mcpMorphoBlueCollateralDepositInputSchema;
|
|
3940
|
+
exports.mcpMorphoBlueCollateralWithdrawInputSchema = mcpMorphoBlueCollateralWithdrawInputSchema;
|
|
3941
|
+
exports.mcpMorphoBlueRepayInputSchema = mcpMorphoBlueRepayInputSchema;
|
|
3942
|
+
exports.mcpMorphoFetchEarnVaultsInputSchema = mcpMorphoFetchEarnVaultsInputSchema;
|
|
3943
|
+
exports.mcpMorphoFetchEarnVaultsOutputSchema = mcpMorphoFetchEarnVaultsOutputSchema;
|
|
3944
|
+
exports.mcpMorphoMerklClaimInputSchema = mcpMorphoMerklClaimInputSchema;
|
|
3945
|
+
exports.mcpMorphoVaultDepositInputSchema = mcpMorphoVaultDepositInputSchema;
|
|
3946
|
+
exports.mcpMorphoVaultWithdrawInputSchema = mcpMorphoVaultWithdrawInputSchema;
|
|
2816
3947
|
exports.mcpMultisignInput = mcpMultisignInput;
|
|
2817
3948
|
exports.mcpMultisignOutputSchema = multisignOutputSchema;
|
|
2818
3949
|
exports.mcpMultisignSubmitOutputSchema = mcpServerSubmitOutputSchema;
|