@2oolkit/hyperliquid-cli
Advanced tools
+152
-99
@@ -1062,6 +1062,8 @@ #!/usr/bin/env node | ||
| function registerMarketTools(server2) { | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_all_mids", | ||
| "Get all mid prices for perpetual and spot assets on Hyperliquid", | ||
| {}, | ||
| { | ||
| description: "Get all mid prices for perpetual and spot assets on Hyperliquid", | ||
| inputSchema: import_zod.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1073,8 +1075,10 @@ const client = createPublicClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_meta", | ||
| 'Get perpetual market metadata (instruments, max leverage, decimals). Use dex param for HIP-3 builder-deployed perps (e.g., "xyz")', | ||
| { | ||
| spot: import_zod.z.boolean().optional().describe("Get spot metadata instead"), | ||
| dex: import_zod.z.string().optional().describe("HIP-3 dex name (e.g., xyz) for builder-deployed perps") | ||
| description: 'Get perpetual market metadata (instruments, max leverage, decimals). Use dex param for HIP-3 builder-deployed perps (e.g., "xyz")', | ||
| inputSchema: import_zod.z.object({ | ||
| spot: import_zod.z.boolean().optional().describe("Get spot metadata instead"), | ||
| dex: import_zod.z.string().optional().describe("HIP-3 dex name (e.g., xyz) for builder-deployed perps") | ||
| }) | ||
| }, | ||
@@ -1087,8 +1091,10 @@ async ({ spot, dex }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_ticker", | ||
| "Get ticker data for a specific coin including price, volume, funding. Use dex:coin format for HIP-3 (e.g., xyz:CL)", | ||
| { | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| spot: import_zod.z.boolean().optional().describe("Get spot ticker") | ||
| description: "Get ticker data for a specific coin including price, volume, funding. Use dex:coin format for HIP-3 (e.g., xyz:CL)", | ||
| inputSchema: import_zod.z.object({ | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| spot: import_zod.z.boolean().optional().describe("Get spot ticker") | ||
| }) | ||
| }, | ||
@@ -1109,8 +1115,10 @@ async ({ coin, spot }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_orderbook", | ||
| "Get L2 order book for a coin", | ||
| { | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| depth: import_zod.z.number().min(2).max(5).optional().describe("Significant figures (2-5)") | ||
| description: "Get L2 order book for a coin", | ||
| inputSchema: import_zod.z.object({ | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| depth: import_zod.z.number().min(2).max(5).optional().describe("Significant figures (2-5)") | ||
| }) | ||
| }, | ||
@@ -1124,9 +1132,11 @@ async ({ coin, depth }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_candles", | ||
| "Get OHLCV candlestick data for a coin", | ||
| { | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| interval: import_zod.z.string().describe("Candle interval (1m, 5m, 15m, 1h, 4h, 1d, etc.)"), | ||
| count: import_zod.z.number().min(1).max(5e3).optional().describe("Number of candles (default 50)") | ||
| description: "Get OHLCV candlestick data for a coin", | ||
| inputSchema: import_zod.z.object({ | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| interval: import_zod.z.string().describe("Candle interval (1m, 5m, 15m, 1h, 4h, 1d, etc.)"), | ||
| count: import_zod.z.number().min(1).max(5e3).optional().describe("Number of candles (default 50)") | ||
| }) | ||
| }, | ||
@@ -1146,9 +1156,11 @@ async ({ coin, interval, count }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_funding", | ||
| "Get funding rate history or predicted funding rates", | ||
| { | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| hours: import_zod.z.number().optional().describe("Hours to look back (default 24)"), | ||
| predicted: import_zod.z.boolean().optional().describe("Get predicted funding instead") | ||
| description: "Get funding rate history or predicted funding rates", | ||
| inputSchema: import_zod.z.object({ | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)"), | ||
| hours: import_zod.z.number().optional().describe("Hours to look back (default 24)"), | ||
| predicted: import_zod.z.boolean().optional().describe("Get predicted funding instead") | ||
| }) | ||
| }, | ||
@@ -1169,6 +1181,10 @@ async ({ coin, hours, predicted }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_recent_trades", | ||
| "Get recent trades for a coin", | ||
| { coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)") }, | ||
| { | ||
| description: "Get recent trades for a coin", | ||
| inputSchema: import_zod.z.object({ | ||
| coin: import_zod.z.string().describe("Coin name (e.g., BTC, ETH, xyz:CL for HIP-3)") | ||
| }) | ||
| }, | ||
| async ({ coin }) => withErrorHandling(async () => { | ||
@@ -1186,15 +1202,17 @@ const client = createPublicClient(); | ||
| function registerOrderTools(server2) { | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "place_order", | ||
| "Place an order on Hyperliquid (limit, market, stop-loss, take-profit)", | ||
| { | ||
| coin: import_zod2.z.string().describe("Coin name (e.g., BTC, ETH)"), | ||
| side: import_zod2.z.enum(["buy", "sell"]).describe("Order side"), | ||
| size: import_zod2.z.string().describe("Order size"), | ||
| price: import_zod2.z.string().describe("Order price"), | ||
| tif: import_zod2.z.enum(["Gtc", "Alo", "Ioc"]).optional().describe("Time in force (default: Gtc)"), | ||
| reduce_only: import_zod2.z.boolean().optional().describe("Reduce only order"), | ||
| trigger_px: import_zod2.z.string().optional().describe("Trigger price for stop/TP orders"), | ||
| tpsl: import_zod2.z.enum(["tp", "sl"]).optional().describe("TP or SL (when using trigger)"), | ||
| cloid: import_zod2.z.string().optional().describe("Client order ID (128-bit hex)") | ||
| description: "Place an order on Hyperliquid (limit, market, stop-loss, take-profit)", | ||
| inputSchema: import_zod2.z.object({ | ||
| coin: import_zod2.z.string().describe("Coin name (e.g., BTC, ETH)"), | ||
| side: import_zod2.z.enum(["buy", "sell"]).describe("Order side"), | ||
| size: import_zod2.z.string().describe("Order size"), | ||
| price: import_zod2.z.string().describe("Order price"), | ||
| tif: import_zod2.z.enum(["Gtc", "Alo", "Ioc"]).optional().describe("Time in force (default: Gtc)"), | ||
| reduce_only: import_zod2.z.boolean().optional().describe("Reduce only order"), | ||
| trigger_px: import_zod2.z.string().optional().describe("Trigger price for stop/TP orders"), | ||
| tpsl: import_zod2.z.enum(["tp", "sl"]).optional().describe("TP or SL (when using trigger)"), | ||
| cloid: import_zod2.z.string().optional().describe("Client order ID (128-bit hex)") | ||
| }) | ||
| }, | ||
@@ -1226,8 +1244,10 @@ async (params) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "cancel_order", | ||
| "Cancel an order by its order ID", | ||
| { | ||
| coin: import_zod2.z.string().describe("Coin name"), | ||
| oid: import_zod2.z.number().describe("Order ID") | ||
| description: "Cancel an order by its order ID", | ||
| inputSchema: import_zod2.z.object({ | ||
| coin: import_zod2.z.string().describe("Coin name"), | ||
| oid: import_zod2.z.number().describe("Order ID") | ||
| }) | ||
| }, | ||
@@ -1243,6 +1263,8 @@ async ({ coin, oid }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "list_open_orders", | ||
| "List all open orders", | ||
| {}, | ||
| { | ||
| description: "List all open orders", | ||
| inputSchema: import_zod2.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1255,7 +1277,9 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_order_status", | ||
| "Get the status of a specific order", | ||
| { | ||
| oid: import_zod2.z.union([import_zod2.z.number(), import_zod2.z.string()]).describe("Order ID or client order ID") | ||
| description: "Get the status of a specific order", | ||
| inputSchema: import_zod2.z.object({ | ||
| oid: import_zod2.z.union([import_zod2.z.number(), import_zod2.z.string()]).describe("Order ID or client order ID") | ||
| }) | ||
| }, | ||
@@ -1269,6 +1293,8 @@ async ({ oid }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_order_history", | ||
| "List historical orders (max 2000)", | ||
| {}, | ||
| { | ||
| description: "List historical orders (max 2000)", | ||
| inputSchema: import_zod2.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1281,7 +1307,9 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_user_fills", | ||
| "Get recent trade fills", | ||
| { | ||
| hours: import_zod2.z.number().optional().describe("Hours to look back") | ||
| description: "Get recent trade fills", | ||
| inputSchema: import_zod2.z.object({ | ||
| hours: import_zod2.z.number().optional().describe("Hours to look back") | ||
| }) | ||
| }, | ||
@@ -1306,6 +1334,8 @@ async ({ hours }) => withErrorHandling(async () => { | ||
| function registerPositionTools(server2) { | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "list_positions", | ||
| "List all open perpetual positions with PnL, leverage, and liquidation price", | ||
| {}, | ||
| { | ||
| description: "List all open perpetual positions with PnL, leverage, and liquidation price", | ||
| inputSchema: import_zod3.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1318,9 +1348,11 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "update_leverage", | ||
| "Update leverage for a perpetual asset", | ||
| { | ||
| coin: import_zod3.z.string().describe("Coin name (e.g., BTC, ETH)"), | ||
| leverage: import_zod3.z.number().min(1).describe("Leverage value"), | ||
| isolated: import_zod3.z.boolean().optional().describe("Use isolated margin (default: cross)") | ||
| description: "Update leverage for a perpetual asset", | ||
| inputSchema: import_zod3.z.object({ | ||
| coin: import_zod3.z.string().describe("Coin name (e.g., BTC, ETH)"), | ||
| leverage: import_zod3.z.number().min(1).describe("Leverage value"), | ||
| isolated: import_zod3.z.boolean().optional().describe("Use isolated margin (default: cross)") | ||
| }) | ||
| }, | ||
@@ -1339,7 +1371,10 @@ async ({ coin, leverage, isolated }) => withErrorHandling(async () => { | ||
| // src/mcp/tools/account.ts | ||
| var import_zod4 = require("zod"); | ||
| function registerAccountTools(server2) { | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_account_state", | ||
| "Get perpetual account state (positions, margin summary, balances)", | ||
| {}, | ||
| { | ||
| description: "Get perpetual account state (positions, margin summary, balances)", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1352,6 +1387,8 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_spot_balances", | ||
| "Get spot token balances", | ||
| {}, | ||
| { | ||
| description: "Get spot token balances", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1364,6 +1401,8 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_portfolio", | ||
| "Get portfolio summary with PnL history", | ||
| {}, | ||
| { | ||
| description: "Get portfolio summary with PnL history", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1376,6 +1415,8 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_user_fees", | ||
| "Get fee schedule and current rates", | ||
| {}, | ||
| { | ||
| description: "Get fee schedule and current rates", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1388,6 +1429,8 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_rate_limit", | ||
| "Get current rate limit status", | ||
| {}, | ||
| { | ||
| description: "Get current rate limit status", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1400,6 +1443,8 @@ const auth = createAuthClient(); | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "get_sub_accounts", | ||
| "List sub-accounts", | ||
| {}, | ||
| { | ||
| description: "List sub-accounts", | ||
| inputSchema: import_zod4.z.object({}) | ||
| }, | ||
| async () => withErrorHandling(async () => { | ||
@@ -1415,10 +1460,12 @@ const auth = createAuthClient(); | ||
| // src/mcp/tools/transfer.ts | ||
| var import_zod4 = require("zod"); | ||
| var import_zod5 = require("zod"); | ||
| function registerTransferTools(server2) { | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "usd_send", | ||
| "Send USDC to another address on Hyperliquid", | ||
| { | ||
| destination: import_zod4.z.string().describe("Destination address"), | ||
| amount: import_zod4.z.string().describe("Amount of USDC") | ||
| description: "Send USDC to another address on Hyperliquid", | ||
| inputSchema: import_zod5.z.object({ | ||
| destination: import_zod5.z.string().describe("Destination address"), | ||
| amount: import_zod5.z.string().describe("Amount of USDC") | ||
| }) | ||
| }, | ||
@@ -1432,9 +1479,11 @@ async ({ destination, amount }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "spot_send", | ||
| "Send a spot token to another address", | ||
| { | ||
| destination: import_zod4.z.string().describe("Destination address"), | ||
| token: import_zod4.z.string().describe("Token identifier (e.g., PURR:0x...)"), | ||
| amount: import_zod4.z.string().describe("Amount to send") | ||
| description: "Send a spot token to another address", | ||
| inputSchema: import_zod5.z.object({ | ||
| destination: import_zod5.z.string().describe("Destination address"), | ||
| token: import_zod5.z.string().describe("Token identifier (e.g., PURR:0x...)"), | ||
| amount: import_zod5.z.string().describe("Amount to send") | ||
| }) | ||
| }, | ||
@@ -1448,8 +1497,10 @@ async ({ destination, token, amount }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "withdraw", | ||
| "Withdraw USDC to Arbitrum (~5 min finalization, $1 fee)", | ||
| { | ||
| destination: import_zod4.z.string().describe("Destination address on Arbitrum"), | ||
| amount: import_zod4.z.string().describe("Amount of USDC") | ||
| description: "Withdraw USDC to Arbitrum (~5 min finalization, $1 fee)", | ||
| inputSchema: import_zod5.z.object({ | ||
| destination: import_zod5.z.string().describe("Destination address on Arbitrum"), | ||
| amount: import_zod5.z.string().describe("Amount of USDC") | ||
| }) | ||
| }, | ||
@@ -1463,8 +1514,10 @@ async ({ destination, amount }) => withErrorHandling(async () => { | ||
| ); | ||
| server2.tool( | ||
| server2.registerTool( | ||
| "usd_class_transfer", | ||
| "Transfer USDC between spot and perpetuals accounts", | ||
| { | ||
| amount: import_zod4.z.string().describe("Amount to transfer"), | ||
| to_perp: import_zod4.z.boolean().describe("true = spot->perp, false = perp->spot") | ||
| description: "Transfer USDC between spot and perpetuals accounts", | ||
| inputSchema: import_zod5.z.object({ | ||
| amount: import_zod5.z.string().describe("Amount to transfer"), | ||
| to_perp: import_zod5.z.boolean().describe("true = spot->perp, false = perp->spot") | ||
| }) | ||
| }, | ||
@@ -1471,0 +1524,0 @@ async ({ amount, to_perp }) => withErrorHandling(async () => { |
+1
-1
| { | ||
| "name": "@2oolkit/hyperliquid-cli", | ||
| "version": "0.2.2", | ||
| "version": "0.2.3", | ||
| "description": "CLI & MCP server for Hyperliquid DEX — trade perpetuals & spot, manage orders, and query market data", | ||
@@ -5,0 +5,0 @@ "author": "haeminmoon", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
381651
1.29%3431
1.57%