
MT5-Quant
io.github.masdevid由 GitHub 帳號 masdevid 發布v1.34.3更新於 Oct 24, 2026
MT5 strategy development with 87 tools. Backtest, optimize, debug MQL5 EAs on macOS/Linux.
概覽
本機 MCP 伺服器,讓助手在 macOS 或 Linux 上編譯、回測、最佳化並分析 MetaTrader 5 的 MQL5 智慧交易系統。
- 可以做什麼
- 編譯、列出並搜尋 MQL5 專家顧問、指標與腳本,並產生新專案範本
- 執行回測與基因最佳化,查詢工作狀態並與基準結果比較
- 分析報告與逐筆交易:每月損益、回撤、連勝連虧、持倉時間、成本、手數與加碼層表現
- 搜尋、歸檔、標註並匯出回測報告與歷史紀錄,清理舊報告目錄
- 讀取、寫入、修改、比對並產生 .set 參數檔
- 診斷 Wine、MT5 日誌、行程與系統資源,並管理測試器快取
- 適用情境
- 適合在 macOS 或 Linux 上開發或調校 MetaTrader 5 智慧交易系統,希望助手自動完成編譯—回測—分析流程並深入檢視逐筆交易結果的情境。
- 執行需求
- 以本機執行檔形式在 macOS 或 Linux 上執行,可透過 Cargo 或預先編譯的發行檔安裝並放入 PATH;安裝腳本會自動偵測 Wine 與 MT5 路徑。需要以 Wine 執行的 MetaTrader 5 安裝(含 MetaEditor 與終端機資料)。可選環境變數 MT5_MCP_HOME 指定設定目錄。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 MT5-Quant,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MT5-Quant
[OpenSSF Scorecard] [CII Best Practices] [Rust CI] [crates.io] [License: MIT] [CodeQL]
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.
Why MT5-Quant
Focus: Backtest organization, reporting, and analytics — capabilities MT5 itself doesn't provide.
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)
Option B — Pre-built binaries (no toolchain)
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
Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json
Cursor — .cursor/mcp.json (same JSON shape as Claude Desktop)
opencode — .opencode/opencode.jsonc
Codex CLI — ~/.codex/config.toml
Then finish setup (auto-detects Wine + MT5 paths):
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.shto auto-detect Wine and MT5 paths, and register it as an MCP server."
First Backtest
The AI runs the full pipeline: compile → clean cache → backtest → extract → analyze.
MCP Tools (89)
Core workflow
Granular Analytics (individual analysis)
Use these for targeted analysis, or analyze_report to run all at once.
Deal-Level Analytics (New)
Monitoring
Reports & logs
History & baseline
Cache management
Pre-flight & Validation
Debugging & Diagnostics (New)
Project Management
History & Comparison
.set file — read / write
.set file — analysis & generation
Search & Discovery
Full schema: docs/MCP_TOOLS.md
Troubleshooting
Run verify_setup from your LLM first — it checks all paths and returns actionable hints.
For crashes or unexplained failures during backtest/compile/optimization:
diagnose_wine— Check Wine installation and prefix healthsearch_mt5_errors— Find crash causes in logscheck_mt5_process+kill_mt5_process— Detect and kill stuck processesget_backtest_crash_info— Investigate failed backtest reports
Documentation
Full index with reading order: docs/INDEX.md
Acknowledgements
MT5-Quant stands on the shoulders of exceptional open-source projects:
- Rust — The language that makes zero-cost abstractions, memory safety, and fearless concurrency practical
- Tokio — The async runtime powering all concurrent operations
- Wine — Making MT5 execution possible on macOS and Linux without Windows licensing
- MetaTrader 5 — MetaQuotes' trading platform (trademark of MetaQuotes Software Corp.)
- rusqlite — Ergonomic SQLite bindings for Rust
- serde — The serialization framework making config and report handling painless
- scraper — HTML parsing for MT5 report extraction
- tempfile — Secure temporary file handling
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
來源:README.md,提交 62987f0
工具
0版本歷史
1- v1.34.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分