Claude & ChatGPT Trading Connector (MCP) Setup
The OptAlgo connector lets a chat app work with your OptAlgo account: Claude (web, desktop and mobile), ChatGPT and Claude Code. You add one URL to the chat app, approve it once in the OptAlgo app, and the chat can then write strategies, backtest them on OptAlgo's engine and run bots on paper in your My Bots.
| Connector URL | https://mcp.optalgo.com/mcp |
| Works with | Claude.ai (web, desktop, mobile), ChatGPT, Claude Code, and other apps that support remote MCP connectors |
| Plans | Every plan, Free included |
| Can do | Read markets and your account, backtest, paper bots, run your strategies on OptAlgo on paper, file tickets. Or, if you choose Research only when you approve it, reads and backtests without bots |
| Can never do | Trade real money (on any plan) |
Product overview: MCP trading with OptAlgo.
What it is
The connector is a remote MCP server (Model Context Protocol, the standard chat apps use to plug in tools). When you add it, the chat app sends you to OptAlgo to sign in and approve it; OptAlgo then gives the chat app a short-lived token. You never create, copy or paste an API key.
- No key in the chat. The chat app holds a token that expires after 1 hour and is renewed automatically; each renewal replaces the previous token. Nothing you type in the chat contains a secret.
- Fixed, safe permissions. You pick one of two access levels when you approve it: Full access (read, backtest, and bots on paper; the default) or Research only (read and backtest, no bots). Nothing else can be added, and a connector can never trade real money, even on Plus or Pro.
- Same account, same rules. Backtests count against your plan's quota, the same rate limits and code rules apply as for API keys, and every call appears in the app's logs.
- Off in one click. Disconnect it in the app at any time; it stops working at once.
Using a coding agent (Claude Code, Codex) on your own computer and want live trading through it? That is an API key with the device login, which you set up in the app. The connector stays paper only.
Add the connector
Chat apps change their menus often: the paths below are where the option was at the time of writing. Look for Connectors, Apps or MCP in the app's settings if they have moved.
Claude.ai, Claude desktop and mobile
- In Claude: Settings → Connectors → Add custom connector.
- Name it
OptAlgoand paste the URLhttps://mcp.optalgo.com/mcp. Leave the OAuth fields empty: Claude registers itself. - Click Add, then Connect. Claude opens the OptAlgo app to sign in and approve (see below).
On a Team or Enterprise plan, an Owner may need to add the connector for the organisation first; then you only click Connect.
In a chat, turn the connector on under the chat's tools menu if Claude does not use it by itself.
On your phone
Add the connector once from claude.ai in a browser (on your phone or a computer), with the steps above. It then works in the Claude mobile app too. If a sign-in step opens a browser, finish it there and switch back to the app.
ChatGPT
- In ChatGPT: Settings → Apps & Connectors. If creating a connector is not offered, turn on developer mode there first (availability depends on your ChatGPT plan).
- Create a connector: name
OptAlgo, URLhttps://mcp.optalgo.com/mcp, authentication OAuth. - Save it and sign in when ChatGPT asks. It opens the OptAlgo app to approve (see below).
Claude Code
claude mcp add --transport http optalgo https://mcp.optalgo.com/mcp
Then type /mcp in Claude Code, pick optalgo and sign in. Your browser opens the OptAlgo app to approve.
Claude Code can also use an API key with the device login in the LLM reference, which allows live trading when you choose. The connector is the simpler choice when backtests and paper bots are all you need.
Approve it in OptAlgo
The chat app sends you to app.optalgo.com/connect-chat. Log in if asked. The page shows:
- the chat's name, as the chat app registered it (for example "Claude");
- where it sends you back after you approve (for example
claude.aiorchatgpt.com). If this is not the chat app you just used, click Deny; - a warning when the sign-in started on another network than the browser you are approving in (someone may have sent you the link). Approve only if you just clicked Connect in your own chat app;
- the permissions: Read (markets, your account, bots, trades and backtests), Backtests (run strategy code the chat writes on OptAlgo's engine) and, with full access, Bots, on paper only (create paper bots, open and close paper positions). No live trading: this cannot be ticked, on any plan;
- the access to give this chat: Full access or Research only (below).
Click Approve. You are sent back to the chat, which is now connected. You approve once per chat app; the chat renews its own token from then on.
Choose the access
| Choice | The chat may | It cannot |
|---|---|---|
| Full access (the default) | Read, backtest, and create and trade paper bots and hosted strategies | Trade real money |
| Research only (backtests, no bots) | Read your account, bots, trades and hosted strategies; validate, run, annotate and rerun backtests, studies, robustness checks, compare a hosted strategy with its backtest, file tickets | Create, trade, change or delete bots or hosted strategies |
Pick Research only when you want the chat to work on strategies without touching My Bots. A research connection does not even see the bot tools (create_paper_bot, paper_signal, manage_paper_bot, deploy_strategy, manage_strategy); if a chat calls one anyway, it is told research_only.
The choice is fixed for the life of the connection: renewing the token never widens or narrows it. To change it, disconnect OptAlgo in the chat app and connect it again, choosing the other access on the OptAlgo page. That makes a new connection; remove the old one under AI agents → Connected chats (a research connection is marked Research only there).
A chat can check its own access: the account tool shows connector.scopes (GET /v1/me: api_key.scopes): read, backtest and bots for full access, read and backtest for research only. For developers: the consent page reads GET /oauth/requests/{id} (access_options ["full", "research"], default_access "full"; access and granted_scopes once decided) and approves with POST /oauth/requests/{id}/approve {consent_token, access: "full" | "research"} (default full; anything else is 400 invalid_access), which answers the access and scopes granted.
Your first prompt
Paste this into a new chat:
Using the OptAlgo connector: list the markets, then write a simple EMA-crossover strategy
for BTCUSDT.P on 1h, validate it, backtest 2024-01-01..2025-01-01, read the grade and
improve it once.
The chat lists the markets, writes the strategy, validates it for free, runs the backtest, reads the honesty grade before any return figure, changes one thing and runs it again. Every run appears on your Backtest page at app.optalgo.com/backtest.
To see paper trading, follow up with:
Create a paper bot for BTCUSDT.P, open a small long, show me the trade, then close it.
Watch it at app.optalgo.com/my-bots.
The tools the chat gets
Every tool is paper only: none can trade real money, create a live bot or switch anything to live, on any plan. A research-only connection gets every tool below except the five that create or change bots and hosted strategies (create_paper_bot, paper_signal, manage_paper_bot, deploy_strategy, manage_strategy). The one read that also works on a live hosted strategy is compare_with_backtest (it places no order). Only runs use backtest units: run_backtest, run_backtests, research, rerun_backtest, robustness (when confirmed), a study's final test and compare_with_backtest.
Answers are brief by default so they cost your chat few tokens: the decision first (the grade, the verdict), short names, rounded numbers. The chat asks for detail: "normal" or "full" only when it needs more.
| Tool | What it does |
|---|---|
| Start, guide and account | |
context | The first call of every session: what needs attention now, the quota left, your hosted strategies, open paper positions, your studies, recent notes and favourites, open tickets |
capabilities(section, example) | What OptAlgo and your plan allow (all), how to write a strategy (sdk), the quota, strikes and hosted slots (limits). example (ema_cross, pairs, carry, portfolio) gives a strategy and a spec that validate as they are |
guide(topic) | The agent guide, one part at a time (index, connect, sdk, portfolios, backtests, charts, diagnostics, research, hosted, errors, tickets, reference): the same files as docs.optalgo.com/llm/index.md, also readable as resources optalgo://guide/<topic> |
account(section) | Read-only: your plan (me), PnL by mode, balances, positions, the equity curve, your exchange connections (never their keys), your tickets and the team's replies (tickets) |
| Markets | |
markets | The exchanges, symbols and timeframes you can backtest and where each history starts; coverage = the exact data per symbol and the window they all cover |
price(symbols) | The live price of up to 20 symbols, from OptAlgo (the price paper orders fill at) |
| Backtests | |
validate_strategy(source, spec) | Checks the code and the run spec and reports every problem at once, with the estimated cost. Free |
run_backtest(source, spec) | Runs the backtest and waits for it (wait_s: 20 s by default, at most 25): a quick run answers its result in the same call. Uses units |
run_backtests(source, specs) | Up to 3 runs of one strategy at once (other parameters, windows or symbols), a row per run. Uses units |
research(source, spec, space) | One walk-forward run instead of many single runs: tunes the parameters in space on training folds and judges them on test folds it never saw; holdout_months keeps the end for one final run (how it is built). Uses units |
backtest_result(id) | Honesty grade first, then the search verdict, the main metrics (net of fees), the top diagnosis and the findings. Also how the chat waits for a run still going (wait_s) |
compare_backtests(ids) | Up to 6 runs side by side, best first: grade, search verdict, return, drawdown, Sharpe, trades, fees, top diagnosis |
backtest_diagnostics(id) | Why a run wins or loses: every rule that fired with its evidence and a suggestion; detail: "normal" adds results by symbol, side, year and exit reason, costs, drawdowns, buy-and-hold and stability |
backtest_chart(id) | Shows the run as a picture (drawn by OptAlgo) with five numbers; detail: "normal" adds the data for an interactive chart. Views: equity, trades, monthly, pnl_hist, exposure |
candles(id) | The bars of a run in a window, with its plots, fills and trades: "why did it enter here?" (image: true adds a picture) |
download_data(id) | For Claude Code and Codex: 10-minute links to the full-resolution CSV files and a pandas + matplotlib snippet |
backtests | Your earlier backtests, the best first (sort) and filtered; with id + file, its code (strategy.py), trades.csv or result.json |
annotate_backtest | A note, tags (study:<name> puts it in a study) and the favourite star; a favourite's files are never pruned |
rerun_backtest | Runs a backtest whose files were pruned again, as a new backtest |
studies(tag) | A study = the runs of one idea (tag study:<name>): the verdict over every variant tried, the best run, the spread. holdout_months declares its holdout before tuning; final_test scores the chosen run on it, once; pin fixes the study's costs and account (fees, slippage, equity, leverage) for every run tagged with it; after the study's first run they can only get stricter (higher fees or slippage), so to change them start a new study |
robustness(backtest_id) | Before deploying: trade bootstrap, doubled costs, parameter jitter and later starts give one verdict, robust, fragile or broken. A free estimate first |
| Paper bots | |
bots | Your My Bots bots; with bot_id, one bot's settings, stats, equity, tickers or logs; with transaction_id, what happened to one signal |
create_paper_bot | A new bot on paper (market: spot for a spot multi-symbol bot; default from the symbol, futures without one) |
paper_signal | Opens (LONG / SHORT), closes (CLOSE, or part with close_ratio) or moves the stop on a paper bot. No price needed: OptAlgo prices the entry and turns a stop or target in percent into prices. Leverage defaults to 1 on futures |
manage_paper_bot | Renames a paper bot, changes its budget or slots, starts, stops, deletes or converts it, sets a ticker's weight. Never switches it to live |
trades | Your trades, open and closed |
| Strategies on OptAlgo (hosted, paper only) | |
deploy_strategy | Runs a backtested strategy (grade A to C) on OptAlgo, on paper. dry_run first: the whole check, nothing created |
strategies | Your hosted strategies; with id, its status and live eligibility (view: "status"), every decision (decisions), its bot's log (logs) or its code (code) |
manage_strategy | Pauses, resumes, renames, changes the budget, sets on_leg_failure or deletes a paper hosted strategy |
compare_with_backtest | Its real trades (paper, or live for a live hosted strategy) matched against a backtest of the same code. Uses units; a dry run gives the cost |
| Support | |
report_issue | Files a ticket with the OptAlgo team on its own, without asking you: when something on OptAlgo's side goes wrong, when you want something OptAlgo cannot do yet, when the docs and the tools disagree, when a result looks wrong, or when an answer confused you. It tells you the ticket id in one line; never with your strategy code or keys |
The chat also gets three ready prompts: new strategy (an idea to a validated, backtested strategy), diagnose a backtest (why it wins or loses and the one change to try) and walk-forward (a backtest's parameters checked out of sample). Chat apps that support MCP prompts list them with the connector's tools.
Research in one call
research turns the parameters you would otherwise sweep with single runs into one walk-forward run: it validates for free, then runs.
research(source, spec={... "window": {"start": "2021-01-01", "end": "2026-01-01"}},
space={"fast": {"low": 5, "high": 50, "step": 5}, "slow": [100, 150, 200]},
holdout_months=6)
space: per parameter a range{"low", "high"}(withstep) or a list of values; a single value fixes it.- The folds are rolling: training about a third of the window (60 to 730 days), testing about an eighth (14 to 180 days);
n_trials(default 30) configurations are tried, every one when the space is small enough to try all. holdout_monthskeeps the last months out of the research: the answer names that window, to run the chosen parameters on once withrun_backtest. For a holdout OptAlgo enforces, declare it on the study instead (studies(tag, holdout_months), before tuning).- It answers the research verdict (
robust,inconclusiveorlikely_overfit) with its out-of-sample folds.
Examples to start from
capabilities(example=...) returns a strategy and a run spec that validate as they are: ema_cross (one symbol), pairs (two legs), carry (spot + perpetual with funding), portfolio (target weights across legs). The chat starts from the closest one instead of writing from scratch.
A hosted strategy runs everything its backtest ran: one symbol per decision, or several legs on one account (pairs, 2 to 4 legs, deployed on exactly the backtest's legs and sized on the whole allocation), funding / open-interest series and references on any timeframe (what a hosted strategy runs). On a multi-leg strategy, deploy_strategy's on_leg_failure decides what happens when one leg's entry fails: unwind (the default) closes the other legs, keep lets each leg stand on its own. Going live is always your decision, in the app. Tickets: 20 a day per user, a repeat of the same problem counting once; a person is at [email protected].
Paper trading on Free allows 200 paper trades a month, as in the app.
Prices come from OptAlgo. The chat reads prices with price and markets with markets, from OptAlgo's own market data (the exchange's ticker only as a fallback), so it never goes to the web for a price and you get no extra permission prompts. It asks you only for what you want (symbol, direction, size); everything else has a sensible default.
What changed in v2
Version 2 of the connector (October 2026) uses far fewer tokens: about half the tool list your chat loads on every turn, and about a tenth of the tokens for one backtest (validate, run, result, chart, diagnosis). If a tool seems missing, remove the connector and add it again so your chat loads the new list. The old tool names no longer run: a chat that still calls one gets unknown_tool with the same advice (start a new chat, or reconnect).
| Before | Now |
|---|---|
backtest_status (poll) | run_backtest waits for the run; backtest_result(id, wait_s) for a longer one |
strategy_sdk, limits | capabilities(section="sdk"), capabilities(section="limits") |
data_coverage(symbols) | markets(coverage=[...]) |
list_bots, bot_info | bots, bots(bot_id, view), bots(transaction_id) |
close_paper | paper_signal(side="CLOSE", close_ratio) |
list_strategies, strategy_status, strategy_decisions | strategies, strategies(id), strategies(id, view="decisions") |
pause_strategy, resume_strategy | manage_strategy(action="pause" / "resume") |
download_code | backtests(id, file="strategy.py"), strategies(id, view="code") |
tickets | account(section="tickets") |
New: context, run_backtests, research, compare_backtests, studies, robustness, capabilities(example), the guide as resources, three prompts |
The loop
A good chat works in this order, and you can ask it to:
context: what needs attention first.capabilities(section: "sdk", or anexampleto start from) andmarkets: what to write, and symbols and a window with data.validate_strategy: free, and it lists every problem at once. Fix them all and validate again until it is clean.run_backtest: it waits for the run and answers the result.- The result: the honesty grade first (
Abest toD), then the search verdict (how many variants were tried on this data, and whether the result is likely luck). ADresult is not realistic, so do not quote its numbers. Judge it net of fees. - See it:
backtest_chartshows the equity curve as an image right in the chat;backtest_diagnosticssays why it wins or loses. - Improve without fooling yourself: tag the runs of one idea
study:<name>, declare the study's holdout before tuning (studies(tag, holdout_months)), tune with oneresearchrun instead of many single runs, compare withcompare_backtests, then score the chosen run on the holdout once (studies(tag, final_test)) and check it withrobustness. - Paper: a paper bot (
create_paper_bot,paper_signal), or run the strategy on OptAlgo withdeploy_strategy(dry_runfirst); watch it withstrategiesand compare it with its backtest (compare_with_backtest).
A single backtest is in-sample: a good-looking number from one run is a starting point, not proof. The grades, the findings and the strategy SDK are explained in section 2 of the LLM reference.
Limits and quota
The connector uses your plan, exactly like an API key:
| Free | Plus | Pro | |
|---|---|---|---|
| Backtest units (1 unit = up to 10 s of run time) | 50 per month | 30 per day | 200 per day |
| Paper bots | Yes | Yes | Yes |
| Live trading through the connector | No | No | No |
- Validating, reading results and the other tools cost nothing; only runs use units. The per-run limits (symbols, history, trials, time, memory) and every other plan feature are in Plans and limits.
- When the quota is used up, the chat is told when it resets and must stop submitting.
- The same rate limits as API keys apply, and every call shows in the app's logs.
Safety
- Paper only, always. A connector cannot open live positions, create live bots or switch a bot to live, on any plan. Live trading stays in the app, or goes through an API key that you create and limit yourself.
- Never paste an API key into a chat. The connector does not need one. If you pasted a key (
oa_live_…) into any chat, consider it exposed: revoke it under AI agents in the app. - Disconnect at any time: app.optalgo.com/ai-agents → Connected chats → Disconnect. It takes effect at once; the chat's token stops working on its next call.
- Code rules. Strategies may only use
numpy,mathandoptalgo_engine.sdk. Code that tries anything forbidden (files, the network, processes,os,subprocess,open,eval, dunder escapes and similar) is refused and counts as a strike on your account. After 3 strikes your account's API access is suspended, API keys and connectors alike, until [email protected] restores it. Honest mistakes (a loop over bars, a wrong signature, lookahead, a syntax error) never count. See Forbidden code: strikes.
Troubleshooting
The approval page says a plan is required. Your account's plan or subscription does not currently allow API access. Check Subscription in the app; Free can connect, so this usually means the account itself needs attention. Contact [email protected] if it persists.
The approval page says API access is suspended. The account reached the strike limit for forbidden code (account_suspended). Only [email protected] can restore it.
The chat reports connector_paper_only. It tried something with real money. That is not available through a connector: do it in the app (details).
The chat reports research_only or connector_research_only. You connected it for research only, and it tried to create or trade a bot. If you want that, disconnect OptAlgo in the chat app, connect again and choose Full access (details).
The chat reports invalid_token, or says it was signed out. The connection expired or was disconnected. Reconnect: in Claude, open the connector and click Connect; in ChatGPT, sign in to the connector again; in Claude Code, run /mcp and sign in.
The chat cannot reach OptAlgo, or calls time out. Usually a temporary network or provider problem; there is nothing to change on your side. Try again in a minute.
The chat does not use the connector. Make sure it is turned on for this chat, and name it in your prompt ("Using the OptAlgo connector, …").
Errors a connector user may see
The chat receives these codes when OptAlgo refuses a call. The full list of backtest and market errors, with their fixes, is in Errors and what to do.
connector_paper_only (403)
The call would touch real money: a live signal or close, a live bot, switching a bot to live, or raising a live bot's allocation. Connectors are paper only on every plan, so retrying or upgrading does not change this. Use paper bots in the chat; for live trading, use the app, or an API key you create there.
connector_research_only (403)
This connection was approved as Research only (read + backtest), and the call needs bots: creating, signalling, closing, starting, stopping, converting, editing or deleting a bot or one of its tickers, or deploying, pausing, resuming, editing or deleting a hosted strategy. The body carries required_scope: "bots", connector: true and access: "research". Reads and backtests keep working. For bots, disconnect OptAlgo in the chat app, connect again and choose Full access (choose the access); retrying does not help.
research_only
The same refusal, from the connector itself: the chat called one of the five bot tools on a research-only connection (a chat that still holds a full connection's tool list). fix says how to reconnect with full access.
connector_not_allowed (403)
The chat asked for something the connector does not offer (an action outside its tools, such as creating API keys or changing your exchange connections). Do it in the app.
invalid_token (401)
The chat's token expired, was revoked, or the chat was disconnected. Reconnect the connector in the chat app (troubleshooting). Do not paste an API key instead.
account_suspended (403)
API access is suspended after repeated security violations (3 strikes): every API key and every connector of the account stops. Contact [email protected]. Reconnecting does not help.
Quota, per-run limit and code errors (monthly_quota, daily_quota, max_symbols, security_violation …) are the same as for API keys: see the LLM reference.
FAQ
Can it trade live?
No. A connector is paper only, on every plan, and this cannot be changed. Live trading is in the app (or through an API key you create and limit yourself).
Do I need to paste an API key?
No, and you never should. The connector signs in through OptAlgo; there is no key to copy.
Does it work on the Free plan?
Yes: backtests (50 units a month) and paper bots. See Plans and limits.
Where do I see what the chat did?
Backtests on the Backtest page, paper bots and trades in My Bots, and every call in the app's logs.
Can I give it backtests only?
Yes: choose Research only (backtests, no bots) when you approve it (choose the access). To change your mind later, disconnect and connect again with the other choice.
How do I stop it?
app.optalgo.com/ai-agents → Connected chats → Disconnect. It stops at once. You can also remove the connector in the chat app.
Will the chat look up prices on the web?
No. The connector gives it OptAlgo's live prices (price), and a paper signal does not need a price at all: OptAlgo prices the entry itself. If a chat still tries to fetch a price from a website, tell it to use the OptAlgo price tool.
Is the chat's code safe to run?
It runs in OptAlgo's sandbox and may only use numpy, math and the OptAlgo SDK. Forbidden code is refused before it runs.