Mt5 Mcp By Leo

io.github.TradeSystemsNique由 GitHub 帳號 TradeSystemsNique 發布v1.0.0更新於 Oct 24, 2026

Full MCP server for MT5: access trades, logs, compilation, etc..

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 助理直接控制 MetaTrader 5:下單與管理交易、讀取行情資料、繪製圖表物件,以及編譯與回測 MQL5 程式碼。

可以做什麼
開倉、修改與關閉持倉及掛單,並查詢歷史成交與盈虧分析。取得 OHLC K 線、Tick 資料、品種屬性,並管理市場報價清單。新增、移除與讀取指標參數及緩衝區。繪製與編輯圖表物件,開啟、關閉、列出、導覽與重繪圖表。編譯 MQL5 原始碼,執行含報告的回測與最佳化,執行 EA 並讀取其日誌,以及讀取終端與帳戶資訊。
適用情境
適合想用自然語言操作 MetaTrader 5 終端的情境:執行或調整交易、取得價格與品種資料、在圖表上標註,或編譯、回測與執行 MQL5 智慧交易系統。
執行需求
需要安裝 MetaTrader 5 的 Windows 桌面環境。需要專案發布頁的 McpServer.exe 與 Mt5Mcp.ex5 檔案、tools.json 檔案以及 JSON 設定檔。助理設定需傳入 exe 路徑、設定路徑、The Bot Place 使用者 ID 與 MT5 帳戶登入 ID。MT5 需在 WebRequest 中允許所設定的主機,啟用自動交易與 DLL 匯入,並將 EA 掛到圖表且主機與連接埠一致。
安裝前請注意
它可以送出、修改與關閉真實交易並執行智慧交易系統,誤操作或非預期指令可能在真實帳戶上造成資金變動。設定時需以命令列參數提供 The Bot Place 使用者 ID 與 MT5 帳戶登入 ID。需要在 MT5 中啟用自動交易與 DLL 匯入。README 說明部分內容可能為私有,需要授權或購買。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mt5 Mcp By Leo,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[圖片] [圖片] [圖片] [圖片] [圖片] [圖片]

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 (General)

  • Fast execution; the MCP server is written in C++ using simdjson and MQL5 uses JsonParserByLeo (fast MQL5 JsonParser), ultra-optimized code for maximum speed. The average response time is around 10ms (from when Claude calls a function until its response; note that this may depend on the size of the request... on average it's 10ms).
  • Unlike other MCPs for MT5, this MCP has two parts, one in MQL5 and the other in C++, giving access to the full MQL5 API and not limited to the mt5 package for Python, which lacks functions for handling charts, etc.

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, etc.. full SYMBOL_INFO_*)
  • Market Watch: Manage symbol selection and availability

Indicators

  • Indicator Manager: Get parameters, Add indicadors (ALL, Custom, MA, ETC..), Remove, Get Buffers, etc..

Graphic Objects

Create and modify chart visualizations:

  • Draw Objects: Create trend lines, rectangles, text labels, arrows
  • Object Properties: Modify colors, styles, prices, text, full ENUM_OBJECT_PROPERTY_*
  • 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
  • Indicators: Add\Delete\GetName\GetTotal of indicator of any chart\subwin
  • Navigate: Navigate chart

Code & Terminal

Compile and execute Expert Advisors:

  • Compilation: Compile MQL5 source to EX5 bytecode
  • Backtesting and Optimization: Run historical tests with multiple tick modeling\leverage\opt criterian\opt mode\forward\visual mode.. etc and get full report, deals, balance\equity curve.
  • 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)

Note: Python version package mt5_mcp_by_leo is deprecated. now replace by C++ exe server. Note: Unlike other MCPs that use .ini files to launch backtests, this MCP doesn't need that because it controls the entire MT5 tester from the same EA, without .ini files, without wasted terminals. In addition, the code compilation is more complete since its AI can choose whether or not to optimize the code, instructions, etc.


Repository Structure

FullMt5McpByLeo/├── Src/                              # MQL5 Backend Functions│    ....├── mt5_mcp_by_leo/                   # Json tools definition│    ....

⚠️ License Activation (Required)

Your MCP server won't work without an active license from TheBotPlace.

  1. Purchase McpServerByLeo here: https://www.thebotplace.com/bot/mcpserverbyleo
  2. Get your TBP ID from your TheBotPlace account - Your user ID
  3. Add it to the args array in your claude_desktop_config.json or the JSON that your AI platform uses (see Quick Start/step 4 below)

Requirements (pre-instalation)

  • General (for all)
  • EXE from releases (McpServer.exe)
  • For repo code (devs)
  • For user use:
  • EX5 of releases (Runner an Mt5Mcp).

Installation of repo code

bash
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. Download

Download the latest .exe and .ex5 files from the repo releases. Place the .ex5 files in the MT5 terminal's Experts\ folder, and the .exe file in an easily accessible folder (for example, the MT5 terminal's Common\Files\ folder).

2. Download tools.json

Download the tools.json file and place it in your terminal's Common\Files\ folder.

3. Create a config json

Open Common\Files And create a json file with this structure:

json
{  "general": {    "type_reg": "stdio_stdin",    "json_tools_fpath": "JSON_TOOL_PATH"  },  "mt5_conn": {    "host": "127.0.0.1",    "port": 9999  },  "http_lib": {    "name": "McpMt5Server",    "version": "1.0.0",    "host": "127.0.0.1",    "port": 8080,    "endpoint": "/"  },  "stdio_stdin": {    "name": "MT5 MCP Server",    "version": "1.0.0"  }}

Full template in Templates/config.json

  • JSON_TOOL_PATH: Path to the tools configuration json (you can download the json from the mt5_mcp_by_leo folder and place it in documents for example and put the path to said file here...) Or if you have the repository cloned, you can use the path to tools.json

4. Configure in Claude Desktop

Add to your claude_desktop_config.json:

json
{  "mcpServers": {    "mt5_mcp_by_leo": {      "command": "PATH_TO_EXE",      "args": ["PATH_TO_FILE", "YOUR_TBP_ID", "YOUR_MT5_ACCOUNT_LOGIN_ID"       ]    }  }}

Full template in Templates/claude_desktop_config.json

  • PATH_TO_EXE: Path to exe McpServer.exe file
  • PATH_TO_FILE: Path to json config file
  • YOUR_TBP_ID: Your The Bot Place user ID
  • YOUR_MT5_ACCOUNT_LOGIN_ID: ACCOUNT_LOGGIN of your mt5 account where Mt5Mcp EA is running

5. Configure MetaTrader 5

In MT5: Tools → Options → Allowed URLs for WebRequest

  • Add 127.0.0.1 or host you configured.
  • Click Accept
  • Enable AutoTrading and DLL imports

6. Open claude desktop

Open Claude Desktop. At that moment, a CMcpServer.exe is running in the background until it establishes a connection with the EA Mt5Mcp.ex5.

7. Attach EA in MT5

1. Run Runner.ex5 in any chart.. (dowland from releases)2. Drag Mt5Mcp.ex5 onto your chart (any) and cofigure it, The parameters of the EA, such as port/host, must match the JSON of Claude Desktop

8. 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 (McpServer.exe support HTTP with libs httplib + mcp-remote npm package) (see: https://forge.mql5.io/nique_372/McpServer/wiki/Running-HTTP)


License

Read Full License

By downloading or using this repository, you accept the license terms.


Documentation


Contact


Copyright © 2026 Niquel Mendoza (nique_372).
TSN Trading Systems ecosystem.

來源:README.md,提交 2b43053

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。