mt5-mcp-by-leo
About
Complete MCP server for MT5: Through the MCP protocol, it allows [Trades, Orders, History, Graphic Objects, Terminal Logs, Compilation, etc.]
Details
- Author
- tradesystemsnique
- Categories
- Developer Tools, Other, Finance
Jump to
Setup
Install mt5-mcp-by-leo in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/tradesystemsnique/FullMt5McpByLeo
Follow the installation instructions in the repository README, then restart your MCP client.
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.
- Fast execution; the MCP server is written in C++ using simdjson and MQL5 uses JsonParserByLeo (fast MQL5 JsonParser), ultra-optimized code for maximum speed. The average response time is around 10ms (from when Claude calls a function until its response; note that this may depend on the size of the request... on average it's 10ms).
- Unlike other MCPs for MT5, this MCP has two parts, one in MQL5 and the other in C++, giving access to the full MQL5 API and not limited to the mt5 package for Python, which lacks functions for handling charts, etc.
Execute and manage trading positions and orders:
- Open Positions:Execute market trades (buy/sell) with immediate or pending orders
- Position Management:Modify stops/profits, close positions (full or partial)
- Order Management:Create, modify, and cancel pending limit/stop orders
- Trading History:Query completed deals with profit/loss analysis
- OHLC Data:Retrieve candlestick data (open, high, low, close, volume, spread, etc..)
- Tick data:Retrieve Tick data (last, ask, bid, flags, etc..)
- Symbol Information:Get symbol properties (digits, spreads, swaps, volumes, etc.. full SYMBOL_INFO_)
- Market Watch:Manage symbol selection and availability
- Indicator Manager:Get parameters, Add indicadors (ALL, Custom, MA, ETC..), Remove, Get Buffers, etc..
- Draw Objects:Create trend lines, rectangles, text labels, arrows
- Object Properties:Modify colors, styles, prices, text, full ENUM_OBJECT_PROPERTY_
- Chart Annotations:Add visual markers and indicators to charts
Control chart windows and redraw operations:
- Chart Operations:Open, close, list active charts
- Chart Properties:Read chart dimensions, colors, price ranges
- Visual Updates:Force chart redraw for real-time updates
- Indicators:Add\Delete\GetName\GetTotal of indicator of any chart\subwin
- Navigate:Navigate chart
- Compilation:Compile MQL5 source to EX5 bytecode
- Backtesting and Optimization:Run historical tests with multiple tick modeling\leverage\opt criterian\opt mode\forward\visual mode.. etc and get full report, deals, balance\equity curve.
- EA Execution:Run Expert Advisors in real-time
- Logging:Retrieve EA logs for debugging and monitoring
- Terminal and Account:Obtaing terminal and acount info_* (integer, string, double)
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.
- Purchase McpServerByLeo here:https://www.thebotplace.com/bot/mcpserverbyleo
- Get yourTBP IDfrom yourTheBotPlace account - Your user ID
- Add it to theargsarray in yourclaude_desktop_config.jsonor the JSON that your AI platform uses (see Quick Start/step 4 below)
cd "C:\Users\YOUR USER\AppData\Roaming\MetaQuotes\Terminal\YOUR ID\MQL5\Shared Projects" tsndep install "https://forge.mql5.io/nique_372/FullMt5McpByLeo.git"
- For use tsndep command requerid tsndep pacakage (avaible inpypi).. This command automatically downloads all dependencies and installs all requirements from the repositories.
- If any part of the system is private, then it will fail... contact me so I can give you access (if it's a product, you can buy it; if you have any questions, don't hesitate to contact me).
Download the latest .exe and .ex5 files from the reporeleases. 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 thetools.jsonfile 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" } }
- JSON_TOOL_PATH: Path to the tools configuration json (you can download the json from the mt5_mcp_by_leo folder and place it in documents for example and put the path to said file here...) Or if you have the repository cloned, you can use the path to tools.json
Add to yourclaude_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 inTemplates/claude_desktop_config.json
- PATH_TO_EXE: Path to exe McpServer.exe file
- PATH_TO_FILE: Path to json config file
- YOUR_TBP_ID: Your The Bot Place user ID
- YOUR_MT5_ACCOUNT_LOGIN_ID: ACCOUNT_LOGGIN of your mt5 account where Mt5Mcp EA is running
In MT5:Tools→Options→Allowed URLs for WebRequest
- Add127.0.0.1or host you configured.
- ClickAccept
- Enable AutoTrading and DLL imports
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
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.
- Wiki:https://forge.mql5.io/nique_372/FullMt5McpByLeo/wiki
- Testing MCP (Full testing in YT videos):
- https://www.youtube.com/watch?v=kco7aCOs-bM
- https://www.youtube.com/watch?v=xCscKpoCi3Y
- Platform:MQL5 Community
- Profile:https://www.mql5.com/es/users/nique_372/news
Copyright © 2026 Niquel Mendoza (nique_372).
TSN Trading Systems ecosystem.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Managed MCP server for Bybit perpetual futures trading. Isolated sub-accounts, built-in risk management, 12 trading tools.
Deterministic macro regime engine for AI trading agents — RISK_ON / NEUTRAL / RISK_OFF / STRESS with transparent scoring rules.
A quantitative analysis platform for Futu Securities, offering intelligent caching, technical analysis, and pattern recognition.
A high-performance MCP server for comprehensive options order flow analysis.
Access real-time and historical token, wallet, and trading data from the Solana ecosystem via the Solana Tracker API.
Access financial data like stock prices, currency info, and insider trading data using the Synth Finance API.
A modular trading automation project using the Zerodha Kite Connect API for tool-based and resource-based automation.
Integrates the xtquant quantitative trading platform with an AI assistant, enabling AI to access and operate quantitative trading data and functions.
Provides stock market data and trading capabilities using the yfinance library.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





