mcp-mt5
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MT5_DATA | No | Path to terminal data folder (auto-detected if not set) | |
| MT5_EDITION | No | Edition: 'mt5' or 'mt4' | mt5 |
| MT5_INSTALL | No | Install dir containing terminal64.exe | C:\Program Files\MetaTrader 5 |
| MCP_MT5_PORT | No | Port for HTTP transport | 8931 |
| MCP_MT5_TOKEN | No | Bearer token for HTTP transport authentication | |
| MCP_MT5_TRANSPORT | No | Transport mode (e.g., 'http' for remote access) | |
| MT5_TERMINAL_HASH | No | 32-character terminal hash (auto-detected if not set) |
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_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_backtestB | 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_eaA | 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_deployC | Compile then deploy resulting .ex5/.ex4 to Experts/ in one shot. |
| extract_inputsC | Parse |
| gen_tester_inputsC | Generate a If |
| resolve_includesB | Recursively resolve |
| find_symbolB | Grep a symbol across MQL files, skipping comments and string literals. |
| code_metricsA | Compute LOC/function/nesting metrics for a file or every MQL file under a root. |
| extract_docB | Extract MetaEditor |
| find_magic_collisionC | Find duplicate magic-number assignments across the project. |
| syntax_checkA | 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_iniB | Sanity-check a tester.ini. If |
| format_mqlB | Format an MQL file via clang-format (treats source as C++). |
| format_checkB | Report whether a file needs formatting without writing it. |
| rename_symbolB | Rename a symbol across MQL files (whole-word match). |
| parse_optimizationA | [LEGACY] Best-effort binary .opt parser — unreliable, prefer read_optimization_csv with OptExport.mqh instrumented EA. Parse the latest |
| top_passesA | [LEGACY] Best-effort binary .opt parser — unreliable, prefer read_optimization_csv with OptExport.mqh instrumented EA. Sort optimization passes by criterion and return the top N. |
| read_optimization_csvA | Read optimization results from the CSV file generated by OptExport.mqh in Common Files folder. Args: run_id: The run ID specified during optimization run. top_n: Number of top passes to return. criterion: The column name to sort by (e.g. 'profit', 'sharpe_ratio', 'custom_metric'). descending: Set to True to sort from highest to lowest. |
| compare_reportsB | 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_sourcesC | 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_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 |
| start_jobA | Start a non-blocking backtest or optimization Strategy Tester run. Args: config: Absolute path to the tester .ini configuration file. kind: Execution type, either "backtest" or "optimize". |
| check_job_statusA | Check the status and elapsed duration of a background execution job. Args: job_id: The job ID returned by start_job. |
| get_job_resultB | Retrieve full structured results of a completed background job. Args: job_id: The job ID returned by start_job. |
| list_jobsA | List recent Strategy Tester execution jobs tracked in the database. Args: limit: Maximum number of jobs to return (default 20). status: Optional filter by job status (e.g. 'running', 'done', 'failed'). |
| instrument_ea_for_optB | Automatically instrument an MQL5 Expert Advisor (.mq5) file with OptExport.mqh logging. Args: ea_path: Absolute path to the .mq5 file. |
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
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ptacr/mcp-mt5'
If you have feedback or need assistance with the MCP directory API, please join our Discord server