Skip to main content
Glama
trade-router-mcp

trade-router-mcp

Official
by TradeRouter

@traderouter/trade-router-mcp

一个用于 TradeRouter.ai 的 模型上下文协议 (Model Context Protocol) 服务器——为 AI 代理提供非托管的 Solana 交易、限价、追踪、DCA、TWAP 及组合订单引擎。

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

这安全吗?

是的,原因如下。 私钥仅从 TRADEROUTER_PRIVATE_KEY 读取一次,用于通过 @solana/web3.js + tweetnacl 进行本地签名,且绝不会被传输、记录或持久化。只有已签名的交易才会离开您的机器。服务器消息通过硬编码的信任锚点进行 Ed25519 验证。请参阅 SECURITY.md 以获取完整的威胁模型、数据流图和权限清单。

签名流程:

  1. 代理调用 build_swap → MCP 将钱包地址(公钥)发送至 api.traderouter.ai

  2. API 返回一个未签名的交易

  3. MCP 使用 TRADEROUTER_PRIVATE_KEY 在本地对交易进行签名

  4. 已签名的交易被提交至 /protect(Jito MEV 保护的捆绑包)

  5. 服务器确认并返回余额变动。私钥绝不会跨网络传输。

Related MCP server: RefundYourSOL

要求

  • Node.js ≥ 18

  • base58 格式的 Solana 钱包私钥(请使用专门的交易钱包,而非您的主资产钱包)

安装

npx -y @traderouter/trade-router-mcp

或者将其接入 MCP 客户端(Claude Desktop、Cursor、Cline 等):

{
  "mcpServers": {
    "traderouter": {
      "command": "npx",
      "args": ["-y", "@traderouter/trade-router-mcp"],
      "env": {
        "TRADEROUTER_PRIVATE_KEY": "your_base58_private_key"
      }
    }
  }
}

操作系统

Claude Desktop 配置文件路径

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Linux

~/.config/Claude/claude_desktop_config.json

环境变量

变量

必需

默认值

用途

TRADEROUTER_PRIVATE_KEY

✅

—

Solana 钱包私钥 (base58)。仅限本地使用。

SOLANA_RPC_URL

❌

https://api.mainnet-beta.solana.com

用于读取的自定义 RPC

TRADEROUTER_SERVER_PUBKEY

❌

内置信任锚点

覆盖服务器的 Ed25519 信任锚点

TRADEROUTER_SERVER_PUBKEY_NEXT

❌

(未设置)

除主密钥外,接受由此密钥签名的消息(密钥轮换)

TRADEROUTER_REQUIRE_SERVER_SIGNATURE

❌

true

验证 order_filled / twap_execution 上的服务器签名

TRADEROUTER_REQUIRE_ORDER_CREATED_SIGNATURE

❌

true

验证 order_created 上的服务器签名

TRADEROUTER_DRY_RUN

❌

false

当为 true 时,每个写操作工具(submit_signed_swap、auto_swap、place_*_order、cancel_order、extend_order)将返回 { dry_run: true, tool, args } 而不是调用 API。只读工具正常执行。于 1.0.9 版本添加。

工具

工具

用途

get_wallet_address

获取已配置钱包的公钥地址

build_swap

构建未签名的交易

submit_signed_swap

提交手动签名的交易

auto_swap

一次调用完成构建 + 签名 + 提交

get_holdings

获取钱包的代币持有量

get_mcap

获取代币的市值和价格

get_flex_card

获取钱包 + 代币的交易卡片 PNG URL

place_limit_order

按价格或市值进行限价买入/卖出

place_trailing_order

追踪止损买入/卖出

place_twap_order

TWAP(时间加权)买入/卖出

place_limit_twap_order

限价触发 → TWAP 执行

place_trailing_twap_order

追踪触发 → TWAP 执行

place_limit_trailing_order

限价触发 → 追踪执行(触发时单次交易)

place_limit_trailing_twap_order

限价触发 → 追踪触发 → TWAP 执行

list_orders

列出钱包的活动订单

check_order

获取特定订单的状态

cancel_order

取消活动订单

extend_order

延长订单有效期

connect_websocket

通过持久 WebSocket 注册钱包

connection_status

当前 WebSocket 连接状态

get_fill_log

已成交订单日志

REST 端点(底层)

端点

用途

POST /swap

构建未签名交易(多 DEX:Raydium、PumpSwap、Orca、Meteora)

POST /protect

通过 Jito 捆绑包提交已签名交易 — MEV 保护

POST /holdings

钱包扫描 — 捕获标准 RPC 遗漏的代币

GET /mcap

市值 + 价格

GET /flex

交易卡片 PNG 生成

wss://api.traderouter.ai/ws

用于限价 / 追踪 / DCA / TWAP / 组合订单的持久 WebSocket

信任锚点

内置的服务器公钥为 EXX3nRzfDUvbjZSmxFzHDdiSYeGVP1EGr77iziFZ4Jd4。来自服务器的每条 order_filled、order_created 和 twap_execution 消息在被视为权威信息前,都会通过 Ed25519 进行验证。详情及轮换机制(TRADEROUTER_SERVER_PUBKEY_NEXT)请参阅 SECURITY.md。

与 LangChain 一起使用

任何 MCP 服务器都可以通过官方适配器在 LangChain 中使用:

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()

费用

交易额收取 1% 的固定费用,嵌入在 /protect 的路由中。无订阅费、无 API 密钥要求、无月度最低消费。只读端点(/holdings、/mcap)免费。

机器可读规范(实时更新于 traderouter.ai)

URL

格式

用途

https://traderouter.ai/openapi.json

OpenAPI 3.1 (JSON)

规范的 API 合约 — 可生成任何语言的 SDK

https://traderouter.ai/openapi.yaml

OpenAPI 3.1 (YAML)

相同规范,YAML 格式(从 JSON 重新生成)

https://traderouter.ai/llms.txt

text

LLM 可读的 API 指南(参考 llmstxt.org)

https://traderouter.ai/SKILL.md

markdown

Anthropic 代理技能格式 — 完整实现指南

https://traderouter.ai/SECURITY.md

markdown

威胁模型 + 数据流图 + 权限清单(镜像此处 ./SECURITY.md)

https://traderouter.ai/CHANGELOG.md

markdown

API / MCP 服务器 / 站点版本跟踪的统一更新日志

快速 SDK 生成:

# 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@traderouter.ai 或在此仓库使用 GitHub 安全公告。48 小时内确认。请参阅 SECURITY.md(如果您更喜欢链接到稳定 URL,请参阅 托管版本)。

许可证

MIT。请参阅 LICENSE。

更新日志

请参阅 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