# MetaTrader 5 MCP Bridge

Lets an agent read a MetaTrader 5 account and place trades through it. Every order can wait for your approval first.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6
- Author: vincentwongso
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/vincentwongso/mt5-trading-mcp
- Updated: 2026-10-19
- HTML: https://affpapa.org/en/nevibecode/mcp/metatrader-5-mcp-bridge

## What it does

The server runs locally, beside your agent. No cloud, no telemetry. Twelve read-only tools cover the account, quotes, positions, orders, history, OHLC bars, broker margin estimates and native chart screenshots. None of them ask for consent.

Four tools change state: `place_order`, `modify_order`, `cancel_order`, `close_position`. Each one goes through preflight checks, an opt-in consent gate, idempotency and an append-only audit log. That gives you a replayable record of what the agent did. Three subscribable resources — `account://`, `positions://` and `quotes://{symbol}` — push change notifications.

This places real orders with irreversible fills. Test on a demo account first. Windows needs Python 3.10+ and AlgoTrading switched on in the terminal. On Linux everything runs in Docker, and chart screenshots are unavailable there because they rely on the `AgentScreenshot` MQL5 Expert Advisor inside a GUI terminal. Two Claude skills ship with it: `mt5-market-data` and `mt5-trading`.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `MT5_LOGIN`, `MT5_PASSWORD`, `MT5_SERVER` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env MT5_LOGIN=<MT5_LOGIN> --env MT5_PASSWORD=<MT5_PASSWORD> --env MT5_SERVER=<MT5_SERVER> --transport stdio metatrader-5-mcp-bridge -- uvx mt5-trading-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mt5-trading-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add metatrader-5-mcp-bridge --env MT5_LOGIN=<MT5_LOGIN> --env MT5_PASSWORD=<MT5_PASSWORD> --env MT5_SERVER=<MT5_SERVER> -- uvx mt5-trading-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mt5-trading-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "metatrader-5-mcp-bridge": {
            "command": "uvx",
            "args": [
                "mt5-trading-mcp"
            ],
            "env": {
                "MT5_LOGIN": "<MT5_LOGIN>",
                "MT5_PASSWORD": "<MT5_PASSWORD>",
                "MT5_SERVER": "<MT5_SERVER>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mt5-trading-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "metatrader-5-mcp-bridge": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "mt5-trading-mcp"
            ],
            "env": {
                "MT5_LOGIN": "<MT5_LOGIN>",
                "MT5_PASSWORD": "<MT5_PASSWORD>",
                "MT5_SERVER": "<MT5_SERVER>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mt5-trading-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e MT5_LOGIN=<MT5_LOGIN> -e MT5_PASSWORD=<MT5_PASSWORD> -e MT5_SERVER=<MT5_SERVER> metatrader-5-mcp-bridge uvx mt5-trading-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mt5-trading-mcp <command>

## When to use it
- check balance and open positions without opening the terminal
- place an order described in plain words and approve it by hand
- capture an annotated chart for the agent to read
- get a broker margin estimate before entering a trade
- reconstruct from the audit log what the agent did to the account

## Example prompts
- Show my open positions and account balance.
- Place a 0.01-lot limit order on EURUSD and show me the parameters before I approve.
- Take a screenshot of the EURUSD H1 chart and mark the support level.

## Similar
- [mql5-indicator-patterns](https://affpapa.org/en/nevibecode/skills/mql5-indicator-patterns.md) — skill · 497 installs
- [memory-bridge](https://affpapa.org/en/nevibecode/skills/memory-bridge.md) — skill · 2400 installs
- [okx-cex-trade](https://affpapa.org/en/nevibecode/skills/okx-cex-trade.md) — skill · 10300 installs
- [okx-cex-portfolio](https://affpapa.org/en/nevibecode/skills/okx-cex-portfolio.md) — skill · 10100 installs
- [hyperliquid](https://affpapa.org/en/nevibecode/skills/hyperliquid.md) — skill · 8700 installs
- [cc-connect-ai-bridge](https://affpapa.org/en/nevibecode/skills/cc-connect-ai-bridge.md) — skill · 935 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
