Universal MCP Server for MetaTrader 5 Trading & Data Operations
Overview
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.
Main Features (MCP Functions)
Trade Operations
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
Market Data & Symbols
Access real-time and historical data:
- 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)
- Market Watch: Manage symbol selection and availability
Graphic Objects
Create and modify chart visualizations:
- Draw Objects: Create trend lines, rectangles, text labels, arrows
- Object Properties: Modify colors, styles, prices, text
- Chart Annotations: Add visual markers and indicators to charts
Chart Management
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
Code & Terminal
Compile and execute Expert Advisors:
- Compilation: Compile MQL5 source to EX5 bytecode
- Backtesting: Run historical tests with multiple tick modeling
- 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)
Repository Structure
FullMt5McpByLeo/
├── Src/ # MQL5 Backend Functions
│ ....
├── mt5_mcp_by_leo/ # Python MCP Server
│ ....
Requirements
- For repo code
- Check: dependencies.json
- For user use:
- Check: pyproject.toml por py dependencies and min py version.
- EX5 of releases (Runner an McPServer).
- McpServer requerid a EX5 Library, pucharse in: TheBotPlace - McpServerByLeo
Installation of repo code
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 in pypi).. 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).
Quick Start (for final users)
1. Install Pacakage
pip install mt5-mcp-by-leo
2. Create a config json
Open Common\Files And create a file with this structure:
{
"general_config": {
"port": 9999,
"host": "127.0.0.1",
"mode": "fast_mcp"
},
"fast_mcp": {
"name": "FastMcpServer"
},
"http": {
"http_port": 8000,
"name": "HTTP Server",
"tools_namespace": "tools"
}
}
3. Configure in Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mt5_mcp_by_leo": {
"command": "python",
"args": ["-m",
"mt5_mcp_by_leo",
"--config",
"PATH_TO_FILE",
"--config_encodig",
"utf-8"
]
}
}
}
- PATH_TO_FILE: Path to json config file
4. Configure MetaTrader 5
In MT5: Tools → Options → Allowed URLs for WebRequest
- Add
127.0.0.1or host you configured. - Click Accept
- Enable AutoTrading and DLL imports
5. Open claude desktop
Open Claude Desktop. At that moment, a Python script is running in the background until it establishes a connection with the EA McpServer.ex5.
6 Compile & Attach EA
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
7. Use in Claude
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)
License
By downloading or using this repository, you accept the license terms.
Documentation
Contact
- Platform: MQL5 Community
- Profile: https://www.mql5.com/es/users/nique_372/news
Copyright © 2026 Niquel Mendoza (nique_372).
TSN Trading Systems ecosystem.
Metadata
Release files for mt5-mcp-by-leo 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mt5_mcp_by_leo-1.0.7.tar.gz | 24.8 kB | Without provenance | Details for mt5_mcp_by_leo-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mt5_mcp_by_leo-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for mt5_mcp_by_leo-1.0.7-py3-none-any.whl |
Total release size: 37.9 kB
Release files / mt5_mcp_by_leo-1.0.7.tar.gz
| Download URL | mt5_mcp_by_leo-1.0.7.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44fa32759bba55fa0e535b180de9e39fb7b2b240fa3f9c893330c784745a9dc7
|
|
BLAKE2b-256 checksum How to use checksums |
cbb44c65c0a97efd138ad9cfddba578aa71e3eb8921311fd66bd2dbafe9edc52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Release files / mt5_mcp_by_leo-1.0.7-py3-none-any.whl
| Download URL | mt5_mcp_by_leo-1.0.7-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29fbf9cc0ec0c591bff1860a8750f9b163bccf718031221daf8350e895f305be
|
|
BLAKE2b-256 checksum How to use checksums |
54a95194fcf4de7b62268d7191196888ac89eee1f02936f9fd8ec0706a505f48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Security for mt5-mcp-by-leo 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.