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
- Log in to the app, go to Account → MCP token, click generate
- The token looks like
qk_mcp_xxx…— the plaintext is shown once, copy it immediately - Configure the MCP endpoint in your agent client:
Endpoint: https://app.totodo.icu/api/mcp
Auth: Authorization: Bearer qk_mcp_xxx…JSON-RPC example:
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
| Tool | What it does | Tier |
|---|---|---|
backtest_strategy | Backtest: pass a strategyId or inline DSL. Returns return/Sharpe/drawdown/win-rate plus a buy-and-hold baseline | All |
optimize_strategy | Parameter sweep (train/holdout discipline, anti-overfit) | PRO+ |
deploy_paper | Deploy as a paper-trading strategy (refused in REAL mode, to avoid accidentally creating a live strategy) | All |
get_positions | List current positions | All |
panic_close | Emergency flatten-all (all tiers, closing is never gated) | All |
get_strategy_report | Strategy run report | All |
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_paperis 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/callruns the exact same domain implementation as the web app — the numbers an agent sees match the UI bit for bit