MT5 MCP Server
Connect your MetaTrader 5 terminal to Claude, Cursor, and any AI tool that supports the Model Context Protocol.
Ask your AI to check prices, analyze charts, view your positions, calculate indicators, and even execute trades -- all from natural language.
Quick Start (2 minutes)
Requirements: Windows + MetaTrader 5 terminal running + Python 3.10+
pip install mt5-mcp
Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"mt5": {
"command": "mt5-mcp"
}
}
}
Restart Claude Desktop. Done. Ask Claude: "What's the current EURUSD price?"
What Can You Do?
Market Data (read-only)
- "What's the EURUSD price?" -- real-time bid/ask/spread
- "Show me XAUUSD H4 bars" -- OHLCV historical data
- "List available symbols" -- all symbols in your Market Watch
- "Symbol info for US30" -- contract size, lot limits, swap rates
Account Info (read-only)
- "What's my balance?" -- balance, equity, margin, leverage
- "Show my open positions" -- P&L, entry prices, SL/TP
- "Any pending orders?" -- limit/stop orders
- "My trade history this week" -- closed trades with P&L
Technical Indicators (computed locally)
- "RSI on EURUSD H1" -- RSI with overbought/oversold zones
- "MACD on XAUUSD H4" -- MACD line, signal, histogram, crossovers
- "ATR on GBPUSD M15" -- Average True Range in pips
- "Bollinger Bands on EURUSD D1" -- upper/middle/lower with %B
- "SMA 200 on US30 H1" -- Simple Moving Average
- "EMA 50 on BTCUSD H4" -- Exponential Moving Average
Terminal & EAs (read-only)
- "What EAs do I have installed?" -- list Expert Advisors
- "Show me the EA logs from today" -- read EA log output
- "What's in my EA config?" -- read .set parameter files
- "Show terminal journal" -- connection events, errors
Analytics (computed from history)
- "My trading stats this month" -- win rate, PF, drawdown, expectancy
- "P&L by symbol" -- which pairs make/lose money
- "When do I trade best?" -- P&L by day of week and hour
- "Check if I can buy 1 lot EURUSD" -- margin validation without executing
- "Analyze EURUSD tick spread" -- tick-by-tick spread and frequency analysis
Trading (opt-in, disabled by default)
- "Buy 0.1 lots EURUSD with SL at 1.0800" -- market orders
- "Close position #12345" -- close by ticket
- "Move SL to 1.0850 on position #12345" -- modify SL/TP
Tools Reference
Enabling Trading
Trading tools are disabled by default for safety. To enable:
{
"mcpServers": {
"mt5": {
"command": "mt5-mcp",
"env": {
"MT5_MCP_TRADING_ENABLED": "true"
}
}
}
}
WARNING: With trading enabled, your AI can execute real trades on your real account. Use with caution.
Platform Support
The MetaTrader5 Python package uses Windows IPC (named pipes) to communicate with the MT5 terminal, so native support is Windows-only. Docker support for Mac/Linux is planned.
How It Works
MT5 Terminal (running on your PC)
|
| MetaTrader5 Python package (Windows IPC)
|
MT5 MCP Server (this package)
|
| Model Context Protocol (stdio)
|
Claude / Cursor / Any MCP Client
All data stays on your machine. No cloud, no accounts, no API keys.
Development
git clone https://github.com/mrblacksheep91/mt5-mcp.git
cd mt5-mcp
pip install -e ".[dev]"
pytest
License
MIT
Credits
Built by Innova Trading -- AI-powered trading analysis platform.