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
- Add the config to your AI client (see below)
- 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
{
"mcpServers": {
"trenchtools": {
"command": "npx",
"args": ["-y", "trenchtools-mcp"]
}
}
}Cursor
Go to Settings > MCP Servers and add:
{
"mcpServers": {
"trenchtools": {
"command": "npx",
"args": ["-y", "trenchtools-mcp"]
}
}
}VS Code (Copilot)
Add to your VS Code settings.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
- A wallet vault is auto-created at
~/.trenchtools/vault.json(AES-256-GCM + Argon2 encrypted) - An encryption password is auto-generated and saved to
~/.trenchtools/config.json - The server connects to TrenchTools infrastructure (RPC, Jupiter, priority fees — all handled)
- 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:
| Variable | Required | Default | Description |
|---|---|---|---|
TRENCH_VAULT_PASSWORD | No | Auto-generated | Custom vault encryption password (min 8 chars) |
TRENCH_VAULT_PATH | No | ~/.trenchtools/vault.json | Wallet vault file location |
TRENCH_SLIPPAGE_BPS | No | 500 | Default slippage in basis points (500 = 5%) |
TRENCH_MAX_BUY_SOL | No | 1.0 | Safety 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_SOLsetting 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:
| Category | Tools |
|---|---|
| Trading | trench_quote, trench_buy, trench_sell |
| Wallets | trench_wallet_list, trench_wallet_generate, trench_wallet_fund, trench_wallet_sweep |
| Intelligence | trench_token_info, trench_balances, trench_positions, trench_shield_scan |
| Automation | trench_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 |
| Stealth | trench_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:
- Derives the PumpFun bonding curve PDA for the token
- Checks if the account exists and if the
completeflag is set - 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.