Hyperliquid Trader Mcp
About
一个封装了hyperliquid交易的mcp工具,可以给模型对hyperliquid进行交易
Details
- Author
- patricleehua
- Downloads
- 257
- Categories
- Other
Jump to
- Fetch latest mark price for any symbol.
- Place perpetual market or limit orders (buy/sell).
- Cancel orders by ID.
- Retrieve current positions for perpetual or spot.
- Check balances and margin summaries.
- Switch between testnet and mainnet via HL_NETWORK.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Hyperliquid Trader McpCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install uv, create a virtual environment, sync dependencies, copy .env.example to .env, and fill in HL_ACCOUNT_ADDRESS, HL_SECRET_KEY, and HL_NETWORK. Run the server with uv run --env-file .env python -m app.mcp_server; optionally specify --transport streamable-http or --transport sse for HTTP/SSE hosting.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"hyperliquid trader mcp": {
"Q2h0Fx49bWV0wT0hzIvcA": {
"name": "hp\u4ea4\u6613",
"type": "streamableHttp",
"description": "",
"isActive": true,
"url": "http://0.0.0.0:9000/mcp",
"installSource": "unknown"
}
}
}
}
McpServers
{
"Q2h0Fx49bWV0wT0hzIvcA": {
"name": "hp\u4ea4\u6613",
"type": "streamableHttp",
"description": "",
"isActive": true,
"url": "http://0.0.0.0:9000/mcp",
"installSource": "unknown"
}
}
中文🇨🇳
Hyperliquid MCP Trader
A trading toolchain built on the Model Context Protocol (MCP). It wraps commonly used Hyperliquid Python SDK endpoints and exposes them as MCP tools: -get_mark_price(symbol): fetch the latest mark price
- place_omarket/limit(symbol, side, qty, price, tif): place a market or limit order
- place_spot_market/limit(...): spot entry points (not yet implemented in the current Hyperliquid SDK; calls raise NotImplementedError)
- cancel_order(order_id): cancel an order by id
- get_positions(dex): return current positions (dex can be empty, perp, or spot)
- get_balances(dex): return balances and margin summaries (same dex options as above)
1. Environment Setup
1. Install uv (pip install uv or follow the upstream guide).
2. Create a virtual environment at the project root and sync dependencies:
``bash
uv venv
uv sync
`
> Prefer manual installs? Run uv pip install -r requirements.txt.
3. Copy .env.example to .env (or export variables manually) and fill in real credentials:
`bash
cp .env.example .env
# Edit .env:
# HL_ACCOUNT_ADDRESS=0xYourMainWalletAddress
# HL_SECRET_KEY=0xYourApiWalletPrivateKey
# HL_NETWORK=testnet # or mainnet
`
> Security tip: use Hyperliquid’s API wallet (trading permission only) and never commit real private keys.
> Optional variables: HL_API_BASE_URL (custom endpoint), HL_SKIP_WS (set to true to skip WebSocket).
2. Run the MCP Server
`bash
uv run --env-file .env python -m app.mcp_server
`
By default the server speaks over stdin/stdout, which is ideal for local development.
To integrate with an MCP host (e.g., Claude Desktop, OpenAI Agents), register the same command in the host config.
Alternatively activate .venv manually and run python -m app.mcp_server.
To host over HTTP or SSE, specify the transport and network parameters:
`bash
Streamable HTTP (defaults to 127.0.0.1:8000/mcp)
uv run --env-file .env python -m app.mcp_server --transport streamable-http --host 0.0.0.0 --port 9000
SSE (works with OpenAI Agents, default mount path /sse)
uv run --env-file .env python -m app.mcp_server --transport sse
`
Environment variables are also supported: MCP_TRANSPORT=streamable-http, FASTMCP_HOST, FASTMCP_PORT, etc.
3. Troubleshooting
- Ensure HL_ACCOUNT_ADDRESS and HL_SECRET_KEY match the chosen network (HL_NETWORK).
- For rate limits (429) or timeouts, add retry/limit logic inside HLClient`.
- Always test on the testnet first; switch to mainnet only after validating the workflow.
---
The project structure follows patterns from Hyperliquid’s official/community SDK samples and the MCP Python SDK documentation.
HyperLiquid DEX
What is the Model Context Protocol (MCP)?Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



