Overview
Hyperliquid perps in the MCP server use two balances on Hypercore:- Spot account: receives bridged funds and holds transferable tokens
- Perp account: holds USDC collateral for perpetual positions
- external chain -> Hyperliquid spot
- Hyperliquid spot -> perp account
- open / manage positions
- perp account -> Hyperliquid spot
- Hyperliquid spot -> external chain
All perps write operations use the wallet’s EVM signing path on
eip155:42161 for Hyperliquid actions. The funding tools are different: they use the Phantom bridge / swap flows where appropriate.What agents can do with perps
These tools let an agent do more than just place a single trade. An agent can:- inspect available perp markets and compare price, funding, open interest, and leverage limits
- check account value, available margin, and withdrawable balance
- open long or short positions with configurable leverage
- choose between market and limit orders
- watch open positions and active orders over time
- change leverage or margin mode after a trade is open
- close part or all of a position when the user asks
- move funds into and out of the perp account as part of a larger workflow
- “Open a 5x BTC long with $250 of exposure.”
- “Place a limit ETH short if price comes back to 3,200.”
- “Show me my open SOL perp and close half of it.”
- “Move my remaining USDC out of perps and withdraw it back to Base.”
Read-only tools
| Tool | What it returns |
|---|---|
get_perp_markets | Available markets, price, funding, open interest, 24h volume, max leverage |
get_perp_account | Account value, available balance, available margin, withdrawable balance |
get_perp_positions | Open positions, size, direction, leverage, unrealized PnL, liquidation price |
get_perp_orders | Open orders including limit, TP, and SL orders |
get_perp_trade_history | Historical fills, fees, and closed PnL |
Funding and withdrawal tools
deposit_to_hyperliquid
Bridges or swaps from an external chain into Hyperliquid. This is the entry point when funds are not already on Hypercore.
Typical use:
- user has SOL / ETH / USDC on an external chain
- call
deposit_to_hyperliquid - funds arrive in Hyperliquid spot as USDC
- call
transfer_spot_to_perpsto move that USDC into the perp account
transfer_spot_to_perps
Moves USDC within Hypercore from spot into the perp account. This is an internal Hyperliquid transfer, not a bridge.
Parameters:
amountUsdc: amount of USDC to move from spot to perpsderivationIndex(optional): account derivation index, defaults to0
withdraw_from_perps
Moves USDC within Hypercore from the perp account back to Hyperliquid spot.
Parameters:
amountUsdc: amount of USDC to move from perps back to spotderivationIndex(optional): account derivation index, defaults to0
withdraw_from_hyperliquid_spot
Bridges USDC from Hyperliquid spot to an external chain. This is the final step after withdraw_from_perps if the user wants funds off Hyperliquid.
Parameters:
amountUsdc: amount of USDC to bridge outdestinationChainId: destination chain such assolana:mainnet,eip155:8453,eip155:42161buyToken(optional): destination token if the user wants something other than default USDCexecute(optional):falsereturns a quote,trueexecutes immediatelyderivationIndex(optional): account derivation index, defaults to0
Trading tools
open_perp_position
Opens a long or short position. Supports:
- market orders
- limit orders
- leverage selection
- isolated or cross margin
- reduce-only flag
market: market symbol such asBTC,ETH,SOLdirection:longorshortsizeUsd: notional position size in USDleverage: leverage multiplierorderType:marketorlimitlimitPrice(required for limit orders): target price as a stringmarginType(optional):isolatedorcrossreduceOnly(optional): if true, order can only reduce an existing positionderivationIndex(optional): account derivation index, defaults to0
close_perp_position
Closes a position fully or partially using sizePercent.
Parameters:
market: market symbol to closesizePercent(optional): percentage of the position to close, defaults to100derivationIndex(optional): account derivation index, defaults to0
cancel_perp_order
Cancels an open order by orderId.
Parameters:
market: market symbolorderId: numeric order id fromget_perp_ordersderivationIndex(optional): account derivation index, defaults to0
update_perp_leverage
Changes leverage and margin mode for a market.
Parameters:
market: market symbolleverage: leverage multipliermarginType:crossorisolatedderivationIndex(optional): account derivation index, defaults to0
Recommended agent flow
Funding a perp account
get_token_balancesdeposit_to_hyperliquidtransfer_spot_to_perpsget_perp_account
Opening and managing a trade
get_perp_marketsget_perp_accountopen_perp_positionget_perp_positionsget_perp_ordersupdate_perp_leverageorcancel_perp_orderas needed
Exiting and withdrawing
close_perp_positionwithdraw_from_perpswithdraw_from_hyperliquid_spot
Notes for agents
- If the user asks for their total Hyperliquid exposure, do not rely only on
get_token_balances; also callget_perp_account. - If the user asks to move funds off Hyperliquid, the full flow is usually
withdraw_from_perpsthenwithdraw_from_hyperliquid_spot. - If the user already has funds in Hyperliquid spot, skip
deposit_to_hyperliquidand usetransfer_spot_to_perpsdirectly.
Related
Tool reference
Full MCP tool parameters and examples, including non-perps tools.
MCP setup
Install and configure the Phantom MCP server.