JU

Jupiter MCP Server for Solana Token Swaps

Execute fast, secure token swaps on Solana with an MCP server using Jupiter's Ultra API for optimized routing and low-cost transactions.

Quick Install
npx -y @kukapay/jupiter-mcp

Overview

This MCP (Model Context Protocol) server wraps Jupiter’s Ultra API to provide a simple, backend-ready interface for fast, low-cost token swaps on Solana. It acts as a routing and transaction-preparation layer so frontends or automated agents can request optimized quotes, simulate swaps, and obtain ready-to-send transactions with minimal integration overhead.

The server is useful when you want server-side control over swap orchestration — for example, to centralize routing logic, enforce business rules, provide a single API for multiple clients, or pre-sign transactions for trusted backend flows. Because it leverages Jupiter Ultra, it can return cost- and slippage-optimized routes while handling RPC and transaction assembly details for you.

Features

  • Query optimized swap routes via Jupiter Ultra API
  • Generate and/or sign swap transactions ready for submission to Solana
  • Simulation support to preview transaction effects and estimate gas / compute
  • Environment-driven configuration (RPC, Jupiter endpoint, private key)
  • Lightweight HTTP API suited for frontend or bot integrations
  • Docker-friendly for easy deployment
  • Health and metrics endpoints for observability

Installation / Configuration

Requirements:

  • Node.js (or the runtime used by the repo) and npm/yarn, or Docker
  • Solana RPC endpoint (e.g., mainnet-beta)
  • Jupiter Ultra API endpoint or key if required
  • Optional private key for server-side signing (store securely)

Clone and run locally (example with Node/npm):

git clone https://github.com/kukapay/jupiter-mcp.git
cd jupiter-mcp
npm install

Create a .env file in the project root (example):

PORT=3000
RPC_URL=https://api.mainnet-beta.solana.com
JUPITER_API=https://quote-api.jup.ag/v1
PRIVATE_KEY_FILE=./keypair.json   # optional, for server-side signing
NETWORK=mainnet-beta

Start the server:

npm run start
# or for development
npm run dev

Using Docker:

docker build -t jupiter-mcp .
docker run -p 3000:3000 \
  -e RPC_URL=https://api.mainnet-beta.solana.com \
  -e JUPITER_API=https://quote-api.jup.ag/v1 \
  -e PORT=3000 \
  jupiter-mcp

Environment variables reference:

VariableDescriptionRequired
PORTHTTP server portyes
RPC_URLSolana RPC endpointyes
JUPITER_APIJupiter Ultra API base URLyes
PRIVATE_KEY_FILEPath to Solana keypair JSON (optional)no
NETWORKSolana network (mainnet-beta/testnet/devnet)yes

Security notes:

  • Never commit private keys to source control.
  • Use secrets management (Vault, KMS) in production and run behind TLS.
  • Limit access to the server’s signing capabilities if enabled.

Available Resources

  • Jupiter Ultra (routing & quote) docs: https://jup.ag/docs or https://docs.jup.ag (check latest)
  • Solana developer docs and RPC reference: https://docs.solana.com
  • Example front-end integrations: use the server’s /quote and /swap endpoints to obtain routes and transactions

(Refer to the repository README and Jupiter docs for exact API parameters and rate limits.)

Use Cases

  1. Frontend swap widget

    • Flow: UI calls server /quote to fetch optimized routes and price estimates, shows options to the user, then requests /prepare or /swap to obtain a transaction for the selected route. The server can return an unsigned transaction for the client to sign with their wallet.
  2. Backend-authed swaps for custodial flows

    • Flow: A trusted backend holds a key and calls the server to create and sign transactions server-side (using PRIVATE_KEY_FILE). This is useful for custodial wallets, automated market-making bots, or scheduled rebalancing.
  3. Arbitrage and bot trading

    • Flow: Bots query /quote frequently, simulate swaps to verify outcomes, and then submit transactions via the server to minimize setup overhead and ensure consistent routing logic.
  4. Batch or multi-hop routing orchestration

    • Flow: The MCP server can be used to coordinate multi-leg swaps across token pairs by chaining Jupiter-provided routes, simulating each leg, and assembling composite transactions.

Example API calls

Get a quote (example):

curl "http://localhost:3000/quote?inputMint=<tokenA>&outputMint=<tokenB>&amount=<amount>"

Prepare a swap transaction (unsigned):

curl -X POST http://localhost:3000/prepare \
  -H "Content-Type: application/json" \
  -d '{"routeId":"<route_id_from_quote>", "userPublicKey":"<pubkey>"}'

Submit a signed transaction (server or client-signed):

curl -X POST http://localhost:3000/submit \
  -H "Content-Type: application/json" \
  -d '{"signedTx":"<base64_tx>", "skipPreflight":false}'

Refer to the repo for exact request/response shapes and endpoint names. Common fields include route identifiers, slippage tolerance, and optional simulation flags.

Next steps

  • Review the repository code to see provided endpoints and adapt request payloads.
  • Integrate secure secrets storage for private keys if enabling server-side signing.
  • Add monitoring and rate-limiting when deploying to production to protect against abuse.
Tags:finance