Skip to content

Agent access (MCP) ​

TodoAI exposes a standard MCP (Model Context Protocol) endpoint. Any MCP-capable AI agent (Claude, OKX Agent Trade Kit, your own agent) can drive it directly: backtest strategies, tune parameters, deploy to paper, check positions, panic close.

Core safety principle: exchange API keys never reach the model. The agent sees tools and results; credentials stay server-side.

One-time setup ​

  1. Log in to the app, go to Account → MCP token, click generate
  2. The token looks like qk_mcp_xxx… — the plaintext is shown once, copy it immediately
  3. Configure the MCP endpoint in your agent client:
Endpoint:  https://app.totodo.icu/api/mcp
Auth:      Authorization: Bearer qk_mcp_xxx…

JSON-RPC example:

bash
curl -X POST https://app.totodo.icu/api/mcp \
  -H "Authorization: Bearer qk_mcp_xxx…" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

If a token leaks or falls out of use, rotate it (the old one dies instantly) or revoke it on the account page.

Tool catalogue ​

ToolWhat it doesTier
backtest_strategyBacktest: pass a strategyId or inline DSL. Returns return/Sharpe/drawdown/win-rate plus a buy-and-hold baselineAll
optimize_strategyParameter sweep (train/holdout discipline, anti-overfit)PRO+
deploy_paperDeploy as a paper-trading strategy (refused in REAL mode, to avoid accidentally creating a live strategy)All
get_positionsList current positionsAll
panic_closeEmergency flatten-all (all tiers, closing is never gated)All
get_strategy_reportStrategy run reportAll

The tier gate is absence at registration: a FREE user's tools/list simply does not contain optimize_strategy, rather than failing at call time. Agents should tell the user to upgrade when a tool is absent, not retry.

Agent guardrails ​

Guardrails for agents driving TodoAI (put these in your own skill/prompt):

  • Never fabricate numbers — backtest/optimize results come from the tool, not from memory
  • No optimize → deploy auto-chain — show the sweep result to the user; deploying requires user confirmation
  • deploy_paper is refused server-side in REAL mode — that is a feature, not a bug
  • A user-level kill switch (max daily loss / max total exposure) is enforced server-side; no agent can bypass it

How the server protects you ​

  • Keys are used only in the server session; MCP tool outputs have all credential fields stripped (pinned by static-assertion tests)
  • Tokens are stored as sha256 hashes; the plaintext cannot be reconstructed from the database
  • Every tools/call runs the exact same domain implementation as the web app — the numbers an agent sees match the UI bit for bit

TodoAI · Turn trading ideas into automated strategies