Skip to main content
Glama
talkincode

HyperLiquid MCP Server

by talkincode

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
HYPERLIQUID_TESTNETNoSet to 'true' to use testnet (optional, default false)false
HYPERLIQUID_PRIVATE_KEYYesYour HyperLiquid private key (required)
HYPERLIQUID_ACCOUNT_ADDRESSNoOptional account address, derived from private key if not provided

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_account_balanceB

Get account balance and margin information

get_open_positionsA

Get all open positions with PnL information

get_open_ordersC

Get all open orders

get_trade_historyB

Get trade history for the account

Args: days: Number of days to look back (default: 7)

place_limit_orderA

Place a basic limit order (for opening new positions or manual closing)

Args: coin: Trading pair (e.g., "BTC", "ETH") side: Order side ("buy" or "sell") size: Number of tokens/coins to trade (NOT dollar value - e.g., 0.1 for 0.1 SOL, not $20) price: Limit price per token (e.g., 150.0 for $150 per SOL) reduce_only: Whether order should only reduce existing position client_order_id: Optional client order ID (128-bit hex string, e.g. 0x1234567890abcdef1234567890abcdef)

IMPORTANT: The 'size' parameter is the NUMBER OF TOKENS, not dollar value. If user wants "$20 worth of SOL" at $150/SOL, calculate: $20 ÷ $150 = 0.133 SOL

Note: For setting take profit/stop loss on existing positions, use set_take_profit_stop_loss instead.

market_open_positionA

Open a new position at market price using HyperLiquid's market_open for optimal execution

Args: coin: Trading pair (e.g., "BTC", "ETH") side: Position side ("buy" for long, "sell" for short) size: Number of tokens/coins to trade (NOT dollar value - e.g., 0.1 for 0.1 SOL, not $20) client_order_id: Optional client order ID for tracking

IMPORTANT: The 'size' parameter is the NUMBER OF TOKENS, not dollar value. If user wants "$20 worth of SOL" at current price ~$150, calculate: $20 ÷ $150 = 0.133 SOL

Note: This uses HyperLiquid's native market_open method for the best execution.

market_close_positionA

Close all positions for a coin at market price using HyperLiquid's market_close

Args: coin: Trading pair (e.g., "BTC", "ETH") client_order_id: Optional client order ID for tracking

Note: This closes ALL positions for the specified coin. HyperLiquid's market_close method automatically determines the correct side and size to close all positions.

place_bracket_orderA

Place a bracket order for a NEW position (entry + take profit + stop loss in one order)

Args: coin: Trading pair (e.g., "BTC", "ETH") side: Order side ("buy" or "sell") size: Number of tokens/coins to trade (NOT dollar value - e.g., 0.1 for 0.1 SOL, not $20) entry_price: Entry limit price per token take_profit_price: Take profit price per token stop_loss_price: Stop loss price per token client_order_id: Optional client order ID (128-bit hex string, e.g. 0x1234567890abcdef1234567890abcdef)

IMPORTANT: The 'size' parameter is the NUMBER OF TOKENS, not dollar value. If user wants "$20 worth of SOL" at $150/SOL, calculate: $20 ÷ $150 = 0.133 SOL

Note: This creates a NEW position with TP/SL. For existing positions, use set_take_profit_stop_loss. Uses HyperLiquid's normalTpSl grouping for proper OCO behavior where TP and SL orders cancel each other.

cancel_orderC

Cancel a specific order by order ID

Args: coin: Trading pair order_id: Order ID to cancel

cancel_order_by_client_idA

Cancel a specific order by client order ID

Args: coin: Trading pair client_order_id: Client order ID to cancel (128-bit hex string, e.g. 0x1234567890abcdef1234567890abcdef)

cancel_all_ordersA

Cancel all orders, optionally for a specific coin

Args: coin: Optional trading pair to cancel orders for (if None, cancels all orders)

modify_orderC

Modify an existing order

Args: coin: Trading pair order_id: Order ID to modify new_size: New order size new_price: New order price

get_market_dataB

Get market data for a specific coin

Args: coin: Trading pair (e.g., "BTC", "ETH")

get_orderbookB

Get orderbook data for a specific coin

Args: coin: Trading pair (e.g., "BTC", "ETH") depth: Order book depth (default: 20)

get_candles_snapshotA

Fetch candlestick (OHLCV) data for multiple coins in one request

Args: coins: List of trading pairs (e.g., ["BTC", "ETH"]) interval: Candlestick interval supported by HyperLiquid (e.g., "1m", "1h") start_time: Start timestamp in milliseconds (required when days not provided) end_time: End timestamp in milliseconds (defaults to now when omitted) days: Number of recent days to fetch (mutually exclusive with start/end) limit: Optional max number of candles per coin (latest N samples)

get_funding_historyA

Get funding history for a coin

Args: coin: Trading pair (e.g., "BTC", "ETH") days: Number of days to look back (default: 7)

update_leverageA

Update leverage for a coin

Args: coin: Trading pair (e.g., "BTC", "ETH") leverage: Leverage amount (e.g., 10 for 10x) cross_margin: Use cross margin (True) or isolated margin (False)

transfer_between_spot_and_perpA

Transfer funds between spot and perpetual accounts

Args: amount: Amount to transfer to_perp: Transfer to perpetual account (True) or to spot account (False)

set_take_profit_stop_lossA

Set take profit and/or stop loss orders for an EXISTING position (OCO orders)

Args: coin: Trading pair (e.g., "BTC", "ETH") - must have an existing position take_profit_price: Take profit price (optional, can set just TP) stop_loss_price: Stop loss price (optional, can set just SL) position_size: Position size (will auto-detect from existing position if not provided)

Note: This is for EXISTING positions only. Use place_bracket_order for new positions with TP/SL. The orders will use OCO (One-Cancels-Other) behavior where executing one cancels the other.

set_take_profitA

Set ONLY a take profit order for an EXISTING position

Args: coin: Trading pair (e.g., "BTC", "ETH") - must have an existing position take_profit_price: Take profit price position_size: Position size (will auto-detect from existing position if not provided)

Note: This is specifically for setting ONLY take profit on EXISTING positions. Use set_take_profit_stop_loss if you want both TP and SL, or place_bracket_order for new positions.

set_stop_lossA

Set ONLY a stop loss order for an EXISTING position

Args: coin: Trading pair (e.g., "BTC", "ETH") - must have an existing position stop_loss_price: Stop loss price position_size: Position size (will auto-detect from existing position if not provided)

Note: This is specifically for setting ONLY stop loss on EXISTING positions. Use set_take_profit_stop_loss if you want both TP and SL, or place_bracket_order for new positions.

get_account_summaryA

Get a comprehensive account summary including balance, positions, and orders

close_positionA

Close a position (full or partial)

Args: coin: Trading pair (e.g., "BTC", "ETH") percentage: Percentage of position to close (default: 100.0 for full close)

Note: For 100% closure, uses market_close_position for optimal execution. For partial closure, you'll need to use limit orders as HyperLiquid's market_close closes all positions.

calculate_token_amount_from_dollarsA

Calculate how many tokens can be bought with a given dollar amount

Args: coin: Trading pair (e.g., "BTC", "ETH", "SOL") dollar_amount: Dollar amount to spend (e.g., 20.0 for $20)

Returns: Dictionary with token amount and current price

Example: calculate_token_amount_from_dollars("SOL", 20.0) → {"token_amount": 0.133, "current_price": 150.0, "dollar_amount": 20.0}

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/talkincode/hyperliquid-mcp-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server