mt4ctl
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MT4CTL_CONFIG | No | Path to the terminals.yaml configuration file. Defaults to ~/.config/mt4ctl/terminals.yaml or ./terminals.yaml. |
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 |
|---|---|
| mt4_listA | List configured terminals with host, account, and environment. Read-only and offline (no SSH). Use this first to learn which terminal ids exist before calling status/logs/control. |
| mt4_statusA | Report health of one terminal or all of them. Queries hosts concurrently and shows, per terminal: systemd service state,
broker connection (per-terminal, via socket attribution), and how long since
the log was last written. Args: terminal: a terminal id, or "all" (default). |
| mt4_logsA | Return the tail of a terminal's newest log file. Args: terminal: terminal id. pattern: optional case-insensitive regex to grep (e.g. "login|error"). lines: number of trailing lines to return (1-1000). |
| mt4_controlA | Start, stop, or restart a terminal's systemd unit. Mutating a live terminal requires confirm=true. Args: terminal: terminal id. action: one of "start", "stop", "restart". confirm: must be true to act on a terminal tagged env=live. |
| mt4_loginA | Perform a one-time headless login so a migrated terminal can auto-reconnect. Needed when a terminal was copied to a new host: MetaTrader's saved password is machine-bound and must be re-entered once. After this succeeds the unit auto-logins on every restart. Live terminals require confirm=true. Args: terminal: terminal id. server: broker server name, e.g. "ExampleBroker-Demo". account: login number; defaults to the terminal's configured account. password: explicit password; otherwise resolved from env/secrets file. confirm: must be true to act on a terminal tagged env=live. |
| mt4_screenshotA | Capture a screenshot of a terminal's window (PNG). Useful to visually confirm the chart, the AutoTrading state, and the EA smiley. On shared-display hosts the target window is raised first. Args: terminal: terminal id. |
| mt4_doctorA | Diagnose the mt4ctl setup without mutating anything. Checks the registry, the secrets-file permissions, and — per host — SSH
reachability, required remote tools, systemd units, and data directories.
Run this when a terminal is unexpectedly |
| mt4_ea_listA | List the expert advisors (strategies) attached to terminals. For a single terminal, lists every attached EA; for "all", shows the count per terminal. Read-only (parses the terminal's chart files). Args: terminal: a terminal id, or "all" (default). |
| mt4_autotradingA | Report whether algo-trading is enabled — terminal master switch + per-EA. Shows the terminal-level AutoTrading button (from terminal.ini) and how many attached experts have live-trading enabled. Flags terminals whose master is off (nothing trades) or whose experts have non-uniform/disabled flags. Note: the per-EA live-trading flag is a best-effort decode of the MT4 chart-expert bitmask; the terminal master switch is authoritative. Args: terminal: a terminal id, or "all" (default). |
| mt4_infoA | Report each terminal's build, broker server, and last broker ping. Read-only (parsed from the terminal's log). Useful to confirm what build and broker a terminal is on and its connection latency. Args: terminal: a terminal id, or "all" (default). |
| mt4_deployA | Deploy a strategy bundle to a terminal — idempotent, managed-subset. Pushes pre-built charts + experts so the terminal's managed files match the bundle, while leaving foreign files (e.g. a watchdog's chart) untouched. This is apply-only: it does NOT select strategies, set lots/magic, generate charts, or compile — the caller owns the bundle's contents.
Always run with dry_run=true first to preview the add/update/remove/foreign plan. Re-running the same bundle is a no-op (reports "no changes"). A terminal tagged env=live requires confirm=true. There is no rollback command: to recover, re-deploy the previous bundle (a pre-apply backup is also retained and is restored automatically if an apply fails). reset_market_watch deletes symbols.sel in the stopped window (backed up first) so MT4 rebuilds Market Watch on the deploy's own start — caps unbounded symbol carry-over; it forces a stop/start cycle even with no file changes. After the restart, verify polls up to verify_timeout seconds rather than taking a single snapshot, so normal reconnect timing is not reported as a failed deploy. Args: terminal: terminal id. bundle: local bundle directory path. dry_run: preview the plan without changing anything (no lock, no upload). confirm: must be true to deploy to a terminal tagged env=live. reset_market_watch: rebuild Market Watch by deleting symbols.sel while stopped. verify_timeout: seconds to poll post-restart health before reporting (default ~120). |
| mt4_adoptA | Take an already-running terminal under mt4ctl management (first cutover). On a terminal whose strategies were NOT placed by mt4ctl, the first This is RECORDS-ONLY: it changes NOTHING — no upload, no restart, no preview. It is bundle-scoped (foreign files like a watchdog's chart stay foreign) and requires every bundle file to already be present on the host (the premise is the farm runs this bundle; a missing file is refused). A live terminal needs confirm=true.
Args: terminal: terminal id. bundle: local bundle directory path. confirm: must be true to adopt a terminal tagged env=live. |
| mt4_verifyA | Poll a terminal until it is healthy (service active + broker connected) or times out. Use after any restart to wait out the broker reconnect instead of guessing: instead of one snapshot it polls and reports the terminal's state at timeout, so a real failure is distinguishable from normal startup timing. Read-only. Args: terminal: terminal id. timeout: seconds to poll before reporting (default ~120). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- 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/ak40u/mt4ctl'
If you have feedback or need assistance with the MCP directory API, please join our Discord server