
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 分