Hyperliquid MCP trading server

Hyperliquid MCP trading server

hyperliquid-trader-mcp•bypatricleehua

An MCP server that wraps Hyperliquid Python SDK endpoints and exposes trading operations such as mark prices, order placement and cancellation, positions and balances as MCP tools.

License: Not specified•Runtime: Awaiting documentation review•Category: finance crypto

WHAT IT DOES

  • •Exposes tools to fetch the latest mark price for a symbol and to place market or limit orders.
  • •Provides tools to cancel orders by id and to return current positions for perp or spot.
  • •Returns balances and margin summaries, with the same dex options as positions.
  • •Runs over stdin/stdout by default and can also be hosted over Streamable HTTP or SSE.

BEST FOR

  • •Connecting an MCP host to Hyperliquid for checking prices and account positions.
  • •Testing trading workflows against Hyperliquid's testnet before moving to mainnet.

ABOUT HYPERLIQUID-TRADER-MCP

Hyperliquid MCP trading server is cataloged as an MCP server attributed to patricleehua. An MCP server that wraps Hyperliquid Python SDK endpoints and exposes trading operations such as mark prices, order placement and cancellation, positions and balances as MCP tools. It is categorized under finance crypto. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Hyperliquid MCP trading server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the server be protected with a shared secret?

Yes, when MCP_AUTH_HEADER_VALUE is set, HTTP and SSE requests must include the configured header and value.

Are spot market and limit orders implemented?

No, the spot entry points currently raise NotImplementedError in the Hyperliquid SDK.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 02aef23459e7 · 采集于 2026-11-13 11:52:04 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

中文🇨🇳

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:
    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:
    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), MCP_AUTH_HEADER_VALUE (shared secret that must appear in the Authorization header), MCP_AUTH_HEADER_NAME (override header name; defaults to Authorization).

2. Run the MCP Server

uv run --env-file .env python -m app.mcp_server

The .env file is optional. If it exists the loader grabs it automatically, but you can omit the --env-file flag entirely and provide the credentials as environment variables:

HL_ACCOUNT_ADDRESS=0xYourMainWalletAddress \
HL_SECRET_KEY=0xYourApiWalletPrivateKey \
HL_NETWORK=testnet \
uv run python -m app.mcp_server --transport streamable-http --host 0.0.0.0 --port 9000

Typical MCP host entry (pseudo JSON):

Cherry Studio

{
  "mcpServers": {
    "hyperliquid-trading": {
      "isActive": true,
      "name": "hyperliquid-trading",
      "type": "streamableHttp",
      "description": "hyperliquid-trading",
      "baseUrl": " http://0.0.0.0:9000/mcp",
      "headers": {
        "Authorization": "Bearer your-shared-secret"
      }
    }
  }
}

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:

# Streamable HTTP (defaults to 127.0.0.1:8000/mcp)
uv run 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 python -m app.mcp_server --transport sse

Environment variables are also supported: MCP_TRANSPORT=streamable-http, FASTMCP_HOST, FASTMCP_PORT, etc.

When MCP_AUTH_HEADER_VALUE is set, every HTTP/SSE request must include the configured header/value pair (defaults to Authorization:Bearer <value>); leaving it empty disables the check.

Request header validation

  1. Set a shared secret: export MCP_AUTH_HEADER_VALUE=super-secret-token.
  2. (Optional) override the header name: export MCP_AUTH_HEADER_NAME=X-Custom-Auth.
  3. Restart the server. Any HTTP/SSE request that omits the header will receive 403 Missing or invalid request header.

Example Streamable HTTP call:

curl -H "Authorization: super-secret-token" \
     -H "Content-Type: application/json" \
     -d '{"method":"list_tools","params":{}}' \
     http://127.0.0.1:8000/mcp

Clear MCP_AUTH_HEADER_VALUE (or unset it) if you want to disable the guard for local testing.

Docker deployment

Option A – build locally

docker build -t hl-mcp .
docker run --rm \
  -e HL_ACCOUNT_ADDRESS=0xYourMainWalletAddress \
  -e HL_SECRET_KEY=0xYourApiWalletPrivateKey \
  -e HL_NETWORK=testnet \
  -e MCP_AUTH_HEADER_VALUE=super-secret-token \
  -p 9000:9000 \
  hl-mcp

Option B – pull the prebuilt image

docker pull patricleee/hyperliquid-trading-mcp:1.0.0
docker run --rm \
  -e HL_ACCOUNT_ADDRESS=0xYourMainWalletAddress \
  -e HL_SECRET_KEY=0xYourApiWalletPrivateKey \
  -e HL_NETWORK=testnet \
  -e MCP_AUTH_HEADER_VALUE=super-secret-token \
  -p 9000:9000 \
  patricleee/hyperliquid-trading-mcp:1.0.0

Option C – Docker Compose

A ready-to-use docker-compose.yml is included at the project root. Populate .env (same keys as usual) and launch:

cp .env.example .env  # edit the values first
docker compose -f docker-compose.yml up -d

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)?

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Hyperliquid MCP trading server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/hyperliquid-trader-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related finance crypto MCP Servers

Alternative and complementary servers in the same category

View all in finance crypto →
USA Spending MCP Server
usaspending-mcp-server•thsmale

A stateless streamable HTTP MCP server for interacting with the official source of government spending data.

Repository stats unavailable
Finance & Analytics
Fortnox MCP server — More AI
more-ai-chatgpt-claude-mcp-fortnox•amor3

A hosted, remote MCP server for Fortnox that lets AI assistants answer questions from a company's bookkeeping and propose changes for approval before writing them.

0
Finance & Analytics

OptimistFi is a read-only remote MCP server that provides perpetual futures market data, perps prop firm rules and pricing, and US equity investment research.

Repository stats unavailable
Finance & Analytics