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 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| 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_infoA | 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 one MQL source with MetaEditor and return structured diagnostics.
|
| run_backtestA | Run a Strategy Tester backtest headlessly from a tester.ini and wait for it to finish. Requires the EA to be deployed first ( |
| start_backtestA | Launch a backtest in the background and return immediately with a Poll |
| get_backtestA | Status of a background backtest (running / completed / timeout / cancelled) with report path and journal notes when done; without run_id, lists all runs newest first. |
| cancel_backtestA | Kill the terminal of a running background backtest. No report is produced for a cancelled run. |
| kill_terminalA | Force-kill terminal processes launched by this server (run_backtest / smoke_test). By default only PIDs this server started are killed, so a live-trading terminal on the
same machine is never touched. Pass |
| tail_logA | Tail a MetaTrader log: the EA's LiveLog.txt, the daily Experts journal, or the latest tester journal. Use mode="tester" right after a backtest to see runtime errors and the effective test period. |
| list_expertsA | List compiled EAs in Experts/ (defaults to *.ex5 for MT5, *.ex4 for MT4). |
| read_tester_reportA | Parse a Strategy Tester HTML report (MT5 or MT4) into Prefer passing the |
| patch_tester_iniA | Set keys in a tester.ini in place, keeping the file's encoding and other lines.
|
| compile_and_deployA | Compile a source and, if it succeeds, copy the fresh binary into the terminal's Experts/ folder. Use this before |
| deployA | Copy a compiled EA into the terminal's Experts/ folder or a .mqh header into Include/, chosen by extension. Overwrites an existing file of the same name. Use |
| inspect_sourceA | Read-only facts about MQL source: Replaces extract_inputs / resolve_includes / extract_doc / find_symbol / find_magic_collision. |
| analyze_mqlA | Static checks on MQL source without compiling: structural lint (missing OnInit/OnTick, unused inputs, hardcoded magic/symbol), MT4-style deprecated API calls with MT5 replacements, and size/nesting metrics. Replaces lint_basic / check_deprecated / code_metrics. Use |
| read_optimizationA | Read an MT5 optimisation cache (.opt): header, optimised inputs, pass count and the top N passes by Ranking uses every pass in the cache. The best pass of a genetic run is a biased sample; prefer robust neighbourhoods over the single top row. Replaces parse_optimization / top_passes. |
| compare_reportsA | Diff two tester reports key by key (absolute and percent deltas), optionally checking guard thresholds. With |
| gen_tester_inputsA | Generate a If |
| validate_tester_iniA | Sanity-check a tester.ini. If |
| format_mqlA | Format an MQL file with clang-format (MQL literals such as D'…' and Default is a dry run reporting whether the file would change; pass |
| rename_symbolA | Rename a symbol across MQL files (whole-word match). |
| snapshot_sourcesA | Freeze a copy of source files into a timestamped folder under |
| list_snapshotsA | 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_testA | One-call health check for an EA: compile, deploy, run a 1-day headless backtest, scan the journal. Catches problems that compile cleanly but fail at runtime (OnInit errors, array out of range,
divide by zero). |
| extract_functionA | 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 |
| syntax_checkA | DEPRECATED (removed in 0.6.0): use compile(source, syntax_only=true). |
| deploy_eaA | DEPRECATED (removed in 0.6.0): use deploy(file, name). |
| install_includeA | DEPRECATED (removed in 0.6.0): use deploy(file, name) with a .mqh file. |
| extract_inputsA | DEPRECATED (removed in 0.6.0): use inspect_source(source, aspects=["inputs"]). |
| resolve_includesC | DEPRECATED (removed in 0.6.0): use inspect_source(source, aspects=["includes"]). |
| extract_docA | DEPRECATED (removed in 0.6.0): use inspect_source(source, aspects=["docs"]). |
| find_symbolA | DEPRECATED (removed in 0.6.0): use inspect_source(root=..., symbol=...). |
| find_magic_collisionA | DEPRECATED (removed in 0.6.0): use inspect_source(root=..., aspects=["magic"]). |
| lint_basicA | DEPRECATED (removed in 0.6.0): use analyze_mql(source, checks=["lint"]). |
| check_deprecatedA | DEPRECATED (removed in 0.6.0): use analyze_mql(source, checks=["deprecated"]). |
| code_metricsA | DEPRECATED (removed in 0.6.0): use analyze_mql(source or root, checks=["metrics"]). |
| format_checkA | DEPRECATED (removed in 0.6.0): use format_mql(source) (dry run by default). |
| parse_optimizationD | DEPRECATED (removed in 0.6.0): use read_optimization(...). |
| top_passesA | DEPRECATED (removed in 0.6.0): use read_optimization(criterion=..., top_n=...). |
| regression_checkA | DEPRECATED (removed in 0.6.0): use compare_reports(baseline, candidate, guards=...). |
| list_backtestsA | DEPRECATED (removed in 0.6.0): use get_backtest() without run_id. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 43 tools
The active tools are mostly distinct, but the 16 deprecated aliases duplicate the same operations as active tools (e.g., extract_inputs vs inspect_source, parse_optimization vs read_optimization), creating confusion. Some overlap also exists between compile/compile_and_deploy/deploy and run_backtest/start_backtest/smoke_test, though descriptions help clarify boundaries.
Most tool names follow a clear verb_noun pattern (list_snapshots, run_backtest, read_tester_report, validate_tester_ini). Minor deviations like env_info, compile_and_deploy, and smoke_test are understandable exceptions, and deprecated names also generally follow similar conventions.
With 43 tools, the surface is far too large, even though 16 are deprecated. The active count of 27 is still heavy, and several active tools are composites (compile_and_deploy, smoke_test) that could be consolidated without losing capability.
The server covers the major MT5 automation lifecycle: terminal selection, compile/deploy, backtest launch and monitoring, report parsing, source inspection, static analysis, formatting, optimization reading, and snapshots. Minor gaps exist (no explicit tester.ini creation tool, no undeploy/removal tool), but workflows do not hit dead ends.