# trade-router-mcp

Non-custodial Solana trading engine for AI agents. It executes swaps, limit orders, and TWAP strategies while keeping private keys on your machine.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 3
- Author: TradeRouter
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/TradeRouter/trade-router-mcp
- Updated: 2026-04-28
- HTML: https://affpapa.org/en/nevibecode/mcp/trade-router-mcp

## What it does

This server connects an AI assistant to Solana decentralized exchanges. An agent can read wallet balances, check token market caps, perform instant token swaps, or schedule automated orders. It supports limit prices and time-weighted average price schedules.

Private key safety relies on local signing. The process reads `TRADEROUTER_PRIVATE_KEY` from the environment without sharing it over the network. When an agent requests a swap, the API generates an unsigned payload, the local process signs it with `@solana/web3.js`, and the signed bundle goes to Jito for MEV protection.

Running the server requires Node.js 18 or newer and a base58 private key. A dedicated trading wallet is recommended over using cold storage funds. The service charges a flat 1% fee on swap volume inside the protection route, while read-only requests carry no charge.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `TRADEROUTER_PRIVATE_KEY`, `SOLANA_RPC_URL`, `TRADEROUTER_SERVER_PUBKEY`, `TRADEROUTER_SERVER_PUBKEY_NEXT`, `TRADEROUTER_REQUIRE_SERVER_SIGNATURE`, `TRADEROUTER_REQUIRE_ORDER_CREATED_SIGNATURE`, `TRADEROUTER_DRY_RUN` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env TRADEROUTER_PRIVATE_KEY=<TRADEROUTER_PRIVATE_KEY> --env SOLANA_RPC_URL=<SOLANA_RPC_URL> --env TRADEROUTER_SERVER_PUBKEY=<TRADEROUTER_SERVER_PUBKEY> --env TRADEROUTER_SERVER_PUBKEY_NEXT=<TRADEROUTER_SERVER_PUBKEY_NEXT> --env TRADEROUTER_REQUIRE_SERVER_SIGNATURE=<TRADEROUTER_REQUIRE_SERVER_SIGNATURE> --transport stdio trade-router-mcp -- npx -y @traderouter/trade-router-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add trade-router-mcp --env TRADEROUTER_PRIVATE_KEY=<TRADEROUTER_PRIVATE_KEY> --env SOLANA_RPC_URL=<SOLANA_RPC_URL> --env TRADEROUTER_SERVER_PUBKEY=<TRADEROUTER_SERVER_PUBKEY> --env TRADEROUTER_SERVER_PUBKEY_NEXT=<TRADEROUTER_SERVER_PUBKEY_NEXT> --env TRADEROUTER_REQUIRE_SERVER_SIGNATURE=<TRADEROUTER_REQUIRE_SERVER_SIGNATURE> -- npx -y @traderouter/trade-router-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "trade-router-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@traderouter/trade-router-mcp"
            ],
            "env": {
                "TRADEROUTER_PRIVATE_KEY": "<TRADEROUTER_PRIVATE_KEY>",
                "SOLANA_RPC_URL": "<SOLANA_RPC_URL>",
                "TRADEROUTER_SERVER_PUBKEY": "<TRADEROUTER_SERVER_PUBKEY>",
                "TRADEROUTER_SERVER_PUBKEY_NEXT": "<TRADEROUTER_SERVER_PUBKEY_NEXT>",
                "TRADEROUTER_REQUIRE_SERVER_SIGNATURE": "<TRADEROUTER_REQUIRE_SERVER_SIGNATURE>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "trade-router-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@traderouter/trade-router-mcp"
            ],
            "env": {
                "TRADEROUTER_PRIVATE_KEY": "<TRADEROUTER_PRIVATE_KEY>",
                "SOLANA_RPC_URL": "<SOLANA_RPC_URL>",
                "TRADEROUTER_SERVER_PUBKEY": "<TRADEROUTER_SERVER_PUBKEY>",
                "TRADEROUTER_SERVER_PUBKEY_NEXT": "<TRADEROUTER_SERVER_PUBKEY_NEXT>",
                "TRADEROUTER_REQUIRE_SERVER_SIGNATURE": "<TRADEROUTER_REQUIRE_SERVER_SIGNATURE>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e TRADEROUTER_PRIVATE_KEY=<TRADEROUTER_PRIVATE_KEY> -e SOLANA_RPC_URL=<SOLANA_RPC_URL> -e TRADEROUTER_SERVER_PUBKEY=<TRADEROUTER_SERVER_PUBKEY> -e TRADEROUTER_SERVER_PUBKEY_NEXT=<TRADEROUTER_SERVER_PUBKEY_NEXT> -e TRADEROUTER_REQUIRE_SERVER_SIGNATURE=<TRADEROUTER_REQUIRE_SERVER_SIGNATURE> trade-router-mcp npx -y @traderouter/trade-router-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

## When to use it
- swap Solana tokens across liquidity pools directly from an agent
- place limit and trailing stop orders without exposing private keys
- inspect token holdings and track order execution logs
- submit transactions through Jito bundles to prevent MEV frontrunning

## Example prompts
- Check my current token balances using `get_holdings`
- Swap USDC for SOL using the `auto_swap` tool
- Place a limit buy order for this token using `place_limit_order`

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89609
- [CCXT](https://affpapa.org/en/nevibecode/mcp/ccxt.md) — MCP server · ★ 44591
- [Finance Toolkit](https://affpapa.org/en/nevibecode/mcp/finance-toolkit.md) — MCP server · ★ 5469
- [EdgarTools](https://affpapa.org/en/nevibecode/mcp/edgartools.md) — MCP server · ★ 2817
- [LetsFG — Flights & Hotels](https://affpapa.org/en/nevibecode/mcp/letsfg-flights-hotels.md) — MCP server · ★ 2197
- [AutoTS](https://affpapa.org/en/nevibecode/mcp/autots.md) — MCP server · ★ 1434

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
