This is a C++ MCP server that bridges Claude directly to MetaTrader 5 trading operations. It exposes the full MQL5 API through a dual architecture: a C++ frontend using simdjson for speed (averaging 10ms response time) and an MQL5 backend running as an Expert Advisor. You get trade execution (market and pending orders), position management, historical deal queries, OHLC and tick data retrieval, chart object drawing, EA compilation and backtesting, and terminal logging. Unlike Python mt5 package wrappers, this gives you chart management and graphical annotations. Setup requires purchasing the McpServerByLeo library from TheBotPlace, running the included EA on your MT5 terminal, and connecting via stdio or HTTP. Reach for this when you need AI driven trade automation with full platform access beyond basic order placement.
Universal MCP Server for MetaTrader 5 Trading & Data Operations
FullMt5McpByLeo is a complete, production-ready MCP server that enables Claude and other AI assistants to control MetaTrader 5 directly. Execute trades, retrieve market data, manage charts, analyze trading history, and automate MT5 operations through natural language.
Execute and manage trading positions and orders:
Access real-time and historical data:
Create and modify chart visualizations:
Control chart windows and redraw operations:
Compile and execute Expert Advisors:
Note: Python version package mt5_mcp_by_leo is deprecated. now replace by C++ exe server. Note: Unlike other MCPs that use .ini files to launch backtests, this MCP doesn't need that because it controls the entire MT5 tester from the same EA, without .ini files, without wasted terminals. In addition, the code compilation is more complete since its AI can choose whether or not to optimize the code, instructions, etc.
FullMt5McpByLeo/
├── Src/ # MQL5 Backend Functions
│ ....
├── mt5_mcp_by_leo/ # Json tools definition
│ ....
Your MCP server won't work without an active license from TheBotPlace.
args array in your claude_desktop_config.json or the JSON that your AI platform uses (see Quick Start/step 4 below)
- EXE from releases (McpServer.exe)
- Check: dependencies.json
- EX5 of releases (Runner an Mt5Mcp).
cd "C:\Users\YOUR USER\AppData\Roaming\MetaQuotes\Terminal\YOUR ID\MQL5\Shared Projects"
tsndep install "https://forge.mql5.io/nique_372/FullMt5McpByLeo.git"
Download the latest .exe and .ex5 files from the repo releases. Place the .ex5 files in the MT5 terminal's Experts\ folder, and the .exe file in an easily accessible folder (for example, the MT5 terminal's Common\Files\ folder).
Download the tools.json file and place it in your terminal's Common\Files\ folder.
Open Common\Files And create a json file with this structure:
{
"general": {
"type_reg": "stdio_stdin",
"json_tools_fpath": "JSON_TOOL_PATH"
},
"mt5_conn": {
"host": "127.0.0.1",
"port": 9999
},
"http_lib": {
"name": "McpMt5Server",
"version": "1.0.0",
"host": "127.0.0.1",
"port": 8080,
"endpoint": "/"
},
"stdio_stdin": {
"name": "MT5 MCP Server",
"version": "1.0.0"
}
}
Full template in Templates/config.json
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mt5_mcp_by_leo": {
"command": "PATH_TO_EXE",
"args": ["PATH_TO_FILE", "YOUR_TBP_ID", "YOUR_MT5_ACCOUNT_LOGIN_ID"
]
}
}
}
Full template in Templates/claude_desktop_config.json
In MT5: Tools → Options → Allowed URLs for WebRequest
127.0.0.1 or host you configured.Open Claude Desktop. At that moment, a CMcpServer.exe is running in the background until it establishes a connection with the EA Mt5Mcp.ex5.
1. Run Runner.ex5 in any chart.. (dowland from releases)
2. Drag Mt5Mcp.ex5 onto your chart (any) and cofigure it, The parameters of the EA, such as port/host, must match the JSON of Claude Desktop
Open a 0.01 lot BUY on EURUSD with SL at 1.0800 and TP at 1.0900
Note:
You can also use HTTP Remote (McpServer.exe support HTTP with libs httplib + mcp-remote npm package) (see: https://forge.mql5.io/nique_372/McpServer/wiki/Running-HTTP)
By downloading or using this repository, you accept the license terms.
Copyright © 2026 Niquel Mendoza (nique_372).
TSN Trading Systems ecosystem.