MetaTrader MCP Server
@ariadng
Model Context Protocol (MCP) to enable AI LLMs to trade using MetaTrader platform
概要
What is MetaTrader MCP Server?
MetaTrader MCP Server is a bridge that connects AI assistants (like Claude, ChatGPT) to the MetaTrader 5 trading platform, enabling natural language trading commands such as "Show me my account balance" or "Buy 0.01 lots of EUR/USD."
How to use MetaTrader MCP Server?
Install with pip install metatrader-mcp-server, enable algorithmic trading in MetaTrader 5 (Tools > Options > Expert Advisors > Allow algorithmic trading), then configure your AI client (e.g., Claude Desktop) with your MT5 login, password, and server. Use the command metatrader-mcp-server --login YOUR_LOGIN --password YOUR_PASSWORD --server YOUR_SERVER --transport stdio for local STDIO, or run the HTTP server (metatrader-http-server) for Open WebUI, the WebSocket quote server (metatrader-quote-server), or the remote SSE server.
Key features of MetaTrader MCP Server
- Natural language trading using plain English
- Multi‑AI support (Claude Desktop, ChatGPT via Open WebUI)
- Full market access with real‑time prices and historical data
- Complete account control (balance, equity, margin, statistics)
- Order management: place, modify, and close orders
- Credentials stay on your machine (secure)
- Flexible interfaces: MCP, REST API, WebSocket stream
Use cases of MetaTrader MCP Server
- Traders automating their trading with AI assistants
- Developers building trading bots or analysis tools
- Analysts needing quick access to market data
- Anyone combining AI with financial markets
FAQ from MetaTrader MCP Server
What are the prerequisites?
Python 3.10 or higher, the MetaTrader 5 terminal installed, and a demo or live MT5 trading account (login, password, server name).
What transports or interfaces are supported?
Four options: local STDIO (for Claude Desktop), HTTP REST (for Open WebUI and ChatGPT), WebSocket for real‑time quotes, and SSE (remote MCP server) for connecting from a different machine.
How does the SSE remote server handle security?
The MCP protocol does not include authentication. When exposing the SSE server over a network, use a firewall, reverse proxy with authentication, or an SSH tunnel.
Is there any liability disclaimer?
Yes. Trading financial instruments involves significant risk of loss. The software is provided as‑is; developers accept no liability for trading losses. Users acknowledge they are responsible for all trades and use the software at their own risk.
Can I stream real‑time quotes?
Yes. The WebSocket Quote Server streams live tick data (bid, ask, spread, volume) from MetaTrader 5 to any WebSocket client, with configurable symbols and polling interval.