MetaTrader 5 MCP Bridge
v1.4.2Let an AI agent read and trade a MetaTrader 5 account over MCP, behind a human-approval gate.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
ping
Health check - verifies the MT5 terminal is reachable. Returns ``{"ok": bool, "latency_ms": int, "via": str | None}``. ``via`` names the layer that answered (``terminal_info``, ``account_info``, or ``tick_probe``) and is omitted when ``ok`` is false. Cheap; agents should call this after idle periods or errors that smell like disconnection.
get_terminal_info
MT5 terminal connection state and broker TZ offset.
get_account_info
Balance, equity, margin, leverage, currency, margin mode.
get_quote
Current bid/ask for a symbol. Prepares the symbol in Market Watch if needed.
| Parameter | Type | Description |
|---|---|---|
symbol * | string |
get_symbols
List tradeable instruments, optionally filtered by category (e.g. 'Forex', 'Metals').
| Parameter | Type | Description |
|---|---|---|
category |
get_market_hours
Whether the given symbol's session is open right now. v1 limitation: ``is_open`` is derived from ``trade_mode`` (open when non-zero). ``next_open`` and ``next_close`` are always ``None`` in v1 - parsing ``symbol_info().sessions_quotes`` is scheduled for a later release. Agents needing precise session boundaries should consult their broker's published schedule.
| Parameter | Type | Description |
|---|---|---|
symbol * | string |
get_rates
OHLC bars for ``symbol`` at ``timeframe``, most recent first. ``timeframe``: one of ``M1``, ``M5``, ``M15``, ``M30``, ``H1``, ``H4``, ``D1``, ``W1``, ``MN1``. ``count`` is clamped to [1, 5000].
| Parameter | Type | Description |
|---|---|---|
count * | integer | |
symbol * | string | |
timeframe * | string |
calc_margin
Broker-authoritative margin for a hypothetical order. Wraps ``mt5.order_calc_margin``. If ``price`` is omitted, uses the current ask (buy) / bid (sell). Returned margin is in deposit currency.
| Parameter | Type | Description |
|---|---|---|
side * | string | |
symbol * | string | |
volume * | ||
price |
get_positions
Open positions, optionally filtered to a single symbol.
| Parameter | Type | Description |
|---|---|---|
symbol |
close_position
Close an open position in full or part by ticket.
| Parameter | Type | Description |
|---|---|---|
ticket * | integer | |
approval_confirmed | boolean | |
approval_request_id | ||
idempotency_key | ||
volume |
get_orders
Pending orders, optionally filtered to a single symbol.
| Parameter | Type | Description |
|---|---|---|
symbol |
place_order
Place a market or pending order. Optional SL / TP / deviation. When `policy.auto_approve_notional` is set > 0, orders whose notional is at or above it return an ApprovalPreview; retry with approval_confirmed=true and the same request fields to proceed. At the default of 0 the gate is off and orders auto-execute. Pass `idempotency_key` (UUIDv4 recommended) to dedupe retries within `idempotency.ttl_seconds`.
| Parameter | Type | Description |
|---|---|---|
side * | string | |
symbol * | string | |
type * | string | |
volume * | string | |
approval_confirmed | boolean | |
approval_request_id | ||
comment | ||
deviation | integer | |
idempotency_key | ||
price | ||
sl | ||
stop_limit_price | ||
tp |
modify_order
Modify SL/TP on a position or price/expiration on a pending order. When the consent gate is armed (`policy.auto_approve_notional` > 0), widening or removing an existing SL/TP requires approval; tightening always auto-approves. At the default of 0 the gate is off and every modify auto-executes.
| Parameter | Type | Description |
|---|---|---|
ticket * | integer | |
approval_confirmed | boolean | |
approval_request_id | ||
expiration | ||
idempotency_key | ||
price | ||
sl | ||
tp |
cancel_order
Cancel a pending order by ticket. No consent gate (reduces exposure).
| Parameter | Type | Description |
|---|---|---|
ticket * | integer | |
idempotency_key |
get_history
Closed deals (trades) within [from_ts, to_ts]. Timestamps must be ISO 8601 UTC.
| Parameter | Type | Description |
|---|---|---|
from_ts * | string | |
to_ts * | string | |
symbol |