PM

phuicmt/mcp-mt5

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

20 stars 3 forks 质量 78 趋势 18MIT

MetaTrader 4/5 构建管道的 MCP 服务器(编译、部署、反向测试、剖析报告)

概览

编译MQL源,部署编译的EA,运行策略测试器,解析报告,尾端日志——都由一LLM代理驱动而未触碰MetaTrader UI. a LLM 代理编辑 .mq5 源 .汇编 .部署 .运行 战略测试器 .读取报告 .调整 .重复 . 没有经纪人登录, 没有人环, 没有风险的真钱执行。 对于运行时间交易,将这个与活交易的MCP配对——它们瞄准不同的层并作好作曲. 27个工具(外加16个已贬值的别名至0.6.0)和2个资源模板. 每个工具都携带了MCP注释(只读/破坏性提示),一个打出输出计数和每参数描述;失败被报告为工具出错,从没有以出错键作为正常结果. 0.5.0前作的工具名仍然用0.5.x作为薄薄的包装来工作,其描述从DEPRECATED开始. 设置 MCP MT5 LEGACY TOOLS=0来隐藏它们,并收缩工具目录到上面的27个工具. 需要Windows + 一个已安装的MetaTrader 4或5终端.

概述(AI 翻译)

** MetaTrader 4/5 构建管道的上下文协议服务器。 ** 编译 MQL 源, 部署已编译的 EA, 运行策略测试器, 解析报告, 尾端日志 —— 均由 LLM 代理驱动, 不触摸 MetaTrader UI 。

– – . . .

□这是什么 和它不是

此服务器不是此服务器 |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- – 编译,部署,回试,解析 – 活贸易(订单,位置,引文) – 编译,部署,回试,解析 – 活贸易(订单,位置,引文) – 编译,部署,回试,解析 : [T0]/[T1] CLI 直接[T2] Python 软件包 QQ QQ 运行于已安装终端的完全下线 QQ 连接到中介服务器 QQ

  • 执行生产战略 *

** 使用大小写:** LLM 代理编辑 [[T3] 源 编辑 汇编 部署 运行 策略测试器 阅读报告 调整 重复 。 没有经纪人登录, 没有人环, 没有风险的真钱执行。

对于运行时间交易,将这个与活交易的MCP配对——它们瞄准不同的层并作好作曲.

– – . . .

□ 工具

27个工具(外加16个已贬值的别名至0.6.0)和2个资源模板.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-mt5

Model Context Protocol server for the MetaTrader 4/5 build pipeline. Compile MQL sources, deploy compiled EAs, run Strategy Tester, parse reports, tail logs — all driven by an LLM agent without touching the MetaTrader UI.


What this is — and what it isn’t

✅ This server ❌ Not this server
MetaTrader dev harness — compile, deploy, backtest, parse Live trading (orders, positions, quotes)
Wraps MetaEditor64.exe / terminal64.exe CLI directly Wraps the MetaTrader5 Python package
Runs entirely offline against installed terminal Connects to a broker server
Iterates strategies before they go live Executes strategies in production

Use case: an LLM agent edits .mq5 source → compiles → deploys → runs Strategy Tester → reads report → adjusts → repeats. No broker login, no human in the loop, no risk of real-money execution.

For runtime trading, pair this with a live-trading MCP — they target different layers and compose well.


Tools

27 tools (plus 16 deprecated aliases until 0.6.0) and 2 resource templates. Every tool carries MCP annotations (read-only / destructive hints), a typed output schema and per-parameter descriptions; failures are reported as tool errors, never as a normal result with an error key.

🔍 Discovery & terminal selection

Tool Description
env_info Resolved paths, terminal hash, edition, and missing-component issues
list_terminals Every MT4/5 terminal data folder under %APPDATA%\MetaQuotes\Terminal with its origin.txt install path
select_terminal Switch the active terminal data folder mid-session by origin path, hash, or install dir

🔨 Build & deploy

Tool Description
compile MetaEditor CLI on a .mq4/.mq5/.mqh. ok requires a Result: line with 0 errors and a freshly written binary (MetaEditor’s exit code is 1 even on success and is ignored). syntax_only=true uses /s for a fast check without a binary
compile_and_deploy Compile, then copy the fresh .ex4/.ex5 into Experts/
deploy Copy a compiled binary into Experts/ or a .mqh into Include/, chosen by extension
smoke_test Compile + deploy + 1-day headless backtest + journal scan for runtime errors
list_experts Enumerate Experts/ (defaults to *.ex5 on MT5, *.ex4 on MT4)

🔎 Source analysis & lint

Tool Description
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mt5": { "command": "mcp-mt5", "env": { "MT5_INSTALL": "C:\\Program Files\\MetaTrader 5" } } } }