LabscoMCP early access ↗
ariadngMCP SERVER

MetaTrader MCP Server

Trade and read markets on MetaTrader 5 from an assistant — account state, live prices, candles, market and pending orders, and bulk position closing.

by ariadng ↗Trading Execution & BrokerageCommunity

LABSCO SUMMARY

"Close all profitable positions" is one call, not twelve.

The bulk operations are what an assistant is actually good for here — filtering by symbol, by profitability, or across the whole account, where doing it by hand means clicking through a list while the market moves.

What it is

A bridge between an AI assistant and the MetaTrader 5 terminal. The same package also ships a REST API server and a WebSocket quote stream, so the connection can be used outside MCP too.

What you get

  • Account and market data: get_account_info for balance, equity, profit, margin level, leverage and currency; get_symbols, get_symbol_info, get_symbol_price for the current bid and ask, and get_candles_latest and get_candles_by_date for OHLCV history
  • Placing orders: place_market_order for instant buy and sell, place_pending_order for limit and stop orders, modify_position for stop loss and take profit, and modify_pending_order
  • Positions: get_all_positions, get_positions_by_symbol, get_positions_by_id, close_position, close_all_positions, close_all_positions_by_symbol, and the two that make a sentence into an action — close_all_profitable_positions and close_all_losing_positions
  • Pending orders: get_all_pending_orders, get_pending_orders_by_symbol, cancel_pending_order, cancel_all_pending_orders and cancel_pending_orders_by_symbol
  • History: get_deals for completed trades and get_orders for order records
  • A WebSocket quote server streaming tick data for a configurable symbol list, and a REST API for the same operations

Requirements

Python 3.10 or higher, the MetaTrader 5 terminal, and an MT5 account — demo or live — with its login number, password and server name. Install with pip install metatrader-mcp-server. Algorithmic trading must be enabled in the terminal: Tools > Options > Expert Advisors > Allow algorithmic trading. Then add it to your client config, or run metatrader-http-server for the REST interface or metatrader-quote-server for the WebSocket stream. Transport is selected with --transport or MCP_TRANSPORT, defaulting to sse on port 8080; the quote server defaults to port 8765. Credentials stay on your machine. Read the disclaimer before connecting a live account: trading carries a real risk of loss, the software is provided as-is with no liability accepted for outcomes, and you are responsible for every trade executed through it.

Setup effort

One command plus credentials — pip install metatrader-mcp-server, then supply credentials