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 "Install 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-mcplist 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: MAIN MCP
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
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Typus-Lab/typus-perp-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server