# Connect XTester to an AI agent (MCP)

## 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.

## Connecting — the built-in XTester screen

XTester knows the real install path and the current workspace rules, so you connect through the GUI rather than by hand-editing configs:

1. Download XTester only from the [official GitHub Release](https://github.com/79231232393/XTester-releases/releases/latest).
2. Install or unpack the program.
3. Launch XTester.
4. Open **Settings → External agents**, or run the **"Connect external agent (MCP)…"** command.
5. Pick your MCP client — XTester Studio has already prepared its configuration (Claude Code, Codex, a generic `mcp.json`) with the paths of your installation.
6. Add it to your client.
7. Restart the agent session; when connecting to an open XTester Studio window, approve the access in that window.
8. Verify the connection with a safe read-only call.

These configurations always match the installed version and the real component locations. That is why concrete install paths and launch arguments are not reproduced on the website — the application itself shows their current values.

## How it works, conceptually

XTester runs a **local MCP server over the stdio transport**: the AI client talks to it directly on your computer, and no separate MCP network port is opened. See [Security](https://xtester.pw/mcp/security) for more on transport and data.

## Clients

Source-checked website generator formats: Claude Code — project `.mcp.json`; Cursor — `.cursor/mcp.json` (JSON); Codex — user `~/.codex/config.toml`, section `[mcp_servers.xtester-studio]`; Claude Desktop — `claude_desktop_config.json`, macOS/Windows only, not Linux. Use the actual absolute command from installed XTester Studio, args `["--studio"]`. Choose the client actually in use, preserve its existing configuration and approve the diff. Source-valid format does not certify an installed client or a working MCP connection. Other clients need separate verification. [Full workflow and checked-release limitations](https://xtester.pw/mcp/agent-onboarding.md).

## What not to do

- do not disable antivirus or SmartScreen;
- do not run as administrator without a proven need;
- do not use debug paths like `bin\Debug\...`;
- an agent must not silently download and run the application — the user confirms install and launch.
