get_account_infoLABSCO 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_infofor balance, equity, profit, margin level, leverage and currency;get_symbols,get_symbol_info,get_symbol_pricefor the current bid and ask, andget_candles_latestandget_candles_by_datefor OHLCV history - Placing orders:
place_market_orderfor instant buy and sell,place_pending_orderfor limit and stop orders,modify_positionfor stop loss and take profit, andmodify_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_positionsandclose_all_losing_positions - Pending orders:
get_all_pending_orders,get_pending_orders_by_symbol,cancel_pending_order,cancel_all_pending_ordersandcancel_pending_orders_by_symbol - History:
get_dealsfor completed trades andget_ordersfor 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
USE CASES
Checking where the account stands
Balance, equity, profit, margin level and leverage in one call, alongside the open positions they come from.
Taking profits across the book
Close every winning position at once, or every losing one, rather than working down the list by hand.
Placing an order from a sentence
Market orders execute immediately; pending limit and stop orders wait for the level, and both can be modified afterwards.
Looking at the data before deciding
Current bid and ask plus recent or date-ranged candles, so the analysis and the order happen in the same conversation.
Reviewing what you actually did
Historical deals and order records, which is the input for asking why a week went the way it did.
Streaming prices to something else
The WebSocket quote server pushes ticks for a configured symbol list, so a dashboard or a script can consume the same connection.
25 tools
Listed in project docs. Your client may show a different list.
get_symbolsget_symbol_priceget_candles_latestget_candles_by_dateget_symbol_infoplace_market_orderplace_pending_ordermodify_positionmodify_pending_orderget_all_positionsget_positions_by_symbolget_positions_by_idclose_positionclose_all_positionsclose_all_positions_by_symbolclose_all_profitable_positionsclose_all_losing_positionsget_all_pending_ordersget_pending_orders_by_symbolcancel_pending_ordercancel_all_pending_orderscancel_pending_orders_by_symbolget_dealsget_ordersBEFORE YOU INSTALL
What to know first
Tools you get
25 tools named in the project's documentation.
Requires
- metatrader-mcp-server on PATH
- Python 3.10+
INSTALLATION
Connect your client
Server setup
pip install metatrader-mcp-serverMCP Clients
Claude Desktop
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"<YOUR_MT5_LOGIN>",
"--password",
"<YOUR_MT5_PASSWORD>",
"--server",
"<YOUR_MT5_SERVER>",
"--transport",
"stdio"
]
}
}
}Claude Code
On the Windows VPS where MetaTrader 5 is installed, start the SSE server — it listens on 0.0.0.0:8080 by default (change it with --host and --port): metatrader-mcp-server --login <YOUR_LOGIN> --password <YOUR_PASSWORD> --server <YOUR_SERVER>
On your local machine, add the server to your client config:
{
"mcpServers": {
"metatrader": {
"type": "sse",
"url": "http://<YOUR_VPS_IP>:8080/sse"
}
}
}<YOUR_VPS_IP> is your server's IP address. The MCP protocol has no authentication, so when the SSE server is exposed over a network restrict access with a firewall, a reverse proxy with authentication, or an SSH tunnel.
Open WebUI
metatrader-http-server --login <YOUR_LOGIN> --password <YOUR_PASSWORD> --server <YOUR_SERVER> --host 0.0.0.0 --port 8000