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.
npx -y @kukapay/jupiter-mcpOverview
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):
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:
# or for development
Using Docker:
Environment variables reference:
| Variable | Description | Required |
|---|---|---|
| PORT | HTTP server port | yes |
| RPC_URL | Solana RPC endpoint | yes |
| JUPITER_API | Jupiter Ultra API base URL | yes |
| PRIVATE_KEY_FILE | Path to Solana keypair JSON (optional) | no |
| NETWORK | Solana 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
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.
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.
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.
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):
Prepare a swap transaction (unsigned):
Submit a signed transaction (server or client-signed):
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.