Python implementation of a Model Context Protocol (MCP) server that lets AI LLMs place trades through the MetaTrader 5 terminal.
https://github.com/ariadng/metatrader-mcp-serverYou've built the perfect trading algorithm. Your AI model spots opportunities, calculates risk, and generates precise trade signals. But then you're stuck manually executing trades in MetaTrader while your edge evaporates in real-time.
The MetaTrader MCP Server eliminates that bottleneck entirely. Your AI can now place trades directly through MetaTrader 5 using the Model Context Protocol - no manual intervention, no missed opportunities, no copy-paste errors.
Instead of wrestling with MetaTrader's Python API documentation and connection handling, you get a clean MCP interface that just works. The server handles all the MT5 complexity - terminal connections, order management, position tracking - while exposing simple tools your AI can use immediately.
pip install metatrader-mcp-server
Drop your MT5 credentials into Claude Desktop's config, and you're trading in minutes, not days.
Claude Desktop Integration: Perfect for interactive trading analysis. Your AI sees your account state, analyzes positions, and executes trades conversationally. Great for strategy development and manual oversight.
HTTP API Mode: Built for programmatic trading systems. Your Python scripts, web apps, or automated strategies can place trades through a clean REST API. Works with any LLM via Open WebUI - GPT-4, local models, whatever you prefer.
Momentum Trading: Your AI spots a breakout pattern, calculates position size based on account equity, and immediately places the trade with appropriate stop-loss levels. No delay, no slippage from manual execution.
Risk Management: AI monitors your open positions continuously. When drawdown hits your threshold, it automatically reduces position sizes or closes losing trades. Your rules execute exactly as programmed.
Multi-Symbol Strategies: Deploy pairs trading algorithms that simultaneously go long/short on correlated instruments. The server handles multiple orders atomically, ensuring your strategy executes as designed.
Backtesting to Live Trading: Run your strategy against historical data, then deploy the exact same logic to live markets. The MCP interface stays consistent whether you're backtesting or trading real money.
The server includes both MCP and HTTP modes because different use cases need different approaches. Interactive analysis works best through Claude Desktop's MCP integration. Automated systems prefer the HTTP API's programmatic interface.
FastAPI handles the HTTP layer with automatic OpenAPI documentation. Pydantic ensures type safety for all trading parameters. The MetaTrader5 Python library provides rock-solid terminal connectivity.
pip install metatrader-mcp-server
The server launches MT5 automatically and maintains the connection. Your AI gets immediate access to account data, position management, and order execution.
Ready to automate your trading execution? The MetaTrader MCP Server bridges the gap between AI intelligence and market action - exactly where serious traders need it most.