get_account_info
Get MetaTrader 4 account information
Reaches a MetaTrader 4 terminal — account state, prices, orders, positions, backtests and Expert Advisor editing.
LABSCO SUMMARY
Backtesting and remote Expert Advisor compilation are genuinely useful — the edit-compile-test loop in MT4 is miserable, and doing it from an editor is a real gain. But the same connection places market orders against a live account, and there is no read-only mode described. If you connect it, connect it to a demo account until you have watched what it does. The file-based fallback is a nice touch that says the author has seen the HTTP bridge fail mid-session.
A bridge to MetaTrader 4, connecting through an HTTP endpoint and a companion Expert Advisor running inside the terminal, so a server on one machine can drive MT4 on another.
A MetaTrader 4 terminal with the companion Expert Advisor installed, plus Node for the server. The two can be on different machines — their documented setup runs the server on Linux against MT4 on Windows.
Build from source — git clone https://github.com/8nite/metatrader-4-mcp.git
USE CASES
Edit, sync and compile remotely, with errors reported back.
Backtests with real configuration.
Balance, equity, margin and open positions.
Listed in project code.
get_account_infoGet MetaTrader 4 account information
get_market_dataGet current market data for a symbol
place_orderPlace a trading order in MetaTrader 4
get_positionsGet all open positions
close_positionClose an open position
get_historyGet trading history
run_backtestRun a backtest on an Expert Advisor
get_backtest_resultsGet results from the last backtest
list_expertsList available Expert Advisors for backtesting
get_backtest_statusGet the current status of a running backtest
sync_eaUpload EA file to MetaTrader 4 for compilation
compile_eaCompile an EA on MetaTrader 4 and get compilation results
list_local_easList EAs in the local development folders
sync_ea_from_fileSync an existing EA file to MetaTrader 4
BEFORE YOU INSTALL
14 tools registered in the project's code.
The documented client runs the server on your machine.
INSTALLATION
git clone https://github.com/8nite/metatrader-4-mcp.git
cd metatrader-4-mcp
npm install
npm run buildOn the Windows machine that runs MT4: copy the windows-server/ folder over, install Node.js, then run npm install and npm start inside that folder — the HTTP bridge starts on port 8080
Copy mcp/MCP_Ultimate.mq4 into your MT4 MQL4/Experts/ folder, compile it in MetaEditor, attach it to any chart, and make sure "Allow DLL imports" is enabled in MT4 settings
Add the configuration under MCP Clients to Claude Code, with the absolute path to dist/index.js in your clone and MT4_HOST set to the IP of your Windows machine
{
"mcpServers": {
"mt4-server": {
"command": "node",
"args": [
"<YOUR_PATH_TO_METATRADER_4_MCP>/dist/index.js"
],
"env": {
"MT4_HOST": "192.168.50.161",
"MT4_PORT": "8080"
}
}
}
}<YOUR_PATH_TO_METATRADER_4_MCP> is the folder you cloned and built. 192.168.50.161 is the author's own LAN address (the server's default) — set MT4_HOST to the IP of the Windows machine running the HTTP bridge. 8080 is the bridge's port.