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.
Requirements: Windows + MetaTrader 5 terminal running + Python 3.10+
pip install mt5-mcpAdd 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'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
- "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
- "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
- "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
- "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
- "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
| Tool | Description | Category |
|---|---|---|
get_tick |
Current bid/ask/spread | Market |
get_bars |
OHLCV historical bars | Market |
get_symbols |
Available symbols list | Market |
get_symbol_info |
Symbol details (lots, spread, swap) | Market |
get_account_info |
Balance, equity, margin | Account |
get_positions |
Open positions with P&L | Account |
get_orders |
Pending orders | Account |
get_trade_history |
Closed trades history | Account |
get_rsi |
Relative Strength Index | Indicator |
get_macd |
MACD + Signal + Histogram | Indicator |
get_atr |
Average True Range | Indicator |
get_sma |
Simple Moving Average | Indicator |
get_ema |
Exponential Moving Average | Indicator |
get_bollinger |
Bollinger Bands | Indicator |
get_terminal_info |
Version, paths, trading status | Terminal |
list_experts |
Installed EAs with sizes/dates | Terminal |
read_ea_logs |
EA log output (filterable) | Terminal |
read_ea_config |
EA .set parameter files | Terminal |
get_journal |
Terminal journal (errors, events) | Terminal |
get_trade_stats |
Win rate, PF, drawdown, streaks | Analytics |
get_pnl_by_symbol |
P&L breakdown per instrument | Analytics |
get_pnl_by_time |
P&L by day of week and hour | Analytics |
check_order |
Validate order without executing | Analytics |
get_tick_history |
Tick-by-tick spread analysis | Analytics |
place_order |
Market order (buy/sell) | Trading |
close_position |
Close by ticket | Trading |
modify_position |
Change SL/TP | 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.
| OS | Method | Status |
|---|---|---|
| Windows | Native (MetaTrader5 Python package) | Supported |
| macOS | Docker (coming soon) | Planned |
| Linux | Docker (coming soon) | Planned |
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.
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.
git clone https://github.com/mrblacksheep91/mt5-mcp.git
cd mt5-mcp
pip install -e ".[dev]"
pytestMIT
Built by Innova Trading -- AI-powered trading analysis platform.