- Hyperliquid MCP Server v2
Hyperliquid MCP Server v2
Hyperliquid MCP Server v2
A Model Context Protocol (MCP) server for interacting with the Hyperliquid exchange API through HL Coder, with an integrated dashboard for account management.
Features
- One-Command Setup: Quickly initialize both the MCP server and dashboard
- Authentication: Connect to Hyperliquid using private keys or wallet addresses
- Trading: Place and cancel orders on the Hyperliquid exchange
- Market Data: Retrieve real-time market data for trading pairs
- Strategy Management: Create and manage custom trading strategies
- Dashboard: Visual interface for account management and monitoring
Quick Start
To set up the Hyperliquid MCP server and dashboard in your HL Coder environment, simply paste this command:
git clone https://github.com/TradingBalthazar/hyperliquid-mcp-server-v2.git && cd hyperliquid-mcp-server-v2 && ./setup.sh && cd ..
This will:
- Clone the repository
- Install dependencies
- Build the MCP server
- Configure the MCP server for use with HL Coder
- Set up the dashboard in your Next.js project
After setup, you can access the dashboard at http://localhost:3000.
Using the Dashboard
The dashboard provides a user-friendly interface for:
- Authentication: Connect to Hyperliquid using your credentials
- Account Overview: View your total account value across perpetuals and spot
- Perpetuals Management: Monitor your perpetual positions and margin
- Spot Management: Track your spot balances and values
Authentication Options
- Private Key: For full trading capabilities (required for placing orders)
- Wallet Address: For read-only operations (viewing account information)
- Testnet/Mainnet: Toggle between test environment and live trading
- Vault Address: Optional for using a vault contract
Using with HL Coder
Once set up, you can use the MCP server with HL Coder through the following tools:
Authentication
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>authenticate</tool_name>
<arguments>
{
"privateKey": "your-private-key",
"testnet": true
}
</arguments>
</use_mcp_tool>
Get Market Data
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>get_market_data</tool_name>
<arguments>
{
"symbol": "BTC-PERP"
}
</arguments>
</use_mcp_tool>
Place an Order
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>place_order</tool_name>
<arguments>
{
"symbol": "ETH-PERP",
"side": "buy",
"size": 0.1,
"price": 3000,
"orderType": "limit",
"reduceOnly": false
}
</arguments>
</use_mcp_tool>
Create a Strategy
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>create_strategy</tool_name>
<arguments>
{
"name": "Simple Moving Average Crossover",
"description": "Buy when short MA crosses above long MA, sell when it crosses below",
"config": {
"symbol": "BTC-PERP",
"shortPeriod": 10,
"longPeriod": 50,
"positionSize": 0.01
}
}
</arguments>
</use_mcp_tool>
Creating Custom Strategies
You can use HL Coder to create, customize, and run trading strategies. Here's a basic workflow:
- Authenticate with Hyperliquid
- Create a strategy using the
create_strategytool - Customize the strategy by modifying its configuration
- Activate the strategy using the
activate_strategytool - Monitor performance through the dashboard
Example conversation with HL Coder:
User: Create a simple moving average crossover strategy for BTC-PERP
HL Coder: I'll help you create a moving average crossover strategy. First, let's authenticate with Hyperliquid.
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>authenticate</tool_name>
<arguments>
{
"privateKey": "your-private-key",
"testnet": true
}
</arguments>
</use_mcp_tool>
Now, let's create the strategy:
<use_mcp_tool>
<server_name>hyperliquid</server_name>
<tool_name>create_strategy</tool_name>
<arguments>
{
"name": "BTC MA Crossover",
"description": "Buy when 10-period MA crosses above 50-period MA, sell when it crosses below",
"config": {
"symbol": "BTC-PERP",
"shortPeriod": 10,
"longPeriod": 50,
"positionSize": 0.01
}
}
</arguments>
</use_mcp_tool>
Security Considerations
- The MCP server stores credentials in memory only
- Always use testnet for testing before using real funds on mainnet
- Do not share your private keys or expose them in public repositories
- The dashboard uses secure input fields for sensitive information
Advanced Configuration
For advanced users who want to customize the MCP server or dashboard:
- MCP server source code is in the
srcdirectory - Dashboard components are in the
dashboarddirectory - Configuration files can be modified to suit your needs
License
MIT