Skip to content

MCP Server

What is This?

AI agents are everywhere right now. Claude, Cursor, Cline, Windsurf — they can all write code, answer questions, and browse the web. But they can't trade crypto. Until now.

TrenchTools' MCP server turns any AI agent into a multi-chain trader. Ask your AI to buy a token, check if something's a rug, manage your wallets, or scan your portfolio — and it actually does it. Works across Solana, BSC, Base, and SUI.

MCP (Model Context Protocol) is Anthropic's open standard that lets AI assistants use external tools. Think of it like giving your AI agent hands — it can now reach out and interact with multiple chains through TrenchTools' battle-tested trading infrastructure.

Quick Start

  1. Add the config to your AI client (see below)
  2. Start talking to your AI about trading

That's it. Zero sign-up, zero configuration. The server auto-generates an encrypted wallet vault on first run and connects to TrenchTools infrastructure automatically.

Client Setup

Claude Desktop

Edit your claude_desktop_config.json:

Finding the config file

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "trenchtools": {
      "command": "npx",
      "args": ["-y", "trenchtools-mcp"]
    }
  }
}

Cursor

Go to Settings > MCP Servers and add:

json
{
  "mcpServers": {
    "trenchtools": {
      "command": "npx",
      "args": ["-y", "trenchtools-mcp"]
    }
  }
}

VS Code (Copilot)

Add to your VS Code settings.json:

json
{
  "mcp": {
    "servers": {
      "trenchtools": {
        "command": "npx",
        "args": ["-y", "trenchtools-mcp"]
      }
    }
  }
}

Cline / Windsurf

Both follow the same JSON format as Cursor. Check their docs for where to paste the config.

What Happens on First Run

  1. A wallet vault is auto-created at ~/.trenchtools/vault.json (AES-256-GCM + Argon2 encrypted)
  2. An encryption password is auto-generated and saved to ~/.trenchtools/config.json
  3. The server connects to TrenchTools infrastructure (RPC, Jupiter, priority fees — all handled)
  4. Ask your AI to generate wallets, fund them, and start trading

DANGER

Back up your ~/.trenchtools/ directory. If you lose it, your wallet keys are unrecoverable.

Configuration

Everything works out of the box. These env vars are optional overrides:

VariableRequiredDefaultDescription
TRENCH_VAULT_PASSWORDNoAuto-generatedCustom vault encryption password (min 8 chars)
TRENCH_VAULT_PATHNo~/.trenchtools/vault.jsonWallet vault file location
TRENCH_SLIPPAGE_BPSNo500Default slippage in basis points (500 = 5%)
TRENCH_MAX_BUY_SOLNo1.0Safety cap per buy order in SOL

Self-Hosting

Want to run with your own RPC and API keys (zero fees)? Set TRENCH_SELF_HOSTED=true and provide TRENCH_RPC_URL. See the Self-Hosting Guide for details.

Security

  • Non-custodial: Private keys never leave your machine. The vault file is encrypted at rest and only decrypted in the MCP server process.
  • Safety cap: The TRENCH_MAX_BUY_SOL setting prevents accidental large buys. The AI agent cannot override this.
  • Local only: The MCP server runs locally via stdio. No network exposure, no API endpoints, no external servers.
  • Open source: Full source code at github.com/natebag/Trenchtools in packages/mcp/.

Available Tools

The MCP server exposes 20 tools across five categories:

CategoryTools
Tradingtrench_quote, trench_buy, trench_sell
Walletstrench_wallet_list, trench_wallet_generate, trench_wallet_fund, trench_wallet_sweep
Intelligencetrench_token_info, trench_balances, trench_positions, trench_shield_scan
Automationtrench_volume_start, trench_volume_status, trench_volume_stop, trench_bot_start, trench_bot_status, trench_bot_stop, trench_activity_start, trench_activity_status, trench_activity_stop
Stealthtrench_stealth_fund

See the Tools Reference for full documentation on each tool, or check out Agent Examples to see real conversations.

How Auto-Routing Works

Every trading tool automatically detects the right DEX for each chain:

Solana:

  1. Derives the PumpFun bonding curve PDA for the token
  2. Checks if the account exists and if the complete flag is set
  3. Routes to PumpFun (bonding curve) or Jupiter (aggregator) accordingly

BSC / Base:

  • All tokens route through OpenOcean aggregator automatically

SUI:

  • All tokens route through OpenOcean aggregator automatically

You don't need to tell the AI which DEX to use — it figures it out automatically. Just pass chain: "bsc", chain: "base", or chain: "sui" for non-Solana tokens.

Released under the MIT License.