Skip to main content
Glama
Jupiter Perps MCP Server

Jupiter Perps MCP Server

by diaorui

Jupiter Perps MCP Server

A Model Context Protocol server that enables AI agents to trade perpetual futures on Jupiter Perpetuals (Solana).

⚠️ DISCLAIMER This software is provided for educational and research purposes only. Trading perpetual futures involves substantial risk of loss and is not suitable for all investors. You are solely responsible for any trading decisions and losses incurred. The authors and contributors assume no liability for your use of this software. Use at your own risk with funds you can afford to lose.

Features

  • Market Data: Real-time prices, 24h statistics, and historical OHLCV candles

  • Portfolio Management: View USDC balance, open positions, PnL, and fees

  • Position Trading: Open, increase, and close leveraged positions (1.1x - 100x)

  • Fee Estimation: Calculate trading costs before execution

  • Transaction Safety: Automatic compute budget optimization and simulation

Supported assets: SOL, ETH, BTC

Related MCP server: jupiter-mcp

How It Works

Jupiter Perpetuals uses an oracle-based pricing model with a shared liquidity pool:

  • Pricing: Trades execute at oracle prices (Signal/Chainlink/Pyth), not order book prices

  • Liquidity: You trade against a pool of SOL, ETH, WBTC, USDC, USDT (not against other traders)

  • Slippage Protection: MAX_SLIPPAGE_BPS protects against oracle price movement during transaction execution

  • Fees:

    • Base trading fee + Price impact fee (protects liquidity providers)

    • Hourly borrow fees (instead of traditional funding rates)

This means large trades don't suffer from order book depth issues, but oracle price slippage can still occur if prices move during transaction confirmation.

Key Concepts

Position Model: Positions are identified by asset + side (e.g., "Long SOL"). You can only have one position per asset/side pair. The protocol automatically merges any additional opens into the existing position, increasing its size and adjusting entry price.

Collateral: All positions use USDC as collateral. For long positions, the protocol swaps USDC to the asset internally.

Fees: Trading fees (base + price impact) are paid when opening/increasing/closing positions. Borrow fees accrue hourly and are settled when modifying/closing. Use estimate_open_position before trading to understand total costs.

Trading: All trades execute at market price immediately (no limit orders). Tools return a transaction signature for logging purposes. The protocol processes positions asynchronously in a separate transaction - this may take a few seconds and can fail. Use get_account_portfolio to verify the position was successfully created.

Prerequisites

  • Node.js 18+

  • A Solana wallet with USDC for trading

  • Wallet private key (base58 encoded)

Installation

git clone <repository-url>
cd jupiter-perps-mcp
npm install
npm run build

Configuration

Create a .env file:

cp .env.example .env

Required settings:

WALLET_PRIVATE_KEY=your_base58_encoded_private_key
RPC_URL=https://api.mainnet-beta.solana.com

Optional settings:

MAX_SLIPPAGE_BPS=200                    # Default: 200 (2%)
PRIORITY_FEE_MICRO_LAMPORTS=100000      # Default: 100000

Usage

Local Testing

Quick verification with MCP inspector:

npx @modelcontextprotocol/inspector node dist/index.js

With Claude Code (Local)

Create .mcp.json in your project directory:

{
  "mcpServers": {
    "jupiter-perps": {
      "command": "node",
      "args": ["/absolute/path/to/jupiter-perps-mcp/dist/index.js"]
    }
  }
}

Or use ${workspaceFolder} for relative paths:

{
  "mcpServers": {
    "jupiter-perps": {
      "command": "node",
      "args": ["${workspaceFolder}/jupiter-perps-mcp/dist/index.js"]
    }
  }
}

Remote Setup (Sandboxed Environment)

Run the MCP server as an HTTP service to isolate sensitive wallet keys from Claude Code. The wallet private key stays on the host machine, while Claude Code runs in a separate environment and can only trade through MCP tools.

1. On the host machine (with wallet access), configure .env:

MCP_PORT=3000                           # HTTP server port (default: 3000)

2. Start in HTTP mode:

npm run start:remote

Or set MCP_MODE=http in .env for deployment/automation.

3. In your sandboxed Claude Code environment, create .mcp.json:

{
  "mcpServers": {
    "jupiter-perps": {
      "type": "http",
      "url": "http://localhost:3000/mcp"
    }
  }
}

For different machines, replace localhost with the host IP (e.g., http://192.168.1.100:3000/mcp).

Security: The server binds to localhost by default. For remote access, use SSH tunneling, VPN, or firewall rules to control access.

4. Test the connection:

curl http://localhost:3000/health

Available Tools

Market Data & Trading

Tool

Description

get_market_snapshot

Current market prices, 24h stats, fees, and liquidity

get_candles

Historical OHLCV data (5m, 15m, 1h, 4h, 1d, 1w)

get_account_portfolio

USDC balance, positions, PnL, and fees to close

estimate_open_position

Calculate fees and resulting position before trading

open_position

Open or increase a leveraged position

close_position

Close an existing position at market price

Technical Indicators

Tool

Description

get_indicator_rsi

RSI momentum oscillator (0-100, >70 overbought, <30 oversold)

get_indicator_macd

MACD trend and momentum indicator

get_indicator_bollinger_bands

Bollinger Bands volatility and mean reversion indicator

get_indicator_atr

ATR volatility measure for stop-loss placement

get_indicator_ema

Exponential Moving Average (faster than SMA)

get_indicator_sma

Simple Moving Average (classic trend indicator)

get_indicator_stochastic

Stochastic momentum oscillator (0-100, >80 overbought, <20 oversold)

Security

⚠️ Important Safety Notes

  • Never commit your .env file

  • Use a dedicated wallet with limited funds

  • All positions use USDC as collateral

  • Review transaction details before confirming

  • Consider using a private RPC endpoint for production

License

MIT

Available Tools

13 tools
close_positionA

Submits a transaction to fully close an existing position at market price. The protocol processes asynchronously (may take a few seconds) - use get_account_portfolio to verify closure. Returns transaction signature (for logging) and confirmation message. Collateral is returned as USDC.

Inputs: asset (required), side (required).

estimate_open_positionA

Estimates fees and resulting position state for opening a new position or increasing an existing one. Returns: (1) fees_to_pay - fees for THIS trade only: open fee, price impact fee, and any accrued borrow fees that will be settled; (2) resulting_position - final state AFTER trade: weighted average entry price, total size, total collateral, leverage, and liquidation price. Does NOT execute the trade. Important: total_collateral_usd includes protocol-specific factors beyond visible fees: (a) USDC price typically ~$0.9997-1.0003, not exactly $1.00; (b) Long positions incur additional swap costs (~0.05%) when converting USDC to the borrowed asset; (c) rounding/slippage. Short positions generally match calculations more closely as they borrow USDC directly. Note: The Jupiter protocol returns slightly lower leverage than requested, with larger differences at higher leverage (e.g., 10x → 9.99x, 100x → 99.47x).

Inputs: asset (required), side (required), collateral_amount (required), leverage (required).

get_account_portfolioA

Retrieves wallet's current USDC balance, total equity, and all open positions. For each position returns: asset, side (Long/Short), collateral, equity, size, entry price, mark price, leverage, liquidation price, and fees_to_close (accrued borrow fees that will be settled, estimated close fee, estimated price impact).

Inputs: no named parameters.

get_candlesA

Retrieves historical OHLCV (Open, High, Low, Close, Volume) pricing data for trend analysis and technical analysis. Returns candle data with timestamps (unix seconds), open/high/low/close prices, and volume. Minimum 3 candles required.

Inputs: asset (required), interval (required), limit (required).

get_indicator_atrA

Calculate ATR (Average True Range) - measures volatility for stop-loss placement and position sizing. Higher ATR = higher volatility. Returns suggested stop-loss levels at 1x, 2x, 3x ATR below current price. Common periods: 10, 14, 20.

Inputs: asset (required), interval (required), period (required), limit (required).

get_indicator_bollinger_bandsA

Calculate Bollinger Bands - measures volatility and identifies overbought/oversold conditions. Returns upper band, middle (SMA), and lower band. Price touching upper band suggests overbought, lower band suggests oversold. Common settings: (20,2) standard, (20,1.5) tight, (20,2.5) wide.

Inputs: asset (required), interval (required), period (required), std_dev (required), +1 more.

get_indicator_emaB

Calculate EMA (Exponential Moving Average) - a trend indicator that reacts faster to price changes than SMA. Price above EMA suggests uptrend, below suggests downtrend. Common periods: 9, 20, 50, 100, 200.

Inputs: asset (required), interval (required), period (required), limit (required).

get_indicator_macdA

Calculate MACD (Moving Average Convergence Divergence) - identifies trend direction and momentum. Returns MACD line, signal line, and histogram. Histogram crossing zero indicates trend changes. Common settings: (12,26,9) standard, (5,13,5) fast/scalping, (19,39,9) slow/swing.

Inputs: asset (required), interval (required), fast_period (required), slow_period (required), +2 more.

get_indicator_rsiA

Calculate RSI (Relative Strength Index) - a momentum oscillator that measures overbought/oversold conditions. RSI ranges from 0-100. Values above 70 indicate overbought, below 30 indicate oversold. Common period values: 7 (scalping), 14 (day trading), 21 (swing trading).

Inputs: asset (required), interval (required), period (required), limit (required).

get_indicator_smaA

Calculate SMA (Simple Moving Average) - a classic trend indicator. Price above SMA suggests uptrend, below suggests downtrend. Slower to react than EMA. Common periods: 20, 50, 100, 200.

Inputs: asset (required), interval (required), period (required), limit (required).

get_indicator_stochasticA

Calculate Stochastic Oscillator - a momentum indicator comparing closing price to price range. Returns %K and %D lines. Values above 80 indicate overbought, below 20 indicate oversold. %K crossing above %D is bullish signal. Common settings: (14,3) standard, (5,3) fast, (21,7) slow.

Inputs: asset (required), interval (required), k_period (required), d_period (required), +1 more.

get_market_snapshotA

Retrieves current market state for all trading assets (SOL, ETH, BTC). Returns timestamp and market data including: index prices, 24h statistics (change %, high, low, volume), trading fees (base fee %, max price impact %), and for both long/short sides: hourly borrow rates, utilization %, and available liquidity in USD. Note: Short positions use a shared USDC liquidity pool, so short_side metrics (utilization, borrow rate) are identical across all assets. Long positions borrow asset-specific tokens, so long_side metrics vary by asset.

Inputs: no named parameters.

open_positionA

Submits a transaction to open a new position or increase an existing one. The protocol processes asynchronously (may take a few seconds) - use get_account_portfolio to verify. Returns transaction signature (for logging) and confirmation message.

Inputs: asset (required), side (required), collateral_amount (required), leverage (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 13 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between open_position and estimate_open_position, as both relate to opening positions, which could cause confusion. However, their descriptions clarify that one executes trades while the other estimates, aiding disambiguation. The indicator tools (e.g., get_indicator_atr, get_indicator_rsi) are clearly differentiated by the specific technical indicator they calculate.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, with clear prefixes like 'get_' for retrieval, 'close_' for actions, and 'estimate_' for calculations. All tools use snake_case uniformly, making them predictable and easy to parse for an agent.

    Tool Count4/5

    With 13 tools, the count is reasonable for a perps trading server, covering core operations and technical analysis. It might be slightly heavy due to multiple indicator tools, but each serves a distinct purpose, so it remains well-scoped overall.

    Completeness4/5

    The toolset provides strong coverage for perps trading, including position management (open, close, portfolio), market data (snapshot, candles), and technical analysis (multiple indicators). A minor gap is the lack of tools for modifying existing positions (e.g., partial close or adjust leverage), but agents can work around this using open_position and close_position.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to perform cryptocurrency trading analysis and execution with 38+ tools including real-time market data, technical indicators, risk management, and support for both paper trading and live execution on Hyperliquid.
      7
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server providing AI agents with native access to Jupiter's full DeFi stack on Solana. It offers 17 tools covering swaps, tokens, lending, limit orders, DCA, prediction markets, perpetuals, and portfolio management.
      16
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to interact with Hyperliquid perpetual futures exchange for market analysis, account management, and risk-managed trading.
      5
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language trading of Hyperliquid perpetual futures, including portfolio checks, market data, order placement with confirmation, and position management.
      MIT