Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MT5_DATANoAuto-detected AppData terminal folder (%APPDATA%\MetaQuotes\Terminal\<hash>)
MT5_EDITIONNoSet to 'mt4' for MetaTrader 4mt5
MT5_INSTALLNoInstall dir containing terminal64.exeC:\Program Files\MetaTrader 5
MT5_TERMINAL_HASHNo32-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

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
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 Include/). Defaults to terminal MQL root. log_file: Optional explicit log path. Defaults to .log. timeout_sec: Subprocess timeout.

Returns: returncode, structured errors/warnings lists, result_errors/result_warnings, log_path, log_excerpt (last 80 lines), cmd.

run_backtestA

Launch terminal with /config:<tester.ini>.

Args: config: Absolute path to tester.ini. wait: Block until terminal exits (requires ShutdownTerminal=1 in ini). timeout_sec: Wait timeout. portable: Pass /portable flag.

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 Section.Key → value (e.g. {"Tester.Symbol": "EURUSD", "Tester.FromDate": "2025.01.01"}).

Returns dict listing applied + skipped keys.

compile_and_deployA

Compile then deploy resulting .ex5/.ex4 to Experts/ in one shot.

extract_inputsB

Parse input <type> <name> = <default>; declarations from a source file.

gen_tester_inputsB

Generate a [TesterInputs] block from EA inputs.

If write_to points at a tester.ini, the block is appended/replaced in-place.

resolve_includesC

Recursively resolve #include directives. Reports unresolved files.

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 //+--+ //| ... +--+ doc blocks from a source file.

find_magic_collisionC

Find duplicate magic-number assignments across the project.

syntax_checkB

Compile a source via MetaEditor's syntax-only mode (/s) and return diagnostics.

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 source given, cross-check inputs vs EA declarations.

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). dry_run=True previews only.

parse_optimizationB

Parse the latest .opt file in the Tester folder, or one given by path.

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 dest.

list_snapshotsB

List all snapshot folders under dest.

select_terminalA

Switch the active terminal data folder for this session.

Provide one of: origin (install path stored in origin.txt), hash (32-char folder name), or install (auto-scan for the matching origin).

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 ok: true only if compilation, deployment, run, and the journal scan all pass.

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 dry_run=False to write.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
livelog_resourceLatest contents of MQL5/Files/LiveLog.txt — clients can re-read for polling updates.
journal_resourceLatest daily MT5 journal log.
tester_log_resourceLatest 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