This guide walks you from a fresh clone to a running paper-trading portfolio that Claude can query and trade through the MCP bridge. The whole stack — Telegram scraper, trading engine, MCP HTTP bridge, and Claude Code client — runs locally. No cloud deployment is required for paper mode, and no Binance API keys are needed until you flip to live.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/ai-trading-mcp/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Node.js 20+ and npm 10+
- A Telegram account (a user account, not a bot — the scraper reads channels the account can see)
- API credentials from my.telegram.org (
CC_TELEGRAM_API_IDandCC_TELEGRAM_API_HASH) - Claude Code installed and authenticated (
npm install -g @anthropic-ai/claude-code) - (Live trading only) Binance API key and secret with spot-trading permissions
Clone and install
Clone the repository and install all workspace dependencies from the root. The
npm install also links the packages/* workspaces (@pro/agent, @pro/main) so subsequent build steps can resolve them.Build workspace packages
The CLI runtime resolves Under the hood this runs
@pro/agent and @pro/main through config/alias.config.ts, which points at the compiled output in each package’s build/ directory. Build them now:scripts/linux/build.sh, which iterates every directory in packages/, runs npm install inside it, then npm run build. On Windows, use the equivalent batch script:build:win uses dotenv-cli to pre-load .env before calling .\\scripts\\win\\build.bat. Make sure .env exists before running it on Windows (see the next step).Set up environment variables
Copy the example environment file (it contains the optional Redis and MongoDB connection strings) and then add your required Telegram credentials:Open The full list of configurable variables:
.env and add the two required variables. Get them from my.telegram.org → API development tools:| Variable | Default | Purpose |
|---|---|---|
CC_TELEGRAM_API_ID | dev fallback in code | Telegram API ID from my.telegram.org |
CC_TELEGRAM_API_HASH | dev fallback in code | Telegram API hash from my.telegram.org |
CC_TELEGRAM_CHANNEL | -1002833393903 | Channel to scrape into get_status |
CC_SYMBOL_LIST | 13 pairs (BTCUSDT,…,PUMPUSDT) | Tradable whitelist; one Live.background() per symbol |
CC_MCP_HOST / CC_MCP_PORT | 127.0.0.1 / 60051 | HTTP bridge between the stdio MCP server and the trading process |
CC_REDIS_HOST | 127.0.0.1 | Optional Redis-backed persistence backend |
CC_MONGO_CONNECTION_STRING | mongodb://localhost:27017/backtest-kit | Optional MongoDB-backed persistence backend |
BINANCE_API_KEY / BINANCE_API_SECRET | — | Live mode only; paper trading needs no keys |
Authorize Telegram
The scraper runs as a Telegram user session, not a bot. This means it can read any channel the account has access to. Run the authorization flow from the Alternatively, use the A QR code is printed to the terminal. In Telegram, go to Settings → Devices → Link Desktop Device and scan it. Enter your 2FA password if prompted.When authorization completes, the session string is written to
packages/main directory:auth script, which pre-loads .env via dotenv-cli before starting — convenient if your Telegram credentials live in a root-level .env:session.txt next to where you ran the command. At runtime, the trading process reads it from the strategy’s working directory — content/manual.strategy/session.txt in this repo. Copy it there:session.txt grants full read access to the Telegram account that scanned the QR code. Treat it like a password: keep it out of version control, off shared machines, and never include it in logs or bug reports.Run paper trading
Start the trading process in paper mode. This uses real Binance market data via This command:
ccxt but keeps all fills simulated inside the engine — no Binance account or API keys needed:- Spawns
Live.background()for every symbol in the 13-symbol whitelist, each independently tracking candles and signals - Starts the web dashboard at http://localhost:60050 (portfolio state, PnL charts, and the
get_statusdump viewer) - Opens the MCP HTTP bridge at
127.0.0.1:60051— the endpoint the stdio MCP server forwards tool calls to
Attach Claude
In a new terminal, wire Claude Code to the running trading process using the bundled This runs Once Claude starts, you can talk to your portfolio directly. Here is a real session (abridged):
mcp.servers.json:claude --dangerously-skip-permissions --mcp-config ./mcp.servers.json, which starts Claude Code with npx @backtest-kit/mcp registered as a stdio MCP server. The stdio server holds no trading state of its own — it forwards every tool call over HTTP to the bridge started in the previous step.The mcp.servers.json used:What’s Next
Paper Trading Guide
Deep dive into paper mode: the 13-symbol whitelist, dump viewer, and interpreting PnL reports.
Live Trading Guide
Configure Binance API keys and learn how the spot broker adapter handles OCO brackets, duplicate-order recovery, and verified closes.
Loop Mode Guide
Set up the unattended
/loop workflow, tune the interval, and write a safe loop prompt.