Skip to main content
Glama
mektigboy

Hyperliquid MCP Server

by mektigboy

get_candle_snapshot

Retrieve candlestick data for specific tokens on Hyperliquid exchange to analyze price movements and market trends over defined time intervals.

Instructions

Get candlestick data for a token on Hyperliquid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesThe symbol of the token to get candlestick data for
intervalYesTime interval (e.g., '15m', '1h')
startTimeYesStart time in milliseconds since epoch
endTimeNoEnd time in milliseconds since epoch (optional)

Implementation Reference

  • The main handler function that validates the input arguments using candleSnapshotSchema, fetches the candle snapshot data from the Hyperliquid client, and returns a formatted response.
    export async function getCandleSnapshot( hyperliquidClient: PublicClient, args: unknown ) { const validatedArgs = candleSnapshotSchema.parse(args); const candleSnapshot = await hyperliquidClient.candleSnapshot(validatedArgs); return { content: [{ type: "text", text: JSON.stringify(candleSnapshot) }], isError: false, }; }
  • Zod schema for validating and transforming the input arguments (symbol to coin) for the get_candle_snapshot tool.
    export const candleSnapshotSchema = z .object({ symbol: z.string({ required_error: "Symbol must be a string" }), interval: z.string({ required_error: "Interval must be a string" }), startTime: z.number({ required_error: "Start time must be a number" }), endTime: z.number().nullable().optional(), }) .strict() .transform((data) => ({ coin: data.symbol, interval: data.interval, startTime: data.startTime, endTime: data.endTime, }));
  • src/index.ts:49-51 (registration)
    Registration of the tool handler in the switch statement of the CallToolRequest handler.
    case "get_candle_snapshot": { return await getCandleSnapshot(hyperliquidClient, args); }
  • MCP Tool definition including the name, description, and input schema for get_candle_snapshot.
    export const CANDLE_SNAPSHOT_TOOL: Tool = { name: "get_candle_snapshot", description: "Get candlestick data for a token on Hyperliquid", inputSchema: { type: "object", properties: { coin: { type: "string", description: "The symbol of the token to get candlestick data for", }, interval: { type: "string", description: "Time interval (e.g., '15m', '1h')", }, startTime: { type: "number", description: "Start time in milliseconds since epoch", }, endTime: { type: "number", description: "End time in milliseconds since epoch (optional)", }, }, required: ["coin", "interval", "startTime"], }, };
  • src/index.ts:75-80 (registration)
    Registration of the tool in the ListToolsRequest handler, including CANDLE_SNAPSHOT_TOOL in the returned tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("Received ListToolsRequest"); return { tools: [ALL_MIDS_TOOL, CANDLE_SNAPSHOT_TOOL, L2_BOOK_TOOL], }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mektigboy/server-hyperliquid'

If you have feedback or need assistance with the MCP directory API, please join our Discord server