Skip to main content
← Back to blog

Connect Claude, Codex, Cursor or DeepSeek over MCP to a Local Backtesting Engine

📅 Published
Updated
✍️ Strategy Arena
MCP Model Context Protocol local backtesting Claude Code Claude Desktop Codex Cursor DeepSeek Pine Script research

To connect Claude, Codex, Cursor or DeepSeek to a local backtesting engine, start Strategy Arena Lab (free, Windows and Linux), click "Connect my AI", paste the generated MCP configuration into your client and ask "call start_here". The Lab listens only on 127.0.0.1, requires a session token and exposes no tool that places an order.

There is also a second, public server: https://strategyarena.io/mcp, to read the arena catalogue and backtest an ArenaScript on the server without installing anything. Both are described below with the exact configurations, followed by what happened when DeepSeek drove the Lab for four research sessions.

Updated 17 October 2026. Research on past data, not investment advice.

Two MCP servers, two jobs

Lab (local) Public server
Address http://127.0.0.1:PORT/mcp or stdio https://strategyarena.io/mcp
Where it computes on your PC, CPU or CUDA GPU on the Strategy Arena server
Authentication 64-hex-character session token none (rate-limited per client)
Data local data vault, long history server candles resampled, window of about 35 days
Verdict sealed-period proof: survives, no evidence of an edge, or inconclusive in-sample backtest and Monte Carlo, never a verdict
Pine export exact export of the judged strategy export_to_tradingview (EXACT or PARTIAL)
What Strategy Arena receives nothing the submitted script, which the server may keep
Orders, payments no tool no tool

MCP (Model Context Protocol) lets an AI use software through "tools" called over JSON-RPC. The Lab is the research and judging tool; the public server is for discovery.

Connecting the Lab: the exact configuration

Start the Lab first. The "Connect my AI" button on its home screen gives a ready-made configuration for your client, with the real path and port on your PC, and can write it into the client's file for you (the old file is backed up first). Port and token stay the same after a restart, until you regenerate them.

Two ways to connect:

  • stdio: your client starts a small Node.js script shipped with the Lab (Node.js 18 or newer). The script reads the token itself from the Lab's session file, so the copied configuration contains no secret.
  • HTTP: direct connection to the Lab, no Node.js; the token goes in the Authorization header.

The formats below are the ones the Lab generates, taken from the Lab MCP page. Replace PATH_FROM_THE_LAB, PORT and TOKEN with what "Connect my AI" shows.

Claude Code

stdio:

claude mcp add strategyarena-lab -- node "PATH_FROM_THE_LAB"

Or HTTP, without Node.js:

claude mcp add --transport http strategyarena-lab http://127.0.0.1:PORT/mcp --header "Authorization: Bearer TOKEN"

Claude Desktop, Cursor, LM Studio

Files: %APPDATA%\Claude\claude_desktop_config.json (Claude Desktop on Windows), ~/.cursor/mcp.json (Cursor), ~/.lmstudio/mcp.json (LM Studio). Any client that accepts a command (stdio):

{
  "mcpServers": {
    "strategyarena-lab": {
      "command": "node",
      "args": ["PATH_FROM_THE_LAB"]
    }
  }
}

Any client that accepts a URL (HTTP):

{
  "mcpServers": {
    "strategyarena-lab": {
      "url": "http://127.0.0.1:PORT/mcp",
      "headers": { "Authorization": "Bearer TOKEN" }
    }
  }
}

Codex (OpenAI)

File ~/.codex/config.toml (or .codex/config.toml in a trusted project). A sealed proof can take several minutes, hence the long tool timeout:

[mcp_servers.strategyarena_lab]
command = "node"
args = ["PATH_FROM_THE_LAB"]
startup_timeout_sec = 20.0
tool_timeout_sec = 630.0

opencode with DeepSeek (or another model)

File ~/.config/opencode/opencode.json, over HTTP. Pick a DeepSeek model in opencode (/models):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "strategyarena-lab": {
      "type": "remote",
      "url": "http://127.0.0.1:PORT/mcp",
      "headers": { "Authorization": "Bearer TOKEN" },
      "enabled": true
    }
  }
}

Or stdio: "type": "local" and "command": ["node", "PATH_FROM_THE_LAB"].

What about ChatGPT?

The Lab does not generate a configuration for the ChatGPT app; on the OpenAI side, the client it configures is Codex. A client that only accepts remote servers over HTTPS cannot reach a 127.0.0.1 address. It can use the public server described below.

Tool profile. By default the AI sees the essential profile: a short list of tools and compact answers, sized for small local models. For every tool, add "--profile", "full" after the script path in args, or set STRATEGY_ARENA_MCP_PROFILE=full. The Lab does not care which model is behind the client: the judge is the same for every AI.

Isolation: what the Lab's MCP bridge does

The Lab's MCP bridge is written in Rust. The checks below are read from its source code (agent_control_bridge.rs) and from the stdio client shipped with the Lab:

Check Behaviour
Listening 127.0.0.1 only; nothing is exposed to your network
Host header must be a loopback address (127.0.0.1, localhost, [::1]), otherwise 403 loopback_origin_required
Origin header absent or loopback; a web page from another site is refused (same 403)
Token Authorization: Bearer + 64-hex-character token, otherwise 401 invalid_session_token; can be regenerated at any time
Body JSON required, otherwise 415
Session file %LOCALAPPDATA%\io.strategyarena.gpuclient\agent-control-session.json on Windows, ~/.local/share/io.strategyarena.gpuclient/agent-control-session.json on Linux; the stdio client refuses a descriptor whose address is not local
Sent to Strategy Arena nothing: strategies, data and results stay on the machine
Actions outside the Lab no tool places an order, opens TradingView, publishes or starts a payment

The Windows installer is not signed yet: download it only from strategyarena.io and compare the SHA-256 published on the download page.

The path: from an idea to a judged Pine

Once connected, the AI calls start_here. The Lab answers with the path, the ArenaScript syntax and ready-to-send arguments:

  1. list_sandbox_datasets: pick a market in the local data vault;
  2. validate_sandbox_strategy: have the script checked; an invalid script gets a named error and a minimal example, at no cost;
  3. prove_sandbox_script: the proof. The judge chooses on training, opens the sealed period once, counts every declared trial and answers "survives", "no evidence of an edge" or "inconclusive";
  4. export_sandbox_pine: the Pine export of the judged strategy, with its window, fees, execution policy and the fingerprints of script and data. You paste the Pine into TradingView, paste back the List of Trades, and compare_tradingview_trades checks every trade.

Backtests and GPU sweeps are for exploring. They describe the past; only the proof judges. During an autoresearch session, any tool that would read the sealed bars of the same market is refused by name (autoresearch.test_period_sealed). Known limit: the seal stops the AI from reading the candles, not from remembering market history learned in training.

The public MCP server: strategyarena.io/mcp

Canonical transport: Streamable HTTP, JSON-RPC POST requests to https://strategyarena.io/mcp, no authentication. The old SSE transport stays at https://strategyarena.io/mcp/sse for older clients; it is declared deprecated. Discovery: https://strategyarena.io/.well-known/mcp.json.

Configuration, on the same pattern as above:

claude mcp add --transport http strategyarena https://strategyarena.io/mcp
{
  "mcpServers": {
    "strategyarena": { "url": "https://strategyarena.io/mcp" }
  }
}

On 17 October 2026, a tools/list request returns 45 tools. The seven most used for a first round:

Tool What it does
arena_leaderboard paper-arena ranking (BTC by default): PnL %, trades, win rate; 30 rows max
live_match last trade executed in the arena, leader and last place
market_regime detected regime for BTC, ETH, SOL or BNB (BULL, BEAR or RANGE), with confidence and observation window
predictions the arena's prediction bets, with their date and the P&L of the paper bet
backtest_strategy backtest of an ArenaScript by the Lab's Rust engine: 10 basis points per side, execution at the close, no slippage model; 60 per day per client
monte_carlo block bootstrap of net-of-fee trades (10 trades minimum); 8 per day per client
export_to_tradingview Pine v5 export, EXACT or PARTIAL status with the lines not converted

The other tools cover the ArenaScript grammar (arenascript_reference, validate_arenascript, repair_arenascript), public proofs (get_public_proofs, get_overfit_autopsy) and the handoff to the Lab (get_lab_desktop_handoff). The server's instructions tell the AI to start with get_product_contract, then get_public_proofs.

Three limits to know: a server backtest is an in-sample result, not a sealed period; the server may keep the submitted script; it never gives access to Strategy Arena's internal code (its contract is ArenaScript in and out). More: MCP workflow for agents.

Field report: DeepSeek driving the Lab

From 10 to 12 October 2026, DeepSeek drove the Lab through opencode for four research sessions. This is not a ranking: it is a path, with its mistakes.

Session 1: a spectacular number, an "inconclusive" verdict

DeepSeek swept 2,000 variants of a moving-average crossover on BTC 4h (under a second on GPU), kept the best, then submitted it to the proof on a sealed period of 1,800 bars. On that period the rule made +35.8% while buy-and-hold made −8.8%.

The judge answered "inconclusive": a single setting submitted, so no PBO, SPA or CPCV could be computed. A cross-check then showed two method errors: the sweep's "holdout" column overlapped the test period, and the 2,000 trials had not been declared. Re-judged on ETH and SOL 4h with its 2,004 trials declared, the same family gave a deflated Sharpe of 0.7%: no evidence of an edge.

Session 2: preregister, and over-count

Hypothesis written before any computation (a multi-scale Donchian channel), settings frozen, no sweep, a single proof on markets this family had never opened (ADA and ATOM 4h). But DeepSeek declared the 2,004 trials of the previous session as prior trials: the deflated Sharpe fell from 98.6% to 3.3%. The trials to declare are the ones used to choose this rule, not the project history; for a rule written in advance, that is 0 (the judge itself adds the rules recently fixed in the Lab).

Session 3: four preregistered families, none with an absolute gain

Donchian channel, long-short EMA regime, a short-selling module, time-series momentum: each on a fresh pair of markets, over a falling test window. All four limited the drawdown against buy-and-hold (by +19.7 to +38.9 points), but none ended with an absolute gain. The judge requires an absolute gain on top of the gap: "no evidence of an edge" for each. One momentum rule could not be exported to Pine (the CHANGE indicator is outside the exportable subset): the Lab refused it with a named message.

Session 4: a documented failure

Mission: improve an existing long-term strategy, "V3", judged by walk-forward (4 folds of about 2 years) on daily BTC, 2018-2026, with a criterion frozen before any computation (a better Calmar ratio on every fold).

  • Variant A (brake when price falls 25% below its 180-day high): worse on all 4 folds.
  • Variant B (buy back on RSI(3) < 15): never strictly better.
  • Proof comparator (paired block bootstrap): p = 6.5% for V3 vs A, p = 88.9% for V3 vs B.
  • V3 re-run identically: the same numbers, bit for bit.

Neither variant improves V3, and the negative result is published as is. On the two most recent months, the Lab refused a formal proof (300 bars minimum, 54 were left) and gave only a descriptive reading, labelled as such.

Limits: these sessions ran on a working version of the Lab (245), on crypto data covering the same recent window, and a language model may have memorised market history before its cut-off date.

What these sessions show

  • An AI plugged into a judge learns the method. From session 1 to 4, DeepSeek went from an undeclared sweep to a versioned preregistration before computing.
  • Method errors leave a trace. Test-period overlap, undeclared trials, then over-declared trials: each one is visible in the reports.
  • The judge cannot be talked round. A +35.8% on a single setting stays "inconclusive".
  • On pure noise, the same framework holds: 0 "survives" verdicts in 350 autoresearch sessions (measurement).

Codex used the same connection to audit the Lab: 25 of 27 defects confirmed. To compare AIs with each other on an identical protocol: the sealed AI leaderboard.

Getting started

  1. Download the Lab (free, Windows and Linux).
  2. Open "Connect my AI" and copy your client's configuration (detailed formats).
  3. Restart the client and ask: "call start_here".

Before the Lab, on the Bitcoin chart, the Prisme workshop measures the levels and patterns you think you see.

FAQ

Is there an MCP server for backtesting crypto strategies locally?

Yes. Strategy Arena Lab, a free app for Windows and Linux, contains a local MCP server: it listens only on 127.0.0.1, requires a session token and computes everything on your PC, on CPU or CUDA GPU. Claude Code, Claude Desktop, Codex, Cursor, LM Studio and opencode (with DeepSeek or another model) connect over stdio or HTTP.

Can I connect ChatGPT to the Lab?

On the OpenAI side, the client the Lab knows how to configure is Codex. A client that only accepts remote MCP servers over HTTPS cannot reach 127.0.0.1; it can use the public MCP server https://strategyarena.io/mcp instead, which reads the catalogue and backtests ArenaScript on the server.

Can the connected AI place orders?

No. No Lab tool places an order, opens TradingView, publishes anything or starts a payment. The public server never starts a payment either.

Are my strategies sent to Strategy Arena?

Not with the Lab: the local MCP connection sends nothing to Strategy Arena; strategies, data and results stay on the machine. The public server receives the ArenaScript you submit and may keep it: do not send it a private strategy.

What is the difference between a backtest and the proof in the Lab?

A backtest or GPU sweep describes the past on the data seen. The proof (prove_sandbox_script) chooses on training, opens a sealed period once, counts the declared trials and answers survives, no evidence of an edge, or inconclusive.

Do I need Node.js?

Only for the stdio connection: the client starts a small Node.js script (version 18 or newer) shipped with the Lab, which reads the token itself. The HTTP connection does not need it; the token then goes in the Authorization header.

Sources

  • Strategy Arena, Lab MCP page: configuration formats, essential or full profile, start_here path, security; read on 17 October 2026.
  • Lab source code: MCP bridge agent_control_bridge.rs (Host, Origin, token and JSON checks) and stdio client strategyarena-agent-mcp-stdio.mjs.
  • Public server: tools/list response from https://strategyarena.io/mcp (45 tools) and /.well-known/mcp.json, read on 17 October 2026; descriptions and quotas read from the server code.
  • DeepSeek sessions of 10-12 October 2026: Lab 245 research reports, summarised in the previous version of this article.

Research on past data, not investment advice. The figures quoted are research measurements, with the limits stated.

⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.

Enjoyed this article? Share it

𝕏 Share on X ✈️ Telegram

Turn a local result into durable proof

The Lab runs free on your PC. Certificates and audit dossiers use credits: 1 credit = 1 certificate or 1 dossier, 2 offered when you open an account; paying never changes the verdict.

Get the Lab (free)Audit a TradingView export Pricing and credits Publish a Lab Report Lab Reports Hall
TradingView Starter
Choose the account path. Prove the strategy separately.
Your first chart and price alert do not require the Lab. Strategy Arena proof remains required before trusting or exporting a strategy.
Partner attribution is for first-time users and web purchases only. Strategy Arena may earn a commission on eligible purchases; starting with a free account needs no payment.
I have never had an account · Start free I already have an account Check a strategy
More TradingView paths
Evidence-gated Pine review