MT5 MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MT5 MCP ServerWhat's my account equity and current open positions?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MT5 MCP Server
A local MCP server that connects a MetaTrader 5 terminal to Claude. It reads market data, account state and history, captures chart screenshots, and can send live orders.
Requirements
The MetaTrader 5 terminal must be running
Tools → Options → Expert Advisors → "Allow algorithmic trading" must be enabled
An account must be logged in
If the terminal is closed, every tool returns MT5 initialize failed — open it and retry.
Related MCP server: metatrader-mcp
Install
uv venv --python 3.12 .venv
uv pip install --python .venv/Scripts/python.exe -r requirements.txtThen adjust the paths in .mcp.json and restart Claude Code.
Tools (20)
Market data
Tool | What it does |
| Terminal build, connection, account, balance, equity, margin, DEMO/REAL |
| Search symbols — wildcards supported ( |
| Digits, point, spread, contract size, lot limits, margin and swap rates |
| Live bid/ask and spread for one or more symbols |
| OHLCV from M1 to MN1, by count or by date range |
| Raw bid/ask tick stream, useful for backtesting |
Account
Tool | What it does |
| Open positions and total floating P/L |
| Active limit and stop orders |
| Closed trades with profit, commission and swap totals |
| Orders that were placed, cancelled or rejected |
| Margin and expected profit before sending anything (no order is placed) |
Screen capture
Tool | What it does |
| Open charts with symbol, timeframe and size |
| PNG of the terminal window or of a single chart |
screenshot does not come from the MetaTrader5 Python API — that API has no
screenshot function at all. It is built on the Windows PrintWindow call
(mt5_capture.py). It works on a background window, but
not on a minimised one.
Pass target='window' for the whole terminal, or target='XAUUSD,M30' for one
chart. Passing just 'XAUUSD' picks the largest chart for that symbol.
Trading — live
Tool | What it does |
| Market buy/sell, SL/TP as absolute price or in points |
| Buy/sell limit or stop, with optional expiry |
| Change SL/TP on an open position |
| Change price, SL or TP on a pending order |
| Full or partial close |
| Remove a pending order |
| Close everything, or only one symbol |
⚠️ There is no demo/real guard on the trading tools. Orders go to whichever account the terminal is logged into. The broker's filling mode is detected automatically and the symbol is added to Market Watch as needed.
CLI (trade.py)
The same tools without Claude, straight from the command line:
.venv/Scripts/python.exe trade.py buy XAUUSD 0.01 --sl-points 500 --tp-points 1000
.venv/Scripts/python.exe trade.py modify 10090941191 --sl 4345.56 --tp 4360.56
.venv/Scripts/python.exe trade.py close 10090941191
.venv/Scripts/python.exe trade.py close-all --symbol XAUUSD
.venv/Scripts/python.exe trade.py positions
.venv/Scripts/python.exe trade.py calc buy XAUUSD 0.01 --close-price 4360Run trade.py --help for every subcommand.
Time format
All time inputs are UTC: YYYY-MM-DD, YYYY-MM-DD HH:MM, or
YYYY-MM-DD HH:MM:SS. Output timestamps are UTC as well.
Configuration
These environment variables are optional in .mcp.json:
Variable | Purpose |
| Path to |
| Log into a different account (default: whatever the terminal already uses) |
Smoke test
.venv/Scripts/python.exe -c "import mt5_mcp_server as s; print(s.mt5_status()['account'])"This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Trade across 22+ exchanges and brokers from any MCP-capable AI agent, no install required.
Teamfight Tactics data & AI coaching for Claude and ChatGPT — 19 tools, built-in Riot key.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables comprehensive access to the MetaTrader 5 trading platform for retrieving market data, managing accounts, and executing trading operations. It provides 32 specialized tools for interacting with MT5 functionalities, including historical OHLCV data access, real-time position monitoring, and automated order management.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables users to capture real MetaTrader 5 chart snapshots with custom indicators and fetch market data through natural language in Claude Desktop.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MetaTrader 5 for market data, technical analysis, Fibonacci calculations, and trading via MCP clients such as Claude.MIT
- FlicenseAqualityDmaintenanceEnables Claude AI to perform forex trading operations and market data analysis through MetaTrader 5, including order placement, position management, and multi-timeframe candle data retrieval.16-