# XTester MCP — Connect AI Agents to Strategy Backtesting

## AI agents: install and first run

[Start: install → verify → connect → first backtest](https://xtester.pw/mcp/agent-onboarding?lang=en) · [Full Markdown guide](https://xtester.pw/mcp/agent-onboarding.md). Preview guide: readable over HTTP without JavaScript; not cross-platform end-to-end certification. [Current version and SHA-256 manifest](https://xtester.pw/releases/current.json).

## First safe connection check

Open XTester Studio and the intended project. The external agent uses the local `XTester.McpHost --studio` process, not a website URL. Copy the entire Studio configuration: keep --engine-dir when present for the relay process. Built-in Copilot runs inside Studio; an external agent is a separate client that you grant access to a window.

Give your agent this request:

> Connect to XTester Studio. Run initialize and tools/list. If list_studio_sessions is available, show the open windows and projects. Do not change files, download history or start tests. If several windows exist, ask me which one to select. Ask for my approval before attaching. After connection, read the available tools' current schemas and report the permissions granted.

Expected result: a real window list with identifiers and projects, followed by an access request in the chosen window. This tests connectivity, not a backtest result. Never invent a session_id. Studio's initial bootstrap catalog can differ from its attached catalog.

## Recover a failed connection

- **Process missing / file not found:** copy the absolute path again from your installed Studio, not another user's example or a website URL.
- **SELECTION_REQUIRED:** call list_studio_sessions and choose the intended window; select_studio_session needs real session_id, window_tag and confirm according to the live schema.
- **APPROVAL_REQUIRED:** respond in the Studio window. Do not bypass approval or enable autonomous mode for the first test.
- **SESSION_GONE:** the window closed or changed; enumerate sessions again.
- **CONTROL_UNAVAILABLE:** save your work and restart Studio, then the client session.
- **OS/architecture error:** check the package and release requirements. Linux tar.gz requires the system ICU runtime.

## Version and permissions come before examples

Resolve the current application from the [manifest](/releases/current.json). The published [catalog](/mcp/tools.json) has its own version and profile; canonical Windows --mcp is not Studio --studio. After connection, tools/list and the running host's schemas are authoritative. This website cannot inspect your installation or grant access.

Start with minimal read access. Agree separately on edits, history downloads, computations, deletion and updates. Broker keys are not needed for the first connection check. Backtests do not guarantee future returns.

XTester provides a **local stdio MCP server** for building, compiling and historically testing trading strategies. The MCP host and XTester run on the user's computer and **do not expose a separate MCP network listener**. Data you send to an AI client may be processed by that client's LLM provider according to its configuration and privacy policy.

## What an agent can do through XTester

- inspect the strategy environment and API;
- create or edit strategy files inside an `.xtproj` project;
- compile a strategy;
- check history availability and integrity;
- download the required historical range;
- run a backtest;
- read trades, metrics, the equity curve and drawdown;
- compare versions and runs;
- use the Research Lab and walk-forward where the current version supports it;
- port a strategy from another platform: accept the source, build the port inside a project and check it honestly.

## How it works

```text
AI client → local stdio → the local XTester MCP host → XTester engine / data / project
```

## Converting a third-party strategy

A compatible external AI agent (for example Claude Code, Codex CLI or another stdio MCP client with the necessary permission and confirmation support) can move work from another platform into XTester over MCP — from accepting the source to compiling, checking and finalising it inside a project.

The agent is the "brain" of the conversion: it reads the source, builds a behaviour model, proposes decisions for incompatibilities and hands over the port files. XTester provides a controlled process contract: local import, a project sandbox, compilation, recorded decisions, a semantic audit and a final report. Only source is accepted — compiled `.ex4`, `.ex5` and `.dll` are not accepted and not decompiled.

The result is not declared identical to the original. When a reference report exists (for example a CSV or a TradingView List of trades), a diff-test runs with a permitted per-bar tolerance, and the port gets an honest status: confirmed · conditionally confirmed · needs work · not confirmed. Without a reference report the status is "not confirmed". More on source, rights and verification on the [Security](https://xtester.pw/mcp/security) page.

The choice of AI model and how it connects belong to your AI client's configuration: it may use a cloud model or a local OpenAI-compatible endpoint, including setups based on LM Studio or Ollama. XTester provides only the local stdio MCP interface and does not certify specific clients, models or providers.

## Supported clients

The built-in connection screen documents configurations for Claude Code, Claude Desktop, Codex CLI, Cursor, Windsurf and VS Code. Other stdio MCP clients may work but require checking their config format and approval behaviour. A template is not proof of compatibility; no separate client certification was performed.

## Why local

- the host runs on the user's machine;
- no separate MCP network port is opened;
- "local stdio" describes only the client-to-host transport and **does not guarantee** an entirely local AI workflow;
- the MCP client or a cloud model provider may receive tool schemas, arguments, results, strategy excerpts, paths and logs according to its configuration;
- separate network actions are possible for downloading market data, reaching GitHub, LLM providers, updates and other explicitly documented functions.

## Limitations

- Windows x64, macOS (Apple Silicon and Intel), Linux x64 — exact requirements on the download page;
- a long history download can take significant time and includes network-read and local-write side effects;
- results depend on data, execution assumptions, fees, slippage and settings;
- **a backtest does not prove future profitability**;
- mutating tools may change `.xtproj`, Git/GitHub or install an update and require the corresponding approvals;
- live trading through a public MCP surface is not claimed.

## Get started

1. [Download XTester](https://github.com/79231232393/XTester-releases/releases/latest) from the official GitHub Releases.
2. Open Settings → External agents in XTester Studio, or the "Connect external agent (MCP)…" command.
3. Copy the configuration for your client.
4. Restart the agent session.
5. Ask the agent to call a safe read-only tool to verify the connection.

_XTester is an environment for building and testing strategies, not investment advice. Backtest results do not guarantee future returns._
