MT-MCP Docs

How It Works

The path a request takes from your AI client to your MetaTrader terminal.

Four pieces sit between your AI client and your broker:

AI Client (Claude Desktop, Cursor, ...)
        │  MCP over HTTPS or stdio

Cloud Platform — API Gateway + Auth · MCP Server · License Service
        │  MT5: WebSocket   ·   MT4: HTTP long-poll

Your Terminal — MT4/MT5 + the MT-MCP Expert Advisor
        │  native MT4/MT5 protocol

Your Broker

Your AI client speaks MCP — the same protocol regardless of which client you use. It calls tools like get_tick or place_order; it never talks to your terminal directly.

The cloud platform authenticates the request, checks it against your subscription tier, and routes it to the session for your specific terminal. This is also where equity guards and alerts run continuously, independent of whether an AI client happens to be connected at that moment.

The Expert Advisor is a thin bridge with no trading logic of its own. It maintains an outbound connection to the cloud (WebSocket for MT5, HTTP long-polling for MT4, since MT4 has no native WebSocket support), executes the commands it's sent, and returns the result. If it loses its connection to the cloud, it does not execute anything buffered — connection loss means a safe, idle state, not a queue of pending trades firing later.

Your broker is wherever your terminal is already connected — MT-MCP works with any MT4/MT5-compatible broker, since the EA talks to the terminal, not the broker directly.

Why outbound-only

The EA always initiates the connection outward to the cloud; nothing connects inbound to your terminal. That's what makes the single-file install possible — no port forwarding, no local server, no firewall configuration on your end.

One terminal, one active session

A license key can cover multiple terminal seats depending on your plan, but each terminal holds exactly one active session at a time. If the same terminal connects twice, the newer connection takes over and the older one is dropped — so a stale connection never silently continues to receive commands.

On this page