Skip to main content

🟢 Hyperliquid MCP

Control your Hyperliquid perps from Claude (or any MCP client) using natural language.

"What's my BTC PnL?" → Claude fetches your positions and answers in seconds.
"Buy 0.1 ETH at market" → Claude places the order via Hyperliquid API.

Built with the Model Context Protocol — the open standard for connecting AI to external tools.


✨ Features

Tool Description
hl_get_all_mids Prices for all assets
hl_get_orderbook L2 bids/asks for any asset
hl_get_meta Market info (leverage, tick size)
hl_get_candles OHLCV history (1m → 1d)
hl_get_user_state Positions, equity, margin, PnL
hl_get_open_orders Active orders
hl_get_fills Trade history
hl_get_funding_history Funding rate history
hl_place_order Place limit or market orders
hl_cancel_order Cancel specific order
hl_cancel_all_orders Cancel all orders (optional: by coin)
hl_close_position Close entire position
hl_set_leverage Set leverage (cross or isolated)

🚀 Quick Start

1. Install

pip install hyperliquid-mcp

Or run directly without installing:

uvx hyperliquid-mcp

2. Configure Claude Desktop

Open ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows) and add:

Read-only mode (positions, prices, history — no private key needed):

{
  "mcpServers": {
    "hyperliquid": {
      "command": "uvx",
      "args": ["hyperliquid-mcp"],
      "env": {
        "HL_WALLET_ADDRESS": "0xYourWalletAddressHere"
      }
    }
  }
}

Trading mode (place orders, cancel, close positions):

{
  "mcpServers": {
    "hyperliquid": {
      "command": "uvx",
      "args": ["hyperliquid-mcp"],
      "env": {
        "HL_PRIVATE_KEY": "0xYourPrivateKeyHere"
      }
    }
  }
}

⚠️ Never share your private key. It stays on your machine — this server runs locally via stdio, no data is sent anywhere except Hyperliquid's official API.

3. Restart Claude Desktop and start chatting

What are my open positions?
What's the ETH funding rate this week?
Place a limit order to buy 0.5 SOL at $150

🔧 Manual Setup (from source)

git clone https://github.com/erscoder/hyperliquid-mcp
cd hyperliquid-mcp
pip install -e .
cp .env.example .env
# Edit .env with your wallet address or private key

Then in claude_desktop_config.json:

{
  "mcpServers": {
    "hyperliquid": {
      "command": "python",
      "args": ["-m", "hyperliquid_mcp"],
      "cwd": "/path/to/hyperliquid-mcp",
      "env": {
        "HL_WALLET_ADDRESS": "0xYourWalletAddressHere"
      }
    }
  }
}

🔒 Security

  • Your keys never leave your machine. The server runs locally via stdio transport.
  • Read-only by default. Set only HL_WALLET_ADDRESS if you don't want trading enabled.
  • Trading requires HL_PRIVATE_KEY. Without it, all trading tools return an error.
  • Use a dedicated trading wallet with limited funds for extra safety.

🤖 Use in AI Agents

MCP is not just for chat clients. Use hyperliquid-mcp as the trading layer inside any autonomous agent.

LangChain / LangGraph

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
    "hyperliquid": {
        "command": "uvx",
        "args": ["hyperliquid-mcp"],
        "transport": "stdio",
        "env": {"HL_WALLET_ADDRESS": "0xYourWallet"}
    }
})

tools = await client.get_tools()
# tools now includes hl_get_user_state, hl_get_orderbook, etc.
# Pass them to any LangChain agent or LangGraph node

CrewAI

from crewai import Agent
from crewai_tools import MCPTool

hl_tools = MCPTool.from_server(
    command="uvx",
    args=["hyperliquid-mcp"],
    env={"HL_WALLET_ADDRESS": "0xYourWallet"}
)

trader = Agent(
    role="Trading Analyst",
    goal="Monitor Hyperliquid positions and funding rates",
    tools=hl_tools
)

Custom agent (MCP Python SDK)

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

server_params = StdioServerParameters(
    command="uvx",
    args=["hyperliquid-mcp"],
    env={"HL_WALLET_ADDRESS": "0xYourWallet"}
)

async with stdio_client(server_params) as (read, write):
    async with ClientSession(read, write) as session:
        await session.initialize()
        result = await session.call_tool("hl_get_user_state", {})
        print(result.content)

Agent ideas:

  • Portfolio monitor that alerts when funding rates spike above threshold
  • Risk manager that auto-closes positions when drawdown exceeds limit
  • Arbitrage scanner comparing funding across assets
  • Morning briefing agent that summarizes overnight PnL and open positions

💬 Other MCP Clients

Works with any MCP-compatible client:

  • Claude Desktop — see Quick Start above
  • VS Code (Copilot) — add to .vscode/mcp.json
  • Cursor — add to MCP settings
  • Continue.dev — add to config

📄 License

MIT — free to use, fork, and contribute.


🌟 Star History

If this saved you time, a ⭐ goes a long way!

Metadata

Release files for hyperliquid-mcp-tools 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hyperliquid-mcp-tools 0.1.0
File Size Uploaded Provenance Actions
hyperliquid_mcp_tools-0.1.0.tar.gz 10.5 kB Without provenance Details for hyperliquid_mcp_tools-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hyperliquid-mcp-tools 0.1.0
File Interpreter ABI Platform Actions
hyperliquid_mcp_tools-0.1.0-py3-none-any.whl Python 3 none any Details for hyperliquid_mcp_tools-0.1.0-py3-none-any.whl

Total release size: 21.3 kB

Release files / hyperliquid_mcp_tools-0.1.0.tar.gz

Download URL hyperliquid_mcp_tools-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f82acc2353e78bed74ebe741af740af971daae66ba5e55e8213dd8b4391bd9a4
BLAKE2b-256 checksum
How to use checksums
b18db68c34d11402e249929aebf9ab8fb1fb634e560c7a6597c8d84cdd920e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / hyperliquid_mcp_tools-0.1.0-py3-none-any.whl

Download URL hyperliquid_mcp_tools-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0f3c24bba9d403152ffc0b2a5105d8f14d0efd638179e7c9158d9ec3644edd5
BLAKE2b-256 checksum
How to use checksums
4a6d89a60ded1428db062b43c95b2bb8aed988533583177b6cec101fbfce560a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for hyperliquid-mcp-tools 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page