The Phantom MCP server includes a dedicated set of tools for perpetuals trading on Hyperliquid through Phantom’s backend. This page focuses only on those perps tools: what they do, how funding flows work, and the order agents should use them in.Documentation Index
Fetch the complete documentation index at: https://docs.phantom.com/llms.txt
Use this file to discover all available pages before exploring further.
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 (
deposit_to_hyperliquid) - Hyperliquid spot -> perp account (
transfer_spot_to_perps) - open / manage positions
- perp account -> external chain (
withdraw_from_perps)
phantom perps withdraw-hl-spot CLI command.
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
Bridges USDC from the Hyperliquid perpetuals account to an external chain.
Parameters:
amountUsdc: amount of USDC to bridge outdestinationChainId: destination chain such assolana:mainnet,eip155:8453,eip155:42161buyToken(optional): CAIP-19 token to receive; defaults to USDC on the destination chainderivationIndex(optional): account derivation index, defaults to0
Withdrawing from Hyperliquid spot (CLI only)
If funds are in your Hyperliquid spot account rather than the perps account, use thephantom perps withdraw-hl-spot CLI command to bridge them to an external chain. This is useful when you have USDC sitting in spot after a deposit or after moving funds out of perps.
--amountUsdc: amount of USDC to bridge out--destinationChainId: destination chain such assolana:mainnet,eip155:8453,eip155:1,eip155:42161,eip155:137--buyToken(optional): CAIP-19 token to receive on the destination chain; defaults to USDC--execute(optional): set totrueto sign and broadcast immediately; defaults to returning a quote only
--execute to preview the quote before committing:
Moved from the MCP server to the CLI. Earlier releases exposed this as the
withdraw_from_hyperliquid_spot MCP tool (see prior changelog entries). It has since been removed from the MCP server and is now available only via phantom perps withdraw-hl-spot in the CLI. The withdraw_from_perps MCP tool is still the right choice for withdrawing from the perps account directly.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_perps(bridges USDC from perps directly to destination chain)
phantom perps withdraw-hl-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, call
withdraw_from_perpswith adestinationChainId— it handles the full bridge in one step. - 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.