Introduction
What MTContext is and how this documentation is organized.
MTContext bridges MetaTrader 4 and 5 terminals to the Model Context Protocol (MCP). Install one Expert Advisor file on your terminal, connect any MCP-compatible AI client, and the client can read market data, manage positions, and — with the right license — execute trades through natural language.
This is different from most MT4/5-to-AI bridges, which require running a local Python process and an MCP server on the same machine as the terminal. MTContext's Expert Advisor connects outbound to a hosted cloud server, so any MCP client anywhere can reach it without installing anything beyond the EA and, for stdio-only clients, a small connector.
Fast path (5-10 minutes)
- Generate a terminal key in the dashboard.
- Install and attach the MTContext EA in MT4/MT5.
- Enter the terminal key in the EA inputs and wait until the dashboard shows connected.
- Add MTContext to your AI client using the Setup guide for that client.
- Run a quick verification prompt: "What's the current EURUSD price?"
If step 5 returns a live quote, your full path (client -> MCP -> gateway -> terminal) is working.
Where to go next
Start with Overview for what you can actually ask your AI client to do. Then follow Setup for your specific client — Claude Desktop, Claude Code, Cursor, or a generic MCP client. Once connected, Tool Reference documents every tool the server exposes, generated directly from the server's tool schemas so it never drifts from what's actually deployed. Building a server-side integration instead of connecting an AI client? The same capabilities are available as a plain REST API. Changelog tracks what changed release to release.
If you want deeper system context (components, data flow, trust boundaries), read Architecture.
Two ways to connect
Hosted (recommended). Use the MTContext hosted server over HTTPS with a terminal-scoped API key. No local server process to run. This is what the setup guides assume by default.
Self-hosted. Run the gateway and MCP server yourself and connect over stdio. Useful for local development or if you need full control over the infrastructure. See the self-hosted section of each setup guide.
MCP or REST?
Both paths reach the same cloud platform and the same terminal. Use MCP (the guides above) when an AI client is doing the asking. Use the REST API when you're writing your own script or backend integration and don't need an AI client in the loop — same capabilities, same subscription tiers, plain HTTPS instead of the MCP protocol.
Safety model at a glance
- Read tools are non-mutating and safe to call freely.
- Trade-affecting tools default to
dry_run: true. - Live execution requires explicit
dry_run: falseplus trading enabled on both subscription capability and terminal settings. - Terminal keys are durable credentials. Revoke immediately if exposed.