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.
FullMt5McpByLeo/
├── Src/ # MQL5 Backend Functions
│ ....
├── mt5_mcp_by_leo/ # Json tools definition
│ ....
- Check: dependencies.json
- EX5 of releases (Runner an McPServer).
- EXE from releases
- EX5 Library McpServerByLeo pucharse in: TheBotPlace - McpServerByLeo When you purchase the library, you should already have an account on TheBotPlace. This account will have an ID, which you will put in the .json file of your MCP IA (YOUR_TBP_ID).
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....
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"
}
}
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"
]
}
}
}
In MT5: Tools → Options → Allowed URLs for WebRequest
127.0.0.1 or host you configured.Open Claude Desktop. At that moment, a Python script is running in the background until it establishes a connection with the EA McpServer.ex5.
Run Runner.ex5 in any chart.. (dowland from releases)
Then:
MetaEditor: Open Src/Mt5Mcp.mq5 → Compile (F5) Or Dowland Mt5Mcp.ex5 of releases (last version).
MT5: Drag Mt5Mcp.ex5 onto your chart 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 with the help of "mcp-remote" (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.