mcp-mt5
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MT5_DATA | No | Auto-detected AppData terminal folder (%APPDATA%\MetaQuotes\Terminal\<hash>) | |
| MT5_EDITION | No | Set to 'mt4' for MetaTrader 4 | mt5 |
| MT5_INSTALL | No | Install dir containing terminal64.exe | C:\Program Files\MetaTrader 5 |
| MT5_TERMINAL_HASH | No | 32-char folder name for terminal data |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| env_infoB | Resolve and report MT4/5 paths, terminal hash, and missing-component issues. |
| list_terminalsA | Enumerate all MetaTrader terminal data folders under %APPDATA%\MetaQuotes\Terminal. |
| compileA | Compile a .mq4/.mq5/.mqh source via MetaEditor CLI. Args:
source: Absolute path to the source file.
include: Optional MQL root override (parent of Returns: returncode, structured |
| run_backtestA | Launch terminal with /config:<tester.ini>. Args:
config: Absolute path to tester.ini.
wait: Block until terminal exits (requires Returns: returncode, elapsed_sec, latest_tester_log path. |
| kill_terminalA | Force-kill all running terminal processes for the configured edition. |
| tail_logA | Read last N lines from terminal logs. Args: mode: "live" (Files/LiveLog.txt), "journal" (Logs/YYYYMMDD.log), "tester" (latest tester log). lines: Tail line count. date: Override YYYYMMDD for journal mode. structured: Parse journal lines into ts/source/message records. |
| deploy_eaB | Copy compiled .ex4/.ex5 binary into Experts/. Args: source_ex: Path to compiled .ex4/.ex5. name: Optional rename target. |
| install_includeB | Copy a .mqh into the terminal Include folder (e.g. for LiveLog.mqh). Args: source: Absolute path to source .mqh. target_name: Optional rename. |
| list_expertsC | List compiled EAs in Experts/. |
| read_tester_reportB | Locate and parse latest MT5 tester HTML report. Args: path: Explicit report path. If omitted, find latest *.htm under Tester/. raw_truncate: Max chars of raw HTML returned. |
| patch_tester_iniA | Update fields in a tester.ini file in-place. Args:
config: Path to tester.ini.
updates: Mapping of Returns dict listing applied + skipped keys. |
| compile_and_deployA | Compile then deploy resulting .ex5/.ex4 to Experts/ in one shot. |
| extract_inputsB | Parse |
| gen_tester_inputsB | Generate a If |
| resolve_includesC | Recursively resolve |
| find_symbolC | Grep a symbol across MQL files, skipping comments and string literals. |
| code_metricsC | Compute LOC/function/nesting metrics for a file or every MQL file under a root. |
| extract_docC | Extract MetaEditor |
| find_magic_collisionC | Find duplicate magic-number assignments across the project. |
| syntax_checkB | Compile a source via MetaEditor's syntax-only mode ( |
| lint_basicC | Run structural lint rules (missing handlers, unused inputs, hardcoded magic/symbol). |
| check_deprecatedC | Flag MT4-style deprecated API calls in MT5 source. |
| validate_tester_iniA | Sanity-check a tester.ini. If |
| format_mqlC | Format an MQL file via clang-format (treats source as C++). |
| format_checkB | Report whether a file needs formatting without writing it. |
| rename_symbolC | Rename a symbol across MQL files (whole-word match). |
| parse_optimizationB | Parse the latest |
| top_passesC | Sort optimization passes by criterion and return the top N. |
| compare_reportsA | Diff two MT5 tester HTML reports key-by-key with absolute and percent deltas. |
| regression_checkC | Verify candidate report stays within guard thresholds vs baseline. |
| snapshot_sourcesB | Freeze a copy of source files into a timestamped folder under |
| list_snapshotsB | List all snapshot folders under |
| select_terminalA | Switch the active terminal data folder for this session. Provide one of: Subsequent tool calls will use the new layout until the server restarts. |
| smoke_testB | Compile, deploy, run a 1-day headless backtest, and scan the journal for runtime errors. Returns |
| extract_functionB | Extract a contiguous block of lines into a new helper function. Brace-counting + regex param detection — not a full AST parser. Returns the
proposed helper, call site, and parameter list. Set |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| livelog_resource | Latest contents of MQL5/Files/LiveLog.txt — clients can re-read for polling updates. |
| journal_resource | Latest daily MT5 journal log. |
| tester_log_resource | Latest Strategy Tester journal log. |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PHUICMT/mcp-mt5'
If you have feedback or need assistance with the MCP directory API, please join our Discord server