Kairotick Get Lite free

Connect Claude to MetaTrader 5 (MT5 MCP server)

By the . Updated .

MetaTrader 5 has its own MCP server built in. Once it is on, an AI app such as Claude Code or Codex can read your account, charts and prices, run the Strategy Tester and, if you allow it, place trades. We set it up and tested it on November 18, 2026. Here is the setup, what it can do, what went wrong, and how to keep it safe on a prop account.

The short answer

In MetaTrader 5, open Tools > Options > MCP, turn on Enable internal server, create an API key, click OK, then click Copy. Paste what it copies into a file named .mcp.json in your Claude Code project folder and restart Claude Code. Keep MetaTrader 5 open while you use it.

Set it up in Claude Code

  1. Open MetaTrader 5, click Tools > Options and open the MCP tab. If there is no MCP tab, update MetaTrader 5 first; every build we tested (6241 to 6320) had it.
  2. Tick Enable internal server. Keep the address http://127.0.0.1:22346/mcp unless another app already uses that port.
  3. Create the API Key, click OK, open the tab again and click Copy. MetaTrader puts ready settings for Claude Code and Codex on your clipboard.
  4. Paste the Claude Code part into .mcp.json in your project folder, or into ~/.claude.json to use it in every project. Restart Claude Code.

To check it, ask the test question from MetaQuotes' guide: Using MetaTrader MCP servers, provide a table of all the tools you can access.

If you only want your terminal, this is all .mcp.json needs. Put your own key in place of YOUR_KEY:

{
 "mcpServers": {
  "mt5-terminal": {
   "type": "http",
   "url": "http://127.0.0.1:22346/mcp",
   "headers": {
    "Authorization": "Bearer YOUR_KEY"
   }
  }
 }
}

Or add it with one command:

claude mcp add --transport http mt5-terminal http://127.0.0.1:22346/mcp --header "Authorization: Bearer YOUR_KEY"

The copied settings hold three servers: terminal (your MetaTrader 5, port 22346), metaeditor (MetaEditor, port 22345) and marketdata (MetaTrader.com market data and news). This page is about the terminal server. For Codex, put the Codex part into .codex/config.toml in your project folder.

Why Claude Code and not a web chat

The server listens on 127.0.0.1, which means your own computer. An AI app has to run on that same computer to reach it. MetaQuotes' guide covers Claude Code and Codex, and says any MCP app that takes the same JSON settings works too.

What the 107 tools do

GroupWhat they do
Trading10 toolsSend market and pending orders, check an order before sending it, change stop loss and take profit, close positions, delete orders, work out margin and profit.
Account
and history
4 tools
Balance, equity and margin; open positions and orders; past orders, deals and positions.
Prices
and Market Watch
8 tools
Candles and ticks for any period, the Market Watch list, and depth of market.
Charts
and indicators
28 tools
Open and close charts, change symbol and timeframe, add Expert Advisors, scripts and indicators and read indicator values, draw objects, save templates, profiles and screenshots.
Expert Advisors
and services
10 tools
List your MQL5 programs and read their inputs; start, stop and register services.
Strategy Tester11 toolsWrite the tester settings and inputs, run a backtest or an optimization, wait for it and read the report.
Economic calendar
and news
9 tools
Calendar events and their values by country or currency, and news headlines.
Alerts5 toolsCreate, change, switch on or off and delete alerts.
Files
and web
16 tools
Find, read, write, edit and delete files, and send a web request.
Terminal
and journals
6 tools
Terminal and time information, and the terminal, Experts and tester journals.

Counted from the server's own list on November 18, 2026. MetaQuotes says the list keeps growing, and that the tools an app sees depend on your trading, web and shell settings.

A backtest run only through MCP

We ran the MACD Sample Expert Advisor that ships with MetaTrader 5 through MCP alone: tester_prepare_config, then tester_run_backtest, then tester_get_report. EURUSD H1, January 1 to July 1, 2026, the 1 minute OHLC model, MetaQuotes-Demo prices. It took 7.5 seconds and the report came back as data: 36 trades, profit factor 1.14, net +$83.07, drawdown 2.18%. That is a sample EA, not a strategy we recommend.

Is it the same as the normal Strategy Tester? We ran one of our own Expert Advisors both ways on USDJPY M1, October 23 to November 18, 2026. All 581 lines its log wrote were identical, the profit matched to the cent, and both runs had 147 trades. The MCP run took 113 seconds against 57, because it downloaded the price history first.

Traps we hit

Keep it safe on a prop or live account

Add Kairotick for news times and prop rules

Kairotick's own MCP server is free and needs no key. With both in one Claude Code project, one question can use your account and our data:

{
 "mcpServers": {
  "mt5-terminal": {
   "type": "http",
   "url": "http://127.0.0.1:22346/mcp",
   "headers": {
    "Authorization": "Bearer YOUR_KEY"
   }
  },
  "kairotick": {
   "type": "http",
   "url": "https://kairotick.com/mcp"
  }
 }
}

Setup for Kairotick alone, in ChatGPT, Claude and Gemini: Use Kairotick in ChatGPT, Claude and Gemini.

Sources

Setup steps follow MetaQuotes' help pages Configuration and Capabilities, read November 23, 2026. The tool count, timings and traps come from our own test on November 18, 2026.

Questions

Does MetaTrader 5 have a built-in MCP server?

Yes. In MetaTrader 5, open Tools > Options > MCP and turn on Enable internal server. The terminal server listens on http://127.0.0.1:22346/mcp by default and needs the API key from the same tab.

Can Claude place trades on my MT5 account?

Yes, if trading is allowed. On our test terminal it was allowed by default. Under Tools > Options > AI Assistant > Trading you can make the assistant ask for confirmation first, or not trade at all.

Can I use it from ChatGPT or Claude on the web?

Not directly. The server listens only on your own computer (127.0.0.1), so the AI app has to run on the same computer. MetaQuotes documents Claude Code and Codex.

Can it run backtests?

Yes. The Strategy Tester tools write the settings, run the test and return the report. In our test a six-month EURUSD H1 backtest took 7.5 seconds.

Does MetaTrader 5 have to stay open?

Yes. The server runs inside the terminal, so MetaTrader 5 must be running while the AI app uses it.