MT5 strategy development with 87 tools. Backtest, optimize, debug MQL5 EAs on macOS/Linux.
io.github.masdevid/mt5-quant MCP Server
This MCP server supports MT5 strategy development using 87 tools. It enables developers to backtest strategies, optimize results, and debug MQL5 Expert Advisors (EAs). It is intended to run on macOS and Linux.
π οΈ Key Features
87 tools for MT5 strategy development
Backtesting support
Optimization support
Debugging for MQL5 EAs
macOS/Linux operation
π Use Cases
Developing and testing MT5 trading strategies
Iterating on strategy parameters via optimization
Diagnosing issues in MQL5 EAs during development
β‘ Developer Benefits
Tooling focused on MT5 workflows (backtest, optimize, debug)
Compatibility with macOS/Linux environments
Development oriented around MQL5 EAs and quantitative-finance tasks
β οΈ Limitations
Limited detail available beyond the stated tool count and capabilities
MCP server for MT5 strategy development on macOS/Linux. 89 tools to compile, backtest, analyze, optimize, debug crashes, and manage MQL5 Expert Advisors β no Windows required.
code
You: "Backtest MyEA Jan-Mar, what caused the February drawdown?"
Claude: [compile β clean β backtest β analyze 1,847 deals]
β Feb 14: BUY grid at L6, locking lot 1.75Γ base
β Cutloss fired 17 points later
β Recommendation: cap locking multiplier to β€1.2Γ
Others typically run on Windows using the MetaTrader5 Python package, providing full terminal operations. MT5-Quant fills the gap: organizing backtest reports, extracting deal-level insights, and managing optimization workflows β none of which MT5 or its Python API expose natively.
Quick Start
Install MT5-Quant
Option A β Cargo (recommended, needs Rust toolchain)
bash
cargo install mt5-quant --locked
Option B β Pre-built binaries (no toolchain)
bash
# macOS Apple Silicon
curl -LO https://github.com/masdevid/mt5-quant/releases/latest/download/mcp-mt5-quant-macos-arm64.tar.gz
tar xzf mcp-mt5-quant-macos-arm64.tar.gz # β mcp-mt5-quant-macos/mt5-quant# Linux x64
curl -LO https://github.com/masdevid/mt5-quant/releases/latest/download/mcp-mt5-quant-linux-x64.tar.gz
tar xzf mcp-mt5-quant-linux-x64.tar.gz # β mcp-mt5-quant-linux/mt5-quant
Move the binary somewhere on your PATH (e.g. /usr/local/bin or ~/.local/bin) so clients can launch it as mt5-quant.
Option C β Register with your LLM client (copy-paste)
Claude Code
bash
claude mcp add mt5-quant -- mt5-quant --stdio
Claude Desktop β ~/Library/Application Support/Claude/claude_desktop_config.json
Then finish setup (auto-detects Wine + MT5 paths):
bash
bash scripts/setup.sh
Tip: you can also just ask your LLM coding agent to do all of the above:
"Please install mt5-quant from https://github.com/masdevid/mt5-quant β download or build it, run its scripts/setup.sh to auto-detect Wine and MT5 paths, and register it as an MCP server."
First Backtest
code
Run a backtest on MyEA from 2025.01.01 to 2025.03.31
The AI runs the full pipeline: compile β clean cache β backtest β extract β analyze.
Special thanks to the Model Context Protocol (MCP) team at Anthropic for defining the standard that makes AI-powered development workflows possible.
Disclaimer
Not Financial Advice. MT5-Quant is a development and analysis tool for algorithmic trading strategies. It does not provide investment advice, trading recommendations, or guarantee profitability. All backtest results are historical simulations and do not guarantee future performance.
Use at Your Own Risk. Trading financial instruments carries substantial risk of loss. The authors and contributors of MT5-Quant accept no liability for:
Trading losses incurred using strategies developed or tested with this tool
Data loss or corruption from backtest operations
Bugs, errors, or incorrect analysis results
System crashes, Wine compatibility issues, or MT5 failures
Software Warranty. This software is provided "as-is" without warranty of any kind, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement. See LICENSE for full terms.
Third-Party Software. MT5-Quant interacts with MetaTrader 5, Wine, and other third-party software. Users are responsible for complying with all applicable licenses and terms of service for these dependencies. MetaTrader is a trademark of MetaQuotes Software Corp. MT5-Quant is not affiliated with, endorsed by, or sponsored by MetaQuotes.
Regulatory Compliance. Users are responsible for ensuring their trading activities comply with applicable financial regulations in their jurisdiction. Automated trading may be restricted or require licensing in some regions.
License
MIT
Install
Configuration
Environment variables
MT5_MCP_HOME
Path to MT5-Quant config directory (default: ~/.config/mt5-quant)