Skip to main content
Glama
trade-router-mcp

trade-router-mcp

Official
by TradeRouter

@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.

Security: non-custodial License: MIT npm Awesome MCP Servers Glama MCP Server MCP Registry

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:

  1. Agent calls build_swap → MCP sends wallet address (public key) to api.traderouter.ai

  2. API returns an unsigned transaction

  3. MCP signs the tx locally using TRADEROUTER_PRIVATE_KEY

  4. The signed transaction is submitted to /protect (Jito MEV-protected bundle)

  5. 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-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.

Available Tools

21 tools
auto_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

    B3.2/5.0

    Scored across 21 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers