← Back to MetaTrader 5 MCP Server
Install MetaTrader 5 MCP Server
Pick your client, copy the command, done.
Manual setup required. The maintainer's config contains paths only you know — edit the placeholders below before adding it to Claude Code.
1
Prepare the server locally
Run this once before adding it to Claude Code.
pip install -e .2
Register it in Claude Code
claude mcp add -e "MT5_LOGIN=${MT5_LOGIN}" -e "MT5_PASSWORD=${MT5_PASSWORD}" -e "MT5_SERVER=${MT5_SERVER}" -e "MT5_PATH=${MT5_PATH}" metatrader5-mcp -- metatrader5-mcp --login YOUR_MT5_LOGIN --password YOUR_MT5_PASSWORD --server YOUR_MT5_SERVER --path "C:\\Program Files\\MetaTrader 5\\terminal64.exe"Replace any placeholder paths in the command with the real path on your machine.
Required:
MT5_LOGINMT5_PASSWORDMT5_SERVERMT5_PATHEnvironment Variables
Set these before running MetaTrader 5 MCP Server.
VariableDescriptionRequired
MT5_LOGINTrading account numberYesMT5_PASSWORDTrading account passwordYesMT5_SERVERTrading server nameYesMT5_PATHPath to MT5 terminal executableYesAvailable Tools (5)
Once configured, MetaTrader 5 MCP Server gives your AI agent access to:
initialize_mt5Initializes the connection to the MetaTrader 5 terminal.get_account_infoRetrieves account balance, equity, margin, and profit.get_historical_dataRetrieves historical bar data (OHLCV) for a symbol.symboltimeframestart_dateend_datesend_orderSends a market or pending order to the trading platform.symbolvolumeorder_typepriceget_open_positionsRetrieves a list of currently open trading positions.Try It Out
After setup, try these prompts with your AI agent:
→What is my current account balance and equity?
→Get the last 100 hourly candles for EURUSD.
→Check if I have any open positions for Gold.
→Calculate the required margin for a 1.0 lot buy order on GBPUSD.
Prerequisites & system requirements
- An MCP-compatible client (Claude Code, Cursor, Windsurf, Claude Desktop, or Codex)
- Python 3.8+ with pip installed
MT5_LOGIN— Trading account numberMT5_PASSWORD— Trading account passwordMT5_SERVER— Trading server nameMT5_PATH— Path to MT5 terminal executable
Alternative installation methods
Pip
pip install -e .Poetry
poetry installKeep this setup from going cold
Save the docs, env vars, and workflow around MetaTrader 5 MCP Server in Conare so Claude Code, Codex, and Cursor remember it next time.