{
  "markdown": "# TradeStaq MCP Server\n\n[![npm version](https://img.shields.io/npm/v/@the-staq/tradestaq-mcp)](https://www.npmjs.com/package/@the-staq/tradestaq-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n**[Website](https://tradestaq.com)** · **[Docs](https://tradestaq.com/docs)** · **[MCP / AI Tools](https://tradestaq.com/mcp)** · **[Pricing](https://tradestaq.com/pricing)**\n\n**31 AI-powered trading tools for Claude, Cursor, and any MCP client.**\n\nCreate strategies, backtest them, deploy trading bots, copy top traders, monitor positions, and manage your crypto portfolio, all from conversation. Supports Binance, Bybit, OKX, Bitget, Hyperliquid, dYdX, and more.\n\n```\n\"Show me my portfolio\" → get_portfolio\n\"Backtest GhostRider on BTC/USDT for 3 months\" → what_if_backtest\n\"Deploy it on my Binance account\" → deploy_bot\n\"Who are the top traders this month?\" → list_top_traders\n\"Generate a momentum strategy for ETH\" → generate_strategy\n```\n\n## Quick Start\n\n### Option A: Remote server (no install needed)\n\nFor MCP clients that support HTTP transport:\n\n```json\n{\n  \"mcpServers\": {\n    \"tradestaq\": {\n      \"url\": \"https://mcp.tradestaq.com/mcp\"\n    }\n  }\n}\n```\n\n### Option B: npx (recommended for local)\n\nNo clone, no build. Just add to your MCP config:\n\n**Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"tradestaq\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@the-staq/tradestaq-mcp\"]\n    }\n  }\n}\n```\n\n**Cursor** (`.cursor/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"tradestaq\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@the-staq/tradestaq-mcp\"]\n    }\n  }\n}\n```\n\n**Claude Code:**\n\n```sh\nclaude mcp add tradestaq -- npx -y @the-staq/tradestaq-mcp\n```\n\n### Option C: Clone and build\n\n```sh\ngit clone https://github.com/the-staq/tradestaq-mcp.git\ncd tradestaq-mcp\nnpm install\nnpm run build\n```\n\nThen point your MCP client to `dist/index.js`.\n\n## Authenticate\n\nAfter adding the server, ask your AI assistant to log in:\n\n- **\"Log me in to TradeStaq\"** — uses email/password directly\n- **\"Authenticate with TradeStaq\"** — opens a browser window for secure OAuth login\n\nCredentials never enter the chat when using the browser flow. Token is stored locally at `~/.tradestaq/mcp-config.json` with restricted permissions (0600).\n\n## Tools\n\n### Auth\n\n| Tool | Description |\n|------|-------------|\n| `login` | Log in with email and password |\n| `authenticate` | Log in via browser (OAuth + PKCE) |\n| `check_auth` | Check authentication status |\n| `set_token` | Manually set a JWT token |\n| `connect_exchange` | Connect an exchange account via browser |\n| `logout` | Remove stored credentials |\n\n### Market Data\n\n| Tool | Description |\n|------|-------------|\n| `get_price` | Current price, 24h change, volume |\n| `get_candles` | OHLCV candlestick data (1m to 1d) |\n| `list_exchanges` | List connected exchange accounts |\n| `search_markets` | Find trading pairs on a specific exchange |\n\n### Portfolio\n\n| Tool | Description |\n|------|-------------|\n| `get_portfolio` | Total balance, exchanges, active bots |\n| `get_positions` | Open positions with live PnL |\n\n### Strategies\n\n| Tool | Description |\n|------|-------------|\n| `list_strategies` | Browse marketplace or your own strategies |\n| `get_strategy` | Full strategy details and performance |\n| `explain_strategy` | Plain-English explanation with risk profile |\n| `compare_strategies` | Side-by-side metrics comparison |\n| `create_strategy` | Create a strategy from TradeDroid code |\n| `generate_strategy` | Generate a strategy from natural language using AI |\n\n### Backtesting\n\n| Tool | Description |\n|------|-------------|\n| `what_if_backtest` | Run a historical backtest (async, 30-120s) |\n| `get_backtest_results` | Check status of a running backtest |\n\n### Bot Management\n\n| Tool | Description |\n|------|-------------|\n| `list_bots` | All bots with status and performance |\n| `get_bot_status` | Detailed bot metrics and config |\n| `deploy_bot` | Deploy a strategy as a trading bot |\n| `stop_bot` | Stop a running bot |\n| `close_position` | Close an open position (full or partial) |\n\n`deploy_bot` defaults to paper trading. Pass `live: true` for real money.\n\n### Trade History\n\n| Tool | Description |\n|------|-------------|\n| `get_trade_history` | Closed trades with PnL, entry/exit prices |\n| `get_performance_metrics` | ROI, win rate, Sortino ratio, PnL breakdown |\n\n### Copy Trading\n\n| Tool | Description |\n|------|-------------|\n| `list_top_traders` | Browse the leaderboard of top traders |\n| `follow_trader` | Subscribe to copy a trader's trades |\n\n### Advisor\n\n| Tool | Description |\n|------|-------------|\n| `suggest_strategies` | Match strategies to your risk profile |\n| `get_market_context` | Trend, volatility, support/resistance for a symbol |\n\n## Prompt Templates\n\n**Trading Assistant** — Start a conversation about your portfolio and positions. The AI calls `get_portfolio` and `get_positions` to ground its responses in your actual data.\n\n**Strategy Builder** — Walk through creating, backtesting, and deploying a strategy. Pass an optional `goal` like \"momentum strategy for ETH\" to get focused suggestions.\n\n**Portfolio Reviewer** — Deep analysis of your portfolio, positions, trade history, and performance. Identifies what's working, what isn't, and suggests improvements.\n\n## Resources\n\nMCP resources provide browsable data that AI clients can read directly:\n\n| Resource | URI | Description |\n|----------|-----|-------------|\n| Portfolio | `tradestaq://portfolio` | Balances, positions, and active bots |\n| Bots | `tradestaq://bots` | All bots with status and PnL |\n| Strategies | `tradestaq://strategies` | Strategy catalog with ratings |\n\n## Architecture\n\n```\n                    stdio                                    HTTPS\n┌──────────────┐◄──────────►┐                  ┌────────────────►┌──────────────┐\n│Claude Desktop│             │                  │                 │              │\n│Cursor / CLI  │             │  tradestaq-mcp   │   Bearer JWT    │  TradeStaq   │\n└──────────────┘             │  31 tools        │◄────────────────│  API         │\n                             │  3 prompts       │                 │              │\n┌──────────────┐  HTTP+SSE  │  3 resources      │                 └──────────────┘\n│ Any MCP      │◄──────────►│                  │\n│ client (web) │             └──────────────────┘\n└──────────────┘\n```\n\n- **Two transports:** stdio (local, default) and HTTP+SSE (remote, `--http` flag)\n- Hosted at `https://mcp.tradestaq.com/mcp` for remote clients\n- JWT auth via OAuth PKCE or email/password login\n- All tools return structured JSON with error contract\n- Token auto-refresh when expiring within 1 hour\n\n## Development\n\n```sh\nnpm run dev        # watch mode with tsx\nnpm run build      # compile TypeScript\nnpm run lint       # type check without emitting\nnpm test           # run tests\nnpm start          # run server (stdio)\nnpm run start:http # run server (HTTP+SSE on port 3100)\n```\n\n## Error Handling\n\nAll tool errors return structured responses:\n\n```json\n{\n  \"error\": {\n    \"code\": \"INSUFFICIENT_BALANCE\",\n    \"message\": \"Human-readable description\",\n    \"retryable\": true,\n    \"retryAfterMs\": 5000\n  }\n}\n```\n\nError codes: `AUTH_EXPIRED`, `TIMEOUT`, `RATE_LIMITED`, `NETWORK_ERROR`, `HTTP_4xx`, `HTTP_5xx`.\n\n## Security\n\n- Credentials never enter AI conversation history\n- OAuth PKCE flow with browser-based authentication\n- Token stored with 0600 file permissions\n- Localhost-only OAuth callbacks\n- `deploy_bot`, `stop_bot`, `close_position`, and `follow_trader` are destructive operations (AI confirms with user)\n\n## Links\n\n- **Website:** [tradestaq.com](https://tradestaq.com)\n- **Documentation:** [tradestaq.com/docs](https://tradestaq.com/docs)\n- **MCP & AI trading tools:** [tradestaq.com/mcp](https://tradestaq.com/mcp)\n- **Pricing:** [tradestaq.com/pricing](https://tradestaq.com/pricing)\n- **npm package:** [@the-staq/tradestaq-mcp](https://www.npmjs.com/package/@the-staq/tradestaq-mcp)\n\n## License\n\nMIT\n",
  "bytes": 8075,
  "sha": "3d337bc363a05711ee3e6fb9a14f8e08b59169b57e4607dc3468f41bd7ff5f23",
  "repo_slug": "the-staq/tradestaq-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_the_staq_tradestaq_mcp_cbcd5f40/readme"
}