trade-router-mcp
Non-custodial Solana swap & limit order engine for AI agents. 21 tools - swap, limit, trailing, TWAP, DCA, combo orders - across Raydium, PumpSwap, Orca, Meteora. Jito MEV-protected execution. Ed25519-verified server messages. Private key never leaves the process.
README
@traderouter/trade-router-mcp
<!-- mcp-name: ai.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.ai - API returns an unsigned transaction
- MCP signs the tx locally using
TRADEROUTER_PRIVATE_KEY - The signed transaction is submitted to
/protect(Jito MEV-protected bundle) - Server confirms and returns balance changes. The private key never crosses the network.
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-mcp
Or 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 | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
TRADEROUTER_PRIVATE_KEY |
✅ | — | Solana wallet private key (base58). Local use only. |
SOLANA_RPC_URL |
❌ | https://api.mainnet-beta.solana.com |
Custom RPC for reads |
TRADEROUTER_SERVER_PUBKEY |
❌ | baked-in trust anchor | Override the server's Ed25519 trust anchor |
TRADEROUTER_SERVER_PUBKEY_NEXT |
❌ | (unset) | Accept messages signed by this key in addition to the primary (key rotation) |
TRADEROUTER_REQUIRE_SERVER_SIGNATURE |
❌ | true |
Verify server signatures on order_filled / twap_execution |
TRADEROUTER_REQUIRE_ORDER_CREATED_SIGNATURE |
❌ | true |
Verify server signatures on order_created |
TRADEROUTER_DRY_RUN |
❌ | false |
When true, every write-action tool (submit_signed_swap, auto_swap, place_*_order, cancel_order, extend_order) returns { dry_run: true, tool, args } instead of calling the API. Read-only tools execute normally. Added in 1.0.9. |
Tools
| Tool | Purpose |
|---|---|
get_wallet_address |
Get the configured wallet's public address |
build_swap |
Build an unsigned swap transaction |
submit_signed_swap |
Submit a manually signed transaction |
auto_swap |
Build + sign + submit in one call |
get_holdings |
Get token holdings for a wallet |
get_mcap |
Market cap and price for a token |
get_flex_card |
Trade card PNG URL for wallet + token |
place_limit_order |
Limit buy/sell by price or market cap |
place_trailing_order |
Trailing stop buy/sell |
place_twap_order |
TWAP (time-weighted) buy/sell |
place_limit_twap_order |
Limit trigger → TWAP execution |
place_trailing_twap_order |
Trailing trigger → TWAP execution |
place_limit_trailing_order |
Limit trigger → trailing execution (single swap on trigger) |
place_limit_trailing_twap_order |
Limit trigger → trailing trigger → TWAP execution |
list_orders |
List active orders for a wallet |
check_order |
Get status of a specific order |
cancel_order |
Cancel an active order |
extend_order |
Extend an order's expiry |
connect_websocket |
Register a wallet over the persistent WebSocket |
connection_status |
Current WebSocket connection state |
get_fill_log |
Log of filled orders |
REST endpoints (under the hood)
| Endpoint | Purpose |
|---|---|
POST /swap |
Build unsigned swap (multi-DEX: Raydium, PumpSwap, Orca, Meteora) |
POST /protect |
Submit signed tx via Jito bundle — MEV-protected |
POST /holdings |
Wallet scan — catches tokens standard RPC misses |
GET /mcap |
Market cap + price |
GET /flex |
Trade card PNG generation |
wss://api.traderouter.ai/ws |
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 |
|---|---|---|
| https://traderouter.ai/openapi.json | OpenAPI 3.1 (JSON) | Canonical API contract — generate SDKs in any language |
| https://traderouter.ai/openapi.yaml | OpenAPI 3.1 (YAML) | Same spec, YAML format (regenerated from the JSON) |
| https://traderouter.ai/llms.txt | text | LLM-readable API guide (per llmstxt.org) |
| https://traderouter.ai/SKILL.md | markdown | Anthropic Agent Skills format — full implementation guide |
| https://traderouter.ai/SECURITY.md | markdown | Threat model + data-flow diagram + permissions manifest (mirrors ./SECURITY.md here) |
| https://traderouter.ai/CHANGELOG.md | 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-py
Security 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。