原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。使用 Google 登录即可撰写评价。原型 · 每 30 分钟更新
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

MetaTrader 5 MCP Bridge

作者:vincentwongso版本 1.4.2i★ 6i在你的电脑上运行官方网站 ↗
注册名称io.github.vincentwongso/mt5-trading-mcp

安装方法

What it does

Let an AI agent read and trade a MetaTrader 5 account over MCP, behind a human-approval gate.

  • Connects 在你的电脑上运行
  • Account or key No key needed
  • Category 会计、财务与税务

为什么排在这里

列表按使用分(满分 100)排序,由以下部分组成

热度10/80GitHub 星标或每周下载量:较大的计 60,较小的计 20
新鲜度12/1230 天内有发布或代码更新得满分
仍在响应0/8上次检查时云端端点有响应
使用分22/100

质量: 基础检查通过 3/3 项(仅展示,不用于排序) · 上升势头: 暂无数据 (只用于“上升中”标签)

安装

选择你使用的 AI 应用,然后复制设置。

用一句话让 AI 帮你安装

请帮我安装 MetaTrader 5 MCP Bridge。按照 https://mcp.popnx.com/i/vincentwongso-mt5-trading-mcp.md 操作,先把命令给我看,等我同意后再运行。

粘贴到能在你电脑上工作的 AI(如 Claude Code、Cursor)。它会读取我们的步骤,先给你看命令,等你同意。无需密钥,无需注册。 · 查看 AI 会读取的全文

通过 3/3 项检查 · 在你的电脑上运行 · ✓ 命令已检查 2026年11月14日

第一步:你用哪个 AI?

选择你用的应用,步骤会显示在下方。

可连接 Claude,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用

让 AI 帮你安装

把这段话复制到 Claude 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude 安装 MCP server MetaTrader 5 MCP Bridge,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "mt5-trading": { "command": "uvx", "args": [ "mt5-trading-mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 MetaTrader 5 MCP Bridge 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 打开电脑版 Claude 应用的设置文件

    SettingsDeveloperEdit Config

  3. 粘贴这些设置并保存文件

    {
      "mcpServers": {
        "mt5-trading": {
          "command": "uvx",
          "args": [
            "mt5-trading-mcp"
          ]
        }
      }
    }
  4. 退出 Claude 再重新打开

  5. 试一试

    用 MetaTrader 5 MCP Bridge 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude 说正在使用 MetaTrader 5 MCP Bridge,或回答中出现 MetaTrader 5 MCP Bridge 的工具名称,就表示连接成功

3 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • MT5_LOGIN MetaTrader 5 账户号码。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 account number. Optional: overrides the config file and an already-logged-in terminal.
  • MT5_PASSWORD MetaTrader 5 账户密码。仅通过环境变量设置,因此不会写入配置文件。若终端已登录,则可选。
    查看英文原文MetaTrader 5 account password. Env-only so it never lands in a config file. Optional when the terminal is already logged in.
  • MT5_SERVER MetaTrader 5 经纪商/交易服务器名称。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 broker/trade server name. Optional: overrides the config file and an already-logged-in terminal.

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

ChatGPT 暂时无法连接 MetaTrader 5 MCP Bridge

MetaTrader 5 MCP Bridge 需要安装在你的电脑上,而 ChatGPT 只能连接在网上运行的服务器

你可以改用这些方式

A · 使用能连接 MetaTrader 5 MCP Bridge 的应用

  • 需要先在电脑上安装 Python (uv)(只需一次) · 仅限电脑上的 Claude 应用(Windows 或 Mac),网页和手机不可用
  • 需要先在电脑上安装 Python (uv)(只需一次)
  • 需要先在电脑上安装 Python (uv)(只需一次)
  • 需要先在电脑上安装 Python (uv)(只需一次)

B · 会计、财务与税务 类中能连接 ChatGPT 的其他服务器

从同类中使用较多的里挑选,仅限用地址即可连接、无需密钥的

可连接 Claude Code,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 Claude Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Claude Code 安装 MCP server MetaTrader 5 MCP Bridge,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):claude mcp add --scope user mt5-trading -- uvx mt5-trading-mcp 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 MetaTrader 5 MCP Bridge 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 打开终端

    Mac:按 Command+空格,输入 Terminal · Windows:打开 PowerShell

  3. 粘贴这条命令并按 Enter

    claude mcp add --scope user mt5-trading -- uvx mt5-trading-mcp
  4. 在 Claude Code 中输入 /mcp

    应能看到 MetaTrader 5 MCP Bridge 在列表中并显示已连接

  5. 试一试

    用 MetaTrader 5 MCP Bridge 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Claude Code 说正在使用 MetaTrader 5 MCP Bridge,或回答中出现 MetaTrader 5 MCP Bridge 的工具名称,就表示连接成功

3 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • MT5_LOGIN MetaTrader 5 账户号码。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 account number. Optional: overrides the config file and an already-logged-in terminal.
  • MT5_PASSWORD MetaTrader 5 账户密码。仅通过环境变量设置,因此不会写入配置文件。若终端已登录,则可选。
    查看英文原文MetaTrader 5 account password. Env-only so it never lands in a config file. Optional when the terminal is already logged in.
  • MT5_SERVER MetaTrader 5 经纪商/交易服务器名称。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 broker/trade server name. Optional: overrides the config file and an already-logged-in terminal.

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Anthropic 帮助页面核实 · 你的界面可能因版本略有不同

可连接 Cursor,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 Cursor 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 Cursor 安装 MCP server MetaTrader 5 MCP Bridge,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "mcpServers": { "mt5-trading": { "command": "uvx", "args": [ "mt5-trading-mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 MetaTrader 5 MCP Bridge 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 点击这个按钮打开 Cursor

    在 Cursor 中打开

    Cursor 会请你确认安装,点击 Install

  3. 在 Cursor 中以 Agent 模式打开 AI 聊天

  4. 试一试

    用 MetaTrader 5 MCP Bridge 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 Cursor 说正在使用 MetaTrader 5 MCP Bridge,或回答中出现 MetaTrader 5 MCP Bridge 的工具名称,就表示连接成功

3 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • MT5_LOGIN MetaTrader 5 账户号码。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 account number. Optional: overrides the config file and an already-logged-in terminal.
  • MT5_PASSWORD MetaTrader 5 账户密码。仅通过环境变量设置,因此不会写入配置文件。若终端已登录,则可选。
    查看英文原文MetaTrader 5 account password. Env-only so it never lands in a config file. Optional when the terminal is already logged in.
  • MT5_SERVER MetaTrader 5 经纪商/交易服务器名称。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 broker/trade server name. Optional: overrides the config file and an already-logged-in terminal.

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 Cursor 帮助页面核实 · 你的界面可能因版本略有不同

可连接 VS Code,但需要先准备

需要先在电脑上安装 Python (uv)(只需一次)

让 AI 帮你安装

把这段话复制到 VS Code 的对话里。AI 会先检查电脑,告诉你要改哪个文件,并且每次都等你同意。

请在这台电脑上为 VS Code 安装 MCP server MetaTrader 5 MCP Bridge,按顺序:1) 用 uv --version 检查是否有 uv。没有的话,请让我从 https://docs.astral.sh/uv/getting-started/installation/ 安装,不要自己安装。2) 只使用这份配置(已通过 PopNx MCP 检查):{ "servers": { "mt5-trading": { "type": "stdio", "command": "uvx", "args": [ "mt5-trading-mcp" ] } } } 3) 告诉我要修改的文件完整路径或要运行的命令,等我同意。4) 不需要密钥。5) 按约定执行,然后确认 MetaTrader 5 MCP Bridge 的工具真的出现了。

这段话不包含你的密钥。如果需要密钥,AI 会请你自己粘贴到文件或应用的输入框里。

  1. 安装 uv(如果还没有)

    已经装好了吗?先检查 · 打开终端,输入这条命令后按 Enter

    uv --version
    • 显示版本号(例如 uv …)= 已安装,可跳过这一步
    • 显示 "command not found"(Windows 显示 "is not recognized")= 还没安装,或刚装好但需要关掉终端再重新打开
    怎么打开终端

    Mac:按 ⌘ + Space,输入 Terminal 后按 Enter

    Windows:打开“开始”菜单,输入 Windows PowerShell,然后选“打开”

    还没安装: uv 没有点选式安装程序。从 uv 官方页面复制适合你系统(macOS 或 Windows)的一行命令,粘贴到终端 · 不需要单独安装 Python,uv 会在需要时自动下载

    打开 uv 下载页 ↗

    装好后关掉终端再打开,重新运行同一条命令,应显示版本号: uv --version

    安装一次,所有需要 uv 的工具都能用

  2. 点击这个按钮打开 VS Code

    在 VS Code 中打开

    VS Code 会请你确认安装,点击 Install

  3. 在 VS Code 中以 Agent 模式打开 AI 聊天

  4. 试一试

    用 MetaTrader 5 MCP Bridge 告诉我你能帮我做什么,然后做一件给我看

    ✓ 如果 VS Code 说正在使用 MetaTrader 5 MCP Bridge,或回答中出现 MetaTrader 5 MCP Bridge 的工具名称,就表示连接成功

3 项可选设置(不填也能用)

上面的命令不填这些也能用。想调整时再按开发者的说明添加。

  • MT5_LOGIN MetaTrader 5 账户号码。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 account number. Optional: overrides the config file and an already-logged-in terminal.
  • MT5_PASSWORD MetaTrader 5 账户密码。仅通过环境变量设置,因此不会写入配置文件。若终端已登录,则可选。
    查看英文原文MetaTrader 5 account password. Env-only so it never lands in a config file. Optional when the terminal is already logged in.
  • MT5_SERVER MetaTrader 5 经纪商/交易服务器名称。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 broker/trade server name. Optional: overrides the config file and an already-logged-in terminal.

说明为自动翻译,变量名保持原样;不确定时请查看原文。

菜单名称已于 2026年11月11日 对照 VS Code 帮助页面核实 · 你的界面可能因版本略有不同

其他支持 MCP 的应用(如 Windsurf、Zed、Gemini CLI)添加方式各不相同,请在应用列表中查看

查看所有支持 MCP 的应用 →

JSON 设置在下方“开发者专用”中

卡住了?问问正在用 MetaTrader 5 MCP Bridge 的人💬 讨论 →
开发者专用:终端命令和 JSON 设置

安装在电脑上

Claude Code

claude mcp add --scope user mt5-trading -- uvx mt5-trading-mcp

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "mt5-trading": {
      "command": "uvx",
      "args": [
        "mt5-trading-mcp"
      ]
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "mt5-trading": {
      "command": "uvx",
      "args": [
        "mt5-trading-mcp"
      ]
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "mt5-trading": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mt5-trading-mcp"
      ]
    }
  }
}

需要你填写的值

  • MT5_LOGIN env
    MetaTrader 5 账户号码。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 account number. Optional: overrides the config file and an already-logged-in terminal.
  • MT5_PASSWORD 机密 env
    MetaTrader 5 账户密码。仅通过环境变量设置,因此不会写入配置文件。若终端已登录,则可选。
    查看英文原文MetaTrader 5 account password. Env-only so it never lands in a config file. Optional when the terminal is already logged in.
  • MT5_SERVER env
    MetaTrader 5 经纪商/交易服务器名称。可选:会覆盖配置文件以及已登录的终端。
    查看英文原文MetaTrader 5 broker/trade server name. Optional: overrides the config file and an already-logged-in terminal.

说明为自动翻译,变量名保持原样;不确定时请查看原文。

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

一览

每周下载量i
74/周
连接方式
在你的电脑上运行
最新版本i
1.4.2
发布到注册中心i
2026年6月25日
代码最后更新i
2026年11月18日
作者
vincentwongso
软件包
pypi: mt5-trading-mcp
注册状态
活跃

哪些应用可以使用它

依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。

在你的电脑上运行,适用于

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

全部应用及其优缺点 →

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月19日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 vincentwongso 验证,该账户拥有此仓库

  • ✓ 通过

    仍在维护

    代码最后更新于昨天

  • ✓ 通过

    有许可证

    使用 MIT

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

已公开的漏洞(OSV.dev)

OSV.dev 中没有 mt5-trading-mcp@1.4.2 的记录

只检查这个版本的包本身,不包括所有依赖 · 检查于 2026年11月15日

我们检查什么 → · JSON

作者:申请重新检查或报告信息错误
给作者:在 README 中加徽章

如果你是作者,可把这段代码贴到 README。徽章会链接回本页。

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/vincentwongso-mt5-trading-mcp.svg)](https://mcp.popnx.com/en/servers/vincentwongso-mt5-trading-mcp)

讨论

提问、分享技巧或报告无法使用。按“有帮助”数量排序。

还没有帖子,欢迎第一个提问或分享。

此处内容由用户撰写,不代表 PopNx 团队。

登录后发帖

用户评价

还没有评价

登录后写评价

与“会计、财务与税务”中的其他服务器比较i

  • 星标数多于此分类中其他 3417 个服务器的 96%
  • 发布到注册中心的时间比此分类中其他 3417 个服务器的 12% 更新
  • 基础检查结果等于或优于此分类中其他 3417 个服务器的 99%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

MetaTrader 5 MCP Bridge 安全吗?

它在 3 项适用的基础检查中通过了 3 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于昨天,最新版本(1.4.2)于5个月前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。

有什么可以替代它?

同一分类中有:SolidInvoice, Signal8, Journalit, Beancount.io, Tapetide - Indian Stock Market MCP

功能相近的其他选择

同一分类、其他作者、命令已通过检查。官方的排在前面,再按星标排序。

如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

SolidInvoice

Create and send invoices and quotes, manage clients, and track payments in SolidInvoice.

作者:SolidInvoice正在增长★ 98910天前更新

在云端运行✓ 服务方 · solidinvoice.co

Signal8

SEC filings, dilution, insider & institutional ownership, and political-trade data for AI agents.

作者:signal8ai正在增长↓ 431/周★ 42510天前更新

电脑或云端✓ 服务方 · signal8.ai

Journalit

Trading journal in Obsidian. Ask Claude or ChatGPT about your trades; edits are previewed first.

作者:Cursivez正在增长★ 26111天前更新

在云端运行✓ 服务方 · journalit.co

Beancount.io

Query, edit, and reconcile a hosted Beancount ledger: BQL, reports, files, and bank imports.

作者:bex-co正在增长★ 702 整个仓库的星标44天前更新

在云端运行✓ 服务方 · beancount.io
与相似项目对比
本项
MetaTrader 5 MCP Bridge
SolidInvoiceSignal8JournalitBeancount.ioTapetide - Indian Stock Market MCP
运行位置需要安装在电脑上在云端运行,无需安装云端或安装在电脑上都可以在云端运行,无需安装在云端运行,无需安装云端或安装在电脑上都可以
需要密钥否否是否否是
可在 Claude 中按 + 添加否否否否否否
基础检查3/34/65/54/44/45/5
许可证MITMITMITNOASSERTIONMITMIT
价格登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用登记中未列出费用

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

MetaTrader 5 MCP Bridge

Let an AI agent manage your MetaTrader 5 account over [Model Context Protocol](https://modelcontextprotocol.io) - with configurable human approval gate.

A Hermes agent placing then closing a real 0.01-lot trade on a demo account, end-to-end over MCP on Linux.

Not a mock-up - the same round-trip in MetaTrader 5's own History tab; the tickets and balance match the recording.

⚠️ **This software places _real_ trades through your MetaTrader 5 terminal with

real orders and irreversible fills.** Read

DISCLAIMER.md

and SECURITY.md

before connecting it to a live account. Always test using your demo account first.

Runs locally - in the same process tree as your agent, no cloud, no telemetry. Windows (native) or Linux (via Docker); Python 3.10+.

📖 The story behind this: this project is built step by step in

*Wiring AI agent into MetaTrader 5*,

Part 1 of the *Trade with AI agent* series on the Fintrix engineering blog.

What it is

mt5-mcp lets an AI agent read your MetaTrader 5 account and place trades through it, over the Model Context Protocol.

  • 12 read-only tools: account, quotes, positions, orders, history, OHLC bars, broker-authoritative margin estimates, and native chart screenshots (Windows). No consent gate.
  • 4 mutating tools: place_order, modify_order, cancel_order, close_position, each behind a preflight + human-consent + idempotency + audit layer.
  • 3 subscribable resources: live account://, positions://, and quotes://{symbol} snapshots that push change notifications.
  • 2 ready-to-use Claude Code skills ship in .claude/skills/: mt5-market-data and mt5-trading teach an agent how to read the account and run the consent flow safely.

Full catalogue and the consent flow: [docs/tools.md](https://github.com/vincentwongso/mt5-trading-mcp/blob/main/docs/tools.md).

Why mt5-mcp

  • A safety layer, not just an API wrapper. Every mutating call routes through preflight checks -> an opt-in human-consent gate (arm it to require approval) -> idempotency -> an append-only audit log, so you can put a human in the loop on trades and always keep a replayable record of what the agent did.
  • An honest threat model. It treats an LLM wired to place_order as a live attack surface and says so plainly - the MCP is explicitly *not* the security boundary (see SECURITY.md).
  • Verifiable proof, not a mock-up. The demo above is a real round-trip; the tickets and balance match MetaTrader 5's own History tab.
  • Local-first. No cloud, no telemetry; runs beside your agent. Windows-native or Linux via an all-in-one Docker image (no rpyc version-matching).

Quickstart (Windows, native)

pip install mt5-trading-mcp
  1. Launch MetaTrader 5 and log into your broker. Enable AlgoTrading (toolbar button green).
  2. Verify the terminal is reachable: python -m mt5_mcp doctor: expect [INFO] backend: native and [PASS] lines.
  3. Run it: python -m mt5_mcp serve.

Wire it to OpenClaw in one command (registers the mcp.servers entry):

openclaw mcp set mt5-mcp '{"command":"python","args":["-m","mt5_mcp","serve"]}'

Quickstart (Linux, Docker)

The MT5 terminal + the MCP run headless in an all-in-one image; your agent talks MCP over HTTP. No host Python, no bridge.

cp deploy/.env.example deploy/.env   # add MT5_LOGIN / MT5_PASSWORD / MT5_SERVER

docker compose -f deploy/docker-compose.yml up -d

Log the terminal in once via the KasmVNC web UI at http://127.0.0.1:3001 (File -> Login to Trade Account; persists across restarts), then point your agent at http://127.0.0.1:8765/mcp. Wire it to OpenClaw in one command:

openclaw mcp set mt5-mcp '{"url":"http://127.0.0.1:8765/mcp","transport":"streamable-http"}'

Full walkthrough: [docs/installation.md](https://github.com/vincentwongso/mt5-trading-mcp/blob/main/docs/installation.md).

Chart screenshots (Windows only)

get_chart_screenshot(symbol, timeframe, annotations?) returns a PNG of the native MT5 chart, optionally annotated, so an LLM can read it visually (candles, support/resistance, patterns). Because the MetaTrader5 Python API cannot capture charts, this uses a small MQL5 Expert Advisor that runs inside a GUI terminal and calls ChartScreenShot().

See Chart annotations for marking up support/resistance lines, trendlines and notes before capture.

Setup (one time):

  1. Install and attach the AgentScreenshot EA - see mql5/README.md.
  2. Optionally set a template so your indicators/drawings appear in the shot: [screenshot] template = "agent.tpl" in your config, or leave it unset for the default chart.

Config knobs ([screenshot] section): width (default 1600), height (default 900), template (default none), timeout_s (default 10).

Not available on the headless Linux/Docker deployment: it needs a GUI terminal. Off Windows the tool returns SCREENSHOT_NOT_SUPPORTED.

For AI agents

If you've been handed this repository to install and run, follow the runbook in [docs/agents.md](https://github.com/vincentwongso/mt5-trading-mcp/blob/main/docs/agents.md). It covers platform detection, install, verification, registering the server, and the hard safety rules for trades - read it before calling any mutating tool.

Documentation

GuideWhat's in it
Installation & setupRequirements, Windows + Linux/Docker setup, wiring to an agent.
For AI agentsStep-by-step runbook for an agent installing and running the server.
Configurationconfig.toml schema, storage paths, hot-reload.
Tools & resourcesRead tools, mutating tools + consent flow, subscribable resources.
MCP client setupPer-client config snippets and Claude Code usage.
Transports & deploymentstdio/HTTP transports and Windows VPS patterns.
ContributingHow to contribute and run the tests.
ChangelogRelease history and known limitations.

Safety

mt5-mcp is not the security boundary, the broker's MT5 server enforces the hard limits (margin, max-lot, symbol permissions). Pre-flight checks in the policy engine are UX guardrails to catch agent mistakes early, not security controls.

The human-consent gate is opt-in and off by default: auto_approve_notional defaults to 0, so mutating calls auto-execute (full-open) - intended for trusted or unattended agents. Arm the gate by setting `auto_approve_notional` > 0: orders/closes whose notional is at or above it then return an ApprovalPreview you must confirm, and modifying a stop to widen or remove it also requires approval. The pre-flight limits (max_*) and symbol allow/deny lists are likewise opt-in (0 / empty = off). Every mutating call is recorded in an append-only audit JSONL log regardless. For vulnerability disclosure, see SECURITY.md.

Architecture

mt5-mcp wraps the MetaTrader 5 Python library behind a FastMCP server. A single MT5Client (src/mt5_mcp/adapter/) owns the terminal connection, broker-timezone inference, and type conversions; everything else sits on top of it. The Pydantic models in src/mt5_mcp/types.py / src/mt5_mcp/config.py are the source of truth for the data and config schemas.

     Agent / MCP client  (Hermes, OpenClaw, Claude Code, Claude Desktop, …)

│ │ stdio · loopback HTTP ▼ ┌──────────────────────────────────────────────────────────┐ │ FastMCP server │ │ │ │ tools/ resources/ policy/ │ │ read + subscribable consent · idempotency │ │ mutating account/quotes · audit (JSONL) │ │ │ │ streaming/ - change-detection poller + dispatcher │ │ types.py · config.py - Pydantic schemas: source of │ │ truth for data + config │ │ │ └──────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────────────────┐ │ │ │ adapter/ MT5Client │ │ one terminal connection · broker-TZ inference · │ │ type conversions · transparent reinit │ │ │ └──────────────────────────────────────────────────────────┘ │ ▼ MetaTrader 5 Python library -> broker terminal -> broker server

The module paths shown (tools/, resources/, policy/, streaming/, adapter/, types.py, config.py) all live under src/mt5_mcp/.

Contributing

Contributions are welcome, see CONTRIBUTING.md for the dev setup, test workflow, and project principles.

L

只显示了开头部分;其余内容请在仓库中阅读