trade-router-mcp
OfficialThe trade-router-mcp server provides a non-custodial Solana trading engine for AI agents, enabling wallet management, market data, direct swaps, advanced conditional orders, and order management via TradeRouter.ai.
Wallet & Account
get_wallet_address— Retrieve the configured wallet's public Solana addressget_holdings— Scan and list all SPL token holdings for a wallet
Swapping
build_swap— Build an unsigned swap transaction across multiple DEXes (Raydium, PumpSwap, Orca, Meteora)submit_signed_swap— Submit a pre-signed transaction via MEV-protected Jito bundleauto_swap— One-shot build + sign + submit swap in a single call
Advanced Order Types
place_limit_order— Market-cap-based limit buy or sellplace_trailing_order— Trailing stop or trailing buyplace_twap_order— Time-weighted average price buy or sellplace_limit_twap_order— Limit trigger → TWAP executionplace_trailing_twap_order— Trailing trigger → TWAP executionplace_limit_trailing_order— Limit trigger → trailing stopplace_limit_trailing_twap_order— Limit → trailing → TWAP combo
Order Management
list_orders— List all active orderscheck_order— Get status of a specific order by IDcancel_order— Cancel an active orderextend_order— Extend an order's expiry timeget_fill_log— Retrieve a log of filled order events
Market Data & Visualization
get_mcap— Fetch market cap and price data for one or more tokensget_flex_card— Get a trade card PNG URL for a wallet + token pair
WebSocket & Connectivity
connect_websocket— Establish a persistent WebSocket connection (required before placing orders)connection_status— Check current WebSocket connection state
Allows integration with LangChain by providing MCP tools that can be used with LangChain's MultiServerMCPClient for building AI agent workflows.
Provides tools to interact with the Solana blockchain for swapping tokens, placing limit/trailing/TWAP/combo orders, checking holdings, and managing orders.
@traderouter/trade-router-mcp
A Model Context Protocol server for TradeRouter.ai — non-custodial Solana swap, limit, trailing, DCA, TWAP, and combo-order engine for AI agents.
Is this safe?
Yes, and here's exactly why. The private key is read once from TRADEROUTER_PRIVATE_KEY, used for local signing with @solana/web3.js + tweetnacl, and never transmitted, logged, or persisted. Only signed transactions leave your machine. Server messages are Ed25519-verified against a hard-coded trust anchor. See SECURITY.md for the full threat model, data-flow diagram, and permissions manifest.
Signing flow:
Agent calls
build_swap→ MCP sends wallet address (public key) to api.traderouter.aiAPI returns an unsigned transaction
MCP signs the tx locally using
TRADEROUTER_PRIVATE_KEYThe signed transaction is submitted to
/protect(Jito MEV-protected bundle)Server confirms and returns balance changes. The private key never crosses the network.
Related MCP server: RefundYourSOL
Requirements
Node.js ≥ 18
A Solana wallet private key in base58 format (use a dedicated trading wallet, not your main holdings)
Install
npx -y @traderouter/trade-router-mcpOr wire it into an MCP client (Claude Desktop, Cursor, Cline, etc.):
{
"mcpServers": {
"traderouter": {
"command": "npx",
"args": ["-y", "@traderouter/trade-router-mcp"],
"env": {
"TRADEROUTER_PRIVATE_KEY": "your_base58_private_key"
}
}
}
}OS | Claude Desktop config path |
macOS |
|
Windows |
|
Linux |
|
Environment variables
Variable | Required | Default | Purpose |
| ✅ | — | Solana wallet private key (base58). Local use only. |
| ❌ |
| Custom RPC for reads |
| ❌ | baked-in trust anchor | Override the server's Ed25519 trust anchor |
| ❌ | (unset) | Accept messages signed by this key in addition to the primary (key rotation) |
| ❌ |
| Verify server signatures on |
| ❌ |
| Verify server signatures on |
| ❌ |
| When |
Tools
Tool | Purpose |
| Get the configured wallet's public address |
| Build an unsigned swap transaction |
| Submit a manually signed transaction |
| Build + sign + submit in one call |
| Get token holdings for a wallet |
| Market cap and price for a token |
| Trade card PNG URL for wallet + token |
| Limit buy/sell by price or market cap |
| Trailing stop buy/sell |
| TWAP (time-weighted) buy/sell |
| Limit trigger → TWAP execution |
| Trailing trigger → TWAP execution |
| Limit trigger → trailing execution (single swap on trigger) |
| Limit trigger → trailing trigger → TWAP execution |
| List active orders for a wallet |
| Get status of a specific order |
| Cancel an active order |
| Extend an order's expiry |
| Register a wallet over the persistent WebSocket |
| Current WebSocket connection state |
| Log of filled orders |
REST endpoints (under the hood)
Endpoint | Purpose |
| Build unsigned swap (multi-DEX: Raydium, PumpSwap, Orca, Meteora) |
| Submit signed tx via Jito bundle — MEV-protected |
| Wallet scan — catches tokens standard RPC misses |
| Market cap + price |
| Trade card PNG generation |
| Persistent WebSocket for limits / trailing / DCA / TWAP / combo orders |
Trust anchor
The baked-in server public key is EXX3nRzfDUvbjZSmxFzHDdiSYeGVP1EGr77iziFZ4Jd4. Every order_filled, order_created, and twap_execution message from the server is verified with Ed25519 before being treated as authoritative. See SECURITY.md for details and the rotation mechanism (TRADEROUTER_SERVER_PUBKEY_NEXT).
Use with LangChain
Any MCP server works in LangChain via the official adapter:
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"traderouter": {
"command": "npx",
"args": ["-y", "@traderouter/trade-router-mcp"],
"transport": "stdio",
"env": {"TRADEROUTER_PRIVATE_KEY": "<base58>"},
},
})
tools = await client.get_tools()Fees
Flat 1% fee on swap volume, embedded in routing at /protect. No subscription, no API key, no monthly minimums. Read-only endpoints (/holdings, /mcap) are free.
Machine-readable specs (live on traderouter.ai)
URL | Format | Purpose |
OpenAPI 3.1 (JSON) | Canonical API contract — generate SDKs in any language | |
OpenAPI 3.1 (YAML) | Same spec, YAML format (regenerated from the JSON) | |
text | LLM-readable API guide (per llmstxt.org) | |
markdown | Anthropic Agent Skills format — full implementation guide | |
markdown | Threat model + data-flow diagram + permissions manifest (mirrors ./SECURITY.md here) | |
markdown | Unified changelog across the API / MCP server / Site version tracks |
Quick SDK generation:
# TypeScript
openapi-generator-cli generate -i https://traderouter.ai/openapi.yaml -g typescript-axios -o ./sdk-ts
# Python
openapi-generator-cli generate -i https://traderouter.ai/openapi.yaml -g python -o ./sdk-pySecurity disclosure
Email security@traderouter.ai or use GitHub Security Advisories on this repo. 48-hour acknowledgement. See SECURITY.md (or the hosted version if you'd rather link to a stable URL).
License
MIT. See LICENSE.
Changelog
See CHANGELOG.md.
Available Tools
21 toolsauto_swapB
Build + sign + submit in one step. Requires TRADEROUTER_PRIVATE_KEY.
Inputs: wallet_address (required), token_address (required), action (required), amount, +2 more.
build_swapA
Build an unsigned Solana swap tx via REST. Returns base58 swap_tx. Pass to submit_signed_swap or use auto_swap.
Inputs: wallet_address (required), token_address (required), action (required), amount, +2 more.
cancel_orderC
Cancel an active limit or trailing order.
Inputs: wallet_address (required), order_id (required).
check_orderB
Check the status of a specific order by order_id.
Inputs: wallet_address (required), order_id (required).
connection_statusC
Return live WS connection state for a wallet.
Inputs: wallet_address (required).
connect_websocketA
Connect WS for a wallet and wait until registered (up to 25s). Call before placing orders.
Inputs: wallet_address (required).
extend_orderC
Extend an order's expiry. expiry_hours is the new total (1–336).
Inputs: wallet_address (required), order_id (required), expiry_hours (required).
get_fill_logC
Return all order_filled events received since process start (capped at 200).
Inputs: wallet_address (required).
get_flex_cardC
Get the URL for a flex trade card PNG for a wallet and token. GET /flex. Returns the URL to display the image.
Inputs: wallet_address (required), token_address (required).
get_holdingsA
Scan SPL token holdings for a Solana wallet. Slow — up to 100s.
Inputs: wallet_address (required).
get_mcapA
Get market cap (and price/pool) data for one or more token addresses. GET /mcap.
Inputs: tokens (required).
get_wallet_addressA
Derive the Solana wallet address from TRADEROUTER_PRIVATE_KEY. Call first at session start — also starts WebSocket connection.
Inputs: no named parameters.
list_ordersC
List all active limit/trailing orders for a wallet.
Inputs: wallet_address (required).
place_limit_orderC
Place a market-cap-based limit order over WS. action: sell|buy. target: bps vs current mcap at placement.
Inputs: wallet_address (required), token_address (required), action (required), target (required), +4 more.
place_limit_trailing_orderC
Place a limit-then-trailing order. Wait for limit, then trailing phase; when trail triggers, single swap. action: limit_trailing_sell|limit_trailing_buy.
Inputs: wallet_address (required), token_address (required), action (required), target (required), +5 more.
place_limit_trailing_twap_orderB
Place a limit-then-trailing-then-TWAP order. Limit → trail → on trail trigger, execute via TWAP. action: limit_trailing_twap_sell|limit_trailing_twap_buy.
Inputs: wallet_address (required), token_address (required), action (required), target (required), +7 more.
place_limit_twap_orderB
Place a limit-then-TWAP order. Wait for limit target (bps), then execute via TWAP. action: limit_twap_sell|limit_twap_buy.
Inputs: wallet_address (required), token_address (required), action (required), target (required), +6 more.
place_trailing_orderC
Place a trailing stop or trailing buy over WS. action: trailing_sell|trailing_buy. trail: bps distance.
Inputs: wallet_address (required), token_address (required), action (required), trail (required), +4 more.
place_trailing_twap_orderB
Place a trailing-then-TWAP order. When trail triggers, execute via TWAP. action: trailing_twap_sell|trailing_twap_buy.
Inputs: wallet_address (required), token_address (required), action (required), trail (required), +6 more.
place_twap_orderC
Place a TWAP (time-weighted) buy or sell order. Splits total amount into frequency slices over duration seconds. action: twap_buy|twap_sell.
Inputs: wallet_address (required), token_address (required), action (required), frequency (required), +4 more.
submit_signed_swapB
Submit a base64-encoded signed Solana transaction via MEV-protected lane.
Inputs: signed_tx_base64 (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools target distinct actions (swap, order types, connection, data). However, the variety of order placement tools (limit, trailing, TWAP, and composite types) could cause minor confusion, though their descriptions differentiate them.
Tools follow a consistent verb_noun pattern in snake_case (e.g., cancel_order, get_holdings). Minor inconsistencies like 'connection_status' vs 'connect_websocket' and 'auto_swap' using an adverb instead of a verb are present but not disruptive.
21 tools is slightly high but justified by the server's breadth (swap, multiple order types, connection, data). Each tool serves a specific purpose, though some consolidation could reduce the count.
Covers core trading lifecycle: swaps, order placement/cancellation/check, connection setup, and data queries. Missing: historical trade log beyond in-memory events and token price discovery (only market cap), but these are minor gaps for the intended use.
Maintenance
Related MCP Connectors
Non-custodial DeFi tools for AI agents on Solana: swaps, perps, lending, staking, equities.
Safe Solana swaps for AI agents with risk checks, unsigned transactions, x402, and 3-bp fees.
Native Solana staking for AI agents. 26 MCP tools, one-shot signing, webhooks.
Non-custodial DEX aggregator for autonomous AI agents: best-price swaps on 8 chains, no API key.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables AI agents to interact with cryptocurrency ecosystems through wallet management, trading operations (swaps, DCA, limit orders), staking, and multi-chain support starting with Solana.37GPL 3.0
- AlicenseAqualityDmaintenanceSolana wallet cleanup, token trading on 12+ DEXes, and market data. Scan wallets for reclaimable SOL, close empty token accounts, burn dust tokens, buy/sell with Jito MEV protection. 7 tools for AI agents.411 npmMIT
- AlicenseAqualityBmaintenanceDeFi execution and agent-to-agent economy tools for AI agents — swaps, yield, transfers, policy enforcement, trust scoring, A2A jobs, and P\&L across Ethereum, Base, Arbitrum, and Polygon.311Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI agents to read chain data, execute transactions, swap tokens, and manage wallets on Solana through 38 tools across 7 modules. Supports write operations with a private key and includes built-in prompts for common workflows.381MIT