Sponsored by Deepsite.site

Hyperliquid MCP Server

Created By
TradingBalthazar10 months ago
Hyperliquid MCP Server - A comprehensive wrapper around the Hyperliquid SDK for AI assistants
Content

Hyperliquid MCP Server

A comprehensive Model Context Protocol (MCP) server that wraps the Hyperliquid SDK, providing cryptocurrency trading capabilities to AI assistants.

Overview

This MCP server enables AI assistants to interact with the Hyperliquid exchange for retrieving market data, executing trades, managing positions, and more. It implements the Model Context Protocol to expose the full range of trading functionality.

Features

  • Complete implementation of all Hyperliquid SDK APIs for both spot and futures trading
  • Market data retrieval (prices, order books, candles)
  • Order placement and management (market, limit, trigger, TWAP)
  • Position management (leverage, margin, closing)
  • Account information and balances
  • Funding rate information
  • Transfers and withdrawals
  • Vault management
  • Sub-account management
  • Referral system integration

Technical Features

  • Proper authentication using both private key and wallet address
  • Comprehensive error handling and validation
  • Real-time market data access
  • Support for client order IDs (cloid) for order tracking
  • Support for both testnet and mainnet

Prerequisites

  • Node.js (v14 or higher)
  • A Hyperliquid account
  • An Ethereum private key for authentication (required for trading)
  • Your wallet address (required for trading)

Installation

# Clone the repository
git clone https://github.com/TradingBalthazar/hyperliquid-mcp-server.git

# Navigate to the project directory
cd hyperliquid-mcp-server

# Install dependencies
npm install

Configuration

The server can be configured using environment variables or a configuration file:

Environment Variables

  • HYPERLIQUID_PRIVATE_KEY: Your Ethereum private key for authentication (required for trading)
  • HYPERLIQUID_WALLET_ADDRESS: Your wallet address (required for trading)
  • HYPERLIQUID_VAULT_ADDRESS: Your vault address (optional, for vault operations)
  • HYPERLIQUID_TESTNET: Set to 'true' to use testnet, 'false' for mainnet (default: false)
  • LOG_LEVEL: Logging level - 'debug', 'info', 'warn', or 'error' (default: 'info')

Configuration File

You can also create a .hyperliquid-config.json file in the same directory as the server with the following structure:

{
  "privateKey": "your-ethereum-private-key",
  "walletAddress": "your-wallet-address",
  "vaultAddress": "your-vault-address",
  "testnet": false,
  "logLevel": "info",
  "popularCoins": ["BTC", "ETH", "SOL", "AVAX", "ARB", "DOGE", "LINK", "MATIC"]
}

Usage

Start the server by running:

npm start

Or run the demo client:

npm run demo

Available Tools

The server provides a comprehensive set of tools for interacting with the Hyperliquid exchange. Here are some examples:

Market Data Tools

  • getMarketPrice: Get the current price for a specified cryptocurrency
  • getOrderBook: Get the current order book for a specified cryptocurrency
  • getCandleData: Get historical candle data for a specified cryptocurrency
  • getAllMids: Get all mid prices for all available cryptocurrencies

Account Information Tools

  • getAccountInfo: Get information about the user's perpetual futures account
  • getSpotAccountInfo: Get information about the user's spot trading account
  • getUserOpenOrders: Get all open orders for the user
  • getUserFills: Get recent fills for the user

Order Management Tools

  • placeMarketOrder: Place a market order for a specified cryptocurrency
  • placeLimitOrder: Place a limit order for a specified cryptocurrency
  • placeTriggerOrder: Place a trigger order (stop loss or take profit)
  • placeTwapOrder: Place a TWAP (Time-Weighted Average Price) order
  • cancelOrder: Cancel an existing order
  • cancelOrderByCloid: Cancel an order by client order ID
  • cancelAllOrders: Cancel all open orders
  • modifyOrder: Modify an existing order

Security Considerations

  • Private Key Security: Your Ethereum private key provides full access to your funds. Never share it or expose it in public repositories.
  • Use Testnet First: Always test your setup on testnet before using real funds on mainnet.
  • Limit Access: Restrict access to the MCP server to trusted AI assistants and applications.

Disclaimer

Trading cryptocurrencies involves significant risk. This tool is provided for educational and informational purposes only. Always understand the risks involved before trading, and never trade with funds you cannot afford to lose.

License

MIT

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright McpPlaywright MCP server
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server