typus-perp-mcp
OfficialIntegrates with the Sui blockchain to enable querying of markets, managing positions, and executing trades on the Typus Perp DEX.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@typus-perp-mcp list active trading markets"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
typus-perp-mcp
MCP (Model Context Protocol) server for Typus Perp — lets Claude and other AI agents query markets, manage positions, and execute trades on the Typus Perp DEX on Sui.
Prerequisites
Node.js >= 18
A Sui wallet (required for trading and liquidity tools)
Related MCP server: Sui Butler
Installation
git clone https://github.com/xingyen0613/typus-perp-mcp
cd typus-perp-mcp
npm install
cp .env.example .env # then edit .env to add your PRIVATE_KEY
npm run buildPrivate Key Setup
Trading and liquidity tools require a private key. The private key is stored locally in a .env file and never leaves your machine.
1. Copy the example file:
cp .env.example .env2. Edit .env and fill in your private key:
NETWORK=MAINNET
SUI_RPC_URL=https://fullnode.mainnet.sui.io:443
PRIVATE_KEY=<your-private-key>Both Bech32 format (
suiprivkey1...) and Base64 format are supported.
The
.envfile is listed in.gitignoreand will never be committed to Git. If you only need read-only tools (query markets, positions, etc.), you can leavePRIVATE_KEYempty.
Enable in Claude
Setup order: Installation → Private Key Setup → add to Claude config below → restart Claude.
Claude Code
Add to ~/.claude/settings.json:
{
"mcpServers": {
"typus-perp": {
"command": "node",
"args": ["/absolute/path/to/typus-perp-mcp/dist/index.js"]
}
}
}Claude Desktop
macOS — add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"typus-perp": {
"command": "node",
"args": ["/absolute/path/to/typus-perp-mcp/dist/index.js"]
}
}
}Windows — add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"typus-perp": {
"command": "node",
"args": ["C:\\Users\\username\\typus-perp-mcp\\dist\\index.js"]
}
}
}Replace the path in
argswith the actual location where you cloned this repo.PRIVATE_KEYand other settings are loaded from the.envfile in the project root — no need to repeat them here. After editing the config, restart Claude to load the new MCP server.
Tools
Query Tools (read-only, no wallet required)
get_markets
Get all active trading markets and their configurations.
No parameters required.
Returns: Market list including leverage limits, trading fees, funding rates, open interest per symbol.
get_lp_pools
Get TLP liquidity pool information.
No parameters required.
Returns: TVL, per-token liquidity amounts and USD values, LP token info.
get_stake_pools
Get TLP staking pool information.
No parameters required.
Returns: Current TLP price snapshot, total staked shares.
get_positions
Get all open positions for a wallet address.
Parameter | Required | Description |
| Yes | Sui wallet address ( |
Returns: Open positions including size, collateral, entry price, liquidation price, unrealized PnL, funding fee, borrow fee, close fee.
get_orders
Get all pending orders for a wallet address.
Parameter | Required | Description |
| Yes | Sui wallet address ( |
Returns: Pending orders including size, trigger price, leverage, order type, linked position.
get_user_stake
Get a user's TLP staking positions and pending rewards.
Parameter | Required | Description |
| Yes | Sui wallet address ( |
Returns: Staked shares, active/deactivating shares, claimable rewards, unlock timestamps.
Use this to check your cooldown status after
unstakeorunstake_redeem. Thedeactivating_shares[].unlocked_ts_msfield shows the Unix timestamp (ms) when the cooldown ends andclaimbecomes available.
Trading Tools (requires PRIVATE_KEY)
create_order
Create a trading order on Typus Perp.
Parameter | Required | Description |
| Yes | The base token to trade. See Supported Tokens. |
| Yes | Token used as collateral. Supported: |
| Yes | Position size as a raw integer ( |
| Yes | Order trigger price as a raw integer ( |
| Yes |
|
| Yes | Collateral amount as a raw integer. USDC has 6 decimals (10 USDC = |
| No |
|
| No |
|
| No | Position ID to attach this order to. Required when |
| No |
|
The perp market and pool index are determined automatically based on
tradingToken(TYPUS uses index 1, all others use index 0).
cancel_order
Cancel a pending trading order.
Parameter | Required | Description |
| Yes | The order ID to cancel. Use |
| Yes | The market index the order belongs to. Use |
increase_collateral
Add more collateral to an existing position.
Parameter | Required | Description |
| Yes | The position ID to add collateral to. Use |
| Yes | Collateral amount as a raw integer (token units × 10^decimals). |
| Yes | The market index the position belongs to. Use |
release_collateral
Withdraw excess collateral from an existing position.
Parameter | Required | Description |
| Yes | The position ID to release collateral from. Use |
| Yes | Amount to release as a raw integer (token units × 10^decimals). |
| Yes | The market index the position belongs to. Use |
collect_funding_fee
Collect accumulated funding fees for a position.
Parameter | Required | Description |
| Yes | The position ID to collect funding fees from. Use |
| Yes | The market index the position belongs to. Use |
Liquidity Tools (requires PRIVATE_KEY)
mint_stake_lp
Deposit tokens into the TLP liquidity pool to mint TLP, with optional staking.
Parameter | Required | Description |
| Yes | Token to deposit. e.g. |
| Yes | Amount to deposit as a raw integer (token units × 10^decimals). |
| Yes | LP pool index. |
| Yes | Stake pool index. |
| Yes |
|
| Yes |
|
stake_lp
Stake existing TLP tokens to earn rewards.
Parameter | Required | Description |
| Yes | Amount of TLP to stake as a raw integer (TLP units × 10^9). |
| Yes | Stake pool index. |
unstake
Begin unstaking TLP. This starts an unlock countdown — you must wait for the cooldown period to complete before calling redeem_tlp → claim. The cooldown duration is subject to change; check the official Typus documentation for the current value.
To check when your cooldown ends, call
get_user_stakeand look atdeactivating_shares[].unlocked_ts_ms.
Parameter | Required | Description |
| Yes | Stake pool index. |
| Yes | LP pool index. |
| No | Amount of shares to unstake as a raw integer. Omit to unstake all. |
unstake_redeem
Combine unstake and redeem into a single transaction. Note that the cooldown period still applies — you must wait for it to complete before calling claim. The cooldown duration is subject to change; check the official Typus documentation for the current value.
⚠️ This does not return tokens to your wallet directly — you must wait for the cooldown period, then call
claimto receive the underlying collateral. To check when your cooldown ends, callget_user_stakeand look atdeactivating_shares[].unlocked_ts_ms.
Parameter | Required | Description |
| Yes | Stake pool index. |
| Yes | LP pool index. |
| No | Amount of shares to unstake and redeem as a raw integer. Omit to unstake and redeem all. |
redeem_tlp
Redeem TLP tokens for underlying assets. Use this when:
TLP is already in your wallet (minted with
stake=false), orYou have completed the
unstakecooldown period
⚠️ This does not return tokens to your wallet directly — you must call
claimafterwards. Full flow:unstake → (wait cooldown) → redeem_tlp → claim.
Parameter | Required | Description |
| Yes | LP pool index. |
| No | Amount of TLP shares to redeem as a raw integer. Omit to redeem all. |
claim
Claim redeemed TLP tokens back as underlying collateral. This is the final step after unstake_redeem or redeem_tlp.
Parameter | Required | Description |
| Yes | The collateral token to receive. e.g. |
| Yes | LP pool index. |
| Yes | Stake pool index. |
Claim does not require an amount — it automatically transfers all redeemed collateral to your wallet.
harvest_reward
Harvest pending staking reward tokens.
Parameter | Required | Description |
| Yes | Stake pool index. |
swap
Swap tokens using the Typus Perp liquidity pool.
Parameter | Required | Description |
| Yes | Token to swap from. e.g. |
| Yes | Token to swap to. e.g. |
| Yes | Amount to swap as a raw integer (fromToken units × 10^decimals). |
| Yes | Perp market index. |
Reference
Pool Index
Index | LP Pool | Stake Pool | Accepted Collateral | Markets |
| mTLP | mTLP stake | SUI, USDC | All markets except TYPUS |
| iTLP | iTLP stake | USDC | TYPUS market only |
Supported Tokens
Token | Symbol to use | Decimals |
SUI |
| 9 |
Bitcoin |
| 8 |
Ethereum |
| 8 |
Solana |
| 8 |
Aptos |
| 8 |
DEEP |
| 6 |
WAL |
| 9 |
DOGE |
| 8 |
HYPE |
| 8 |
XRP |
| 8 |
Japanese Yen |
| 9 |
Gold |
| 9 |
Silver |
| 9 |
US Oil |
| 9 |
QQQ (ETF) |
| 9 |
S&P 500 (ETF) |
| 9 |
TYPUS |
| 9 |
USDC (collateral) |
| 6 |
Raw Integer Conversion
All amount parameters use raw integers (on-chain representation):
Value | Formula | Example |
Token amount |
| 10 USDC = |
Position size |
| Use |
Workflow Examples
Open a Long with TP/SL
# 1. Open Long position
create_order: tradingToken="SUI", collateralToken="SUI", size="10000000000",
triggerPrice="10000000000", isLong=true, collateralAmount="3000000000"
# 2. Get positionId
get_positions: address="0x..."
# 3. Set Take-Profit (TP)
create_order: tradingToken="SUI", collateralToken="SUI", size="10000000000",
triggerPrice="500000000", isLong=false, reduceOnly=true,
collateralAmount="0", linkedPositionId="<positionId>"
# 4. Set Stop-Loss (SL) — set BELOW current market price to avoid immediate trigger
create_order: tradingToken="SUI", collateralToken="SUI", size="10000000000",
triggerPrice="50000000", isLong=false, isStopOrder=true, reduceOnly=true,
collateralAmount="0", linkedPositionId="<positionId>"
# 5. Close position at market price
create_order: tradingToken="SUI", collateralToken="SUI", size="10000000000",
triggerPrice="1", isLong=false, reduceOnly=true,
collateralAmount="0", linkedPositionId="<positionId>"Deposit and Withdraw Liquidity
# Deposit and stake
mint_stake_lp: collateralToken="SUI", amount="10000000000",
poolIndex="0", stakePoolIndex="0", stake=true, isAutoCompound=false
# Withdraw — Option A: single transaction (cooldown still applies)
unstake_redeem: stakePoolIndex="0", poolIndex="0" # Step 1: unstake + redeem
# ... wait for cooldown period ...
claim: collateralToken="SUI", poolIndex="0", stakePoolIndex="0" # Step 2: receive tokens
# Withdraw — Option B: two transactions
unstake: stakePoolIndex="0", poolIndex="0" # Step 1: start cooldown
# ... wait for cooldown period ...
redeem_tlp: poolIndex="0" # Step 2: redeem
claim: collateralToken="SUI", poolIndex="0", stakePoolIndex="0" # Step 3: receive tokensImportant Notes
Minimum deposit: mTLP pool requires at least ~10 SUI (or equivalent USDC). Smaller amounts will fail with
deposit_amount_insufficient.reduceOnlyorders requirelinkedPositionId: When closing or reducing a position withreduceOnly=true, you must providelinkedPositionId. Omitting it will fail withposition_id_needed_with_reduce_only_order.Stop-Loss price: Set SL below your entry price for longs (above for shorts). Setting SL above the current market price will trigger it immediately and close your position.
Withdrawal flow:
unstake_redeemorredeem_tlpalone does not return tokens to your wallet. Always callclaimas the final step to receive the underlying collateral.
Development
npm run build # Compile TypeScript → dist/index.js
npm run typecheck # Type check without building
npm start # Run the server directlySecurity
PRIVATE_KEYis stored locally and never transmitted outside your machineStore it in
.envor the MCP config'senvblock — never commit it to Git.envis listed in.gitignoreFor read-only use, leave
PRIVATE_KEYempty — all query tools work without it
Available Tools
19 toolscancel_orderB
Cancel a pending trading order. Requires PRIVATE_KEY in .env.
Inputs: orderId (required), marketIndex (required).
claimA
Claim redeemed TLP tokens back as underlying collateral. This is the final step after unstake → redeem → claim. Requires PRIVATE_KEY in .env.
Inputs: poolIndex (required), stakePoolIndex (required), collateralToken (required).
collect_funding_feeB
Collect accumulated funding fees for a position. Requires PRIVATE_KEY in .env.
Inputs: positionId (required), marketIndex (required).
create_orderA
Create a trading order on Typus Perp. Requires PRIVATE_KEY in .env. Size and collateral amounts are raw integers — use get_markets to find size_decimal for the trading token.
Inputs: size (required), isLong (required), tradingToken (required), triggerPrice (required), +6 more.
get_lp_poolsA
Get TLP liquidity pool information including TVL and per-token liquidity amounts
Inputs: no named parameters.
get_marketsA
Get all active trading markets and their configurations on Typus Perp (leverage, fees, funding rates, etc.)
Inputs: no named parameters.
get_ordersA
Get all pending (unfilled) trading orders for a specific wallet address
Inputs: address (required).
get_positionsA
Get all open positions for a wallet address, including liquidation price, unrealized PnL, funding fee, borrow fee, and close fee for each position
Inputs: address (required).
get_stake_poolsB
Get TLP staking pool information including current TLP price and total staked shares
Inputs: no named parameters.
get_user_stakeA
Get a user's TLP staking positions including staked share amounts, claimable rewards, and any shares currently in the unstaking cooldown period
Inputs: address (required).
harvest_rewardA
Harvest pending staking reward tokens (e.g. TYPUS tokens). Requires PRIVATE_KEY in .env.
Inputs: stakePoolIndex (required).
increase_collateralA
Add more collateral to an existing position to reduce liquidation risk. Requires PRIVATE_KEY in .env.
Inputs: amount (required), positionId (required), marketIndex (required).
mint_stake_lpB
Deposit tokens into the TLP liquidity pool and optionally stake the resulting TLP. Requires PRIVATE_KEY in .env.
Inputs: stake (required), amount (required), poolIndex (required), isAutoCompound (required), +2 more.
redeem_tlpA
Redeem TLP tokens (already unstaked) for underlying assets. ⚠️ This does NOT return tokens to your wallet directly — you must call claim() afterwards to receive the underlying collateral. Full flow: unstake → redeem_tlp → claim. Requires PRIVATE_KEY in .env.
Inputs: poolIndex (required), share.
release_collateralB
Withdraw excess collateral from an existing position. Requires PRIVATE_KEY in .env.
Inputs: amount (required), positionId (required), marketIndex (required).
stake_lpA
Stake existing TLP tokens in the stake pool to earn rewards. Requires PRIVATE_KEY in .env.
Inputs: amount (required), stakePoolIndex (required).
swapB
Swap tokens using Typus Perp liquidity pool. Requires PRIVATE_KEY in .env.
Inputs: amount (required), toToken (required), fromToken (required), perpIndex (required).
unstakeA
Begin unstaking TLP (starts the unlock countdown). Requires PRIVATE_KEY in .env.
Inputs: poolIndex (required), stakePoolIndex (required), share.
unstake_redeemA
Unstake and immediately redeem TLP for underlying tokens in one transaction. ⚠️ This does NOT return tokens to your wallet directly — you must call claim() afterwards to receive the underlying collateral. Requires PRIVATE_KEY in .env.
Inputs: poolIndex (required), stakePoolIndex (required), share.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool targets a distinct resource and action: user staking vs pool info, order creation vs cancellation, collateral management, and the multi-step unstake/redeem/claim flow are all clearly separated. Even similar-sounding tools like unstake and unstake_redeem have explicit descriptions that delineate their purposes.
Most tools follow a verb_noun snake_case pattern (get_markets, create_order, increase_collateral), but a few are bare verbs (unstake, claim, swap) or compound verbs (mint_stake_lp, unstake_redeem). This is a minor deviation from the otherwise consistent convention.
With 19 tools, the set is slightly heavy but each tool earns its place given the dual domains of perpetuals trading and TLP staking/LP management. The count is justifiable for the breadth of operations covered.
Core workflows are well-covered: order lifecycle, position collateral management, staking/unstaking/redeeming/claiming, and swaps. Minor gaps exist, such as no explicit wallet balance tool to check free TLP or token holdings, but these can be worked around via user-supplied information or external chain queries.
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
MCP server for Mudrex futures trading enabling AI agents to securely access data and risk tools.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server designed for AI agents to perform optimal token swaps on the Sui blockchain.6MIT
- AlicenseNot gradedqualityFmaintenanceAn MCP server for the Sui blockchain that enables AI agents to manage accounts, execute token swaps, and perform smart contract development using the Sui CLI. It supports over 30 tools for DeFi operations, staking, and market data via Pyth price oracles.20 npm2MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server for the Hyperliquid decentralized exchange, enabling AI assistants to perform trading operations, manage accounts, and retrieve market data.38 PyPI3MIT
- AlicenseNot gradedqualityCmaintenanceA comprehensive MCP server for Aster DEX perpetual futures trading, enabling AI agents to access real-time market data, perform institutional-grade analysis, execute orders, and run automated trading strategies.1MIT