Hyperliquid MCP Server

Hyperliquid MCP Server

A Model Context Protocol server that wraps the Hyperliquid SDK, enabling AI assistants to interact with the Hyperliquid cryptocurrency exchange for retrieving market data, executing trades, and managing positions.

Category
Visit Server

README

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured