mcp-pear

v0.2.2
io.github.MarvelNwachukwu/mcp-pear Checked 2 days ago Published 4 months ago

MCP server for Pear Protocol: markets, positions, orders, portfolio, and gated trade execution.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_health

Check Pear Protocol API health. Returns service status, server timestamp, and uptime in seconds. Use this to verify the API is reachable before running other tools.

list_markets

Browse Pear Protocol pair markets with optional filters and pagination. Each market is a long/short composition with current ratio, 24h change, volume, open interest, and funding. Use to discover what's tradable, or with searchText to find a specific pair.

ParameterTypeDescription
change24hnumberMinimum 24h ratio change (e.g. 0.05 for +5%).
enginestringFilter by execution engine.
minVolumenumberMinimum 24h volume in USD.
netFundingnumberFilter by net funding rate.
pageintegerPage number (1-indexed).
pageSizeintegerResults per page. Default 20.
searchstringFree-text search across market names (composition keys like `L:BTC|S:ETH`).
sortstringSort key (e.g. 'volume', 'change24h').

get_active_markets

Get the most active Pear Protocol pair markets right now: current active pairs plus top gainers, top losers, highlighted pairs, and the user's watchlist. Use to see what's hot or as a starting point for narrowing into a specific pair.

get_pair_ratio

Get the current ratio (long/short composition price) for a specific Pear Protocol pair. Pass long and short asset arrays. Returns the ratio, 24h change, and funding rate. Useful when you know the pair you care about and want the latest number.

ParameterTypeDescription
longAssets *arrayAsset symbols on the long side (e.g. ['BTC']).
shortAssets *arrayAsset symbols on the short side. Pass an empty array for long-only baskets.

get_account_summary

Get the authenticated user's Pear Protocol account summary: agent wallet address, total closed trades, pending trigger-order USD value, pending TWAP-chunk USD value, and last sync timestamp. Requires PEAR_API_KEY.

get_open_positions

List the authenticated user's currently open Pear Protocol pair positions, including position ID, entry ratio, mark ratio, unrealized PnL, and long/short composition. Requires PEAR_API_KEY.

get_open_orders

List the authenticated user's open limit, take-profit, and stop-loss orders on Pear Protocol. Returns each order's ID, type, status, and pair composition. Requires PEAR_API_KEY.

get_trade_history

Fetch the authenticated user's recent closed trades on Pear Protocol with realized PnL, entry/exit ratios, and pair composition. Optional date range and limit. Requires PEAR_API_KEY.

ParameterTypeDescription
endDatestringISO 8601 timestamp or epoch ms. Only return trades on or before this time.
limitintegerMax number of trades to return. Default 50.
startDatestringISO 8601 timestamp or epoch ms. Only return trades on or after this time.

get_twap_orders

List the authenticated user's active TWAP (time-weighted average price) orders on Pear Protocol, including chunk execution and fill detail. Requires PEAR_API_KEY.

get_portfolio

Fetch the authenticated user's full portfolio metrics on Pear Protocol: bucketed PnL across last 1 day / 1 week / 1 month / 1 year / all-time, plus overall stats (total trades, all-time volume, current open interest, unrealized PnL). Requires PEAR_API_KEY.

get_agent_wallet

Get the authenticated user's Pear Protocol agent wallet address. The agent wallet is what Pear uses to sign Hyperliquid trades on the user's behalf. Returns an empty/missing address if no agent wallet has been created yet; call create_agent_wallet to create one.

create_agent_wallet

Create a new Pear Protocol agent wallet for the authenticated user. The agent wallet is what Pear uses to sign Hyperliquid trades. After creation, the user MUST approve this wallet on Hyperliquid (the response message contains the approval instructions). WRITE: executes a state change. Requires PEAR_TRADE_ENABLED=true.

open_position

Open a new pair position on Pear Protocol. Specify executionType (MARKET / TRIGGER / TWAP / LADDER / TP / SL / SYNC), leverage (1-100), usdValue (≥1), slippage (0.001-0.1), and the long/short asset compositions (arrays of { asset, weight }). Optionally attach stopLoss/takeProfit and TWAP/TRIGGER/LADDER parameters. WRITE: executes a real trade. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
executionType *string
leverage *integer
longAssets *array
shortAssets *array
slippage *number
usdValue *number
directionstring
ladderConfigobject
randomizeExecutionboolean
referralCodestring
stopLoss
takeProfit
triggerTypestring
triggerValuenumber
twapDurationnumber
twapIntervalSecondsnumber

close_position

Close one open Pear Protocol position by positionId. executionType: MARKET (immediate) or TWAP (spread over time; requires twapDuration in seconds). WRITE: executes a real trade. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
executionType *string
positionId *string
randomizeExecutionboolean
referralCodestring
twapDurationnumber
twapIntervalSecondsnumber

close_all_positions

Close every open Pear Protocol position with a single executionType (MARKET or TWAP). Returns a per-position result array with success/error. WRITE: executes real trades. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
executionType *string
randomizeExecutionboolean
referralCodestring
twapDurationnumber
twapIntervalSecondsnumber

adjust_position

Reduce or increase an existing Pear Protocol position's size by 1-100 percent. executionType: MARKET (immediate) or LIMIT (provide limitRatio). WRITE: changes exposure on a real trade. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
adjustmentSize *integer
adjustmentType *string
executionType *string
positionId *string
limitRationumber
referralCodestring

adjust_leverage

Change leverage (1-100x) on an existing Pear Protocol position. Higher leverage means greater liquidation risk for the same price move. WRITE: changes risk profile of a live position. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
leverage *integer
positionId *string

set_risk_parameters

Set or update stop-loss / take-profit on an existing Pear Protocol position. Each threshold has type ('PRICE' or 'PERCENTAGE'), value, and optional trailing fields. Pass null to clear a field; omit it to leave unchanged. WRITE: changes risk parameters on a live position. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
positionId *string
stopLoss
takeProfit

cancel_order

Cancel a pending Pear Protocol limit, take-profit, or stop-loss order by orderId. Does not affect already-filled portions. For TWAP orders, use cancel_twap_order. WRITE: cancels a live order. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
orderId *string

cancel_twap_order

Cancel a Pear Protocol TWAP (time-weighted average price) order and all of its remaining unfilled chunks. WRITE: cancels a live order. Requires PEAR_TRADE_ENABLED=true.

ParameterTypeDescription
orderId *string