
MetaTrader MCP Server
Let AI assistants trade on MetaTrader 5 using natural language.
Add to your client
Copy the config for your MCP client and paste it into its config file.
pip install metatrader-mcp-serverPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"metatrader-mcp-server": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Python 3.10 or higher
- MetaTrader 5 terminal installed
- An MT5 trading account (demo or live): login number, password, and server name
- Algorithmic trading enabled in MT5 (Tools → Options → Expert Advisors → Allow algorithmic trading)
About MetaTrader MCP Server
An MCP server that lets AI assistants trade on MetaTrader 5 via natural language. It bridges LLMs to the MT5 terminal, exposing account info, market data, order execution, position management, pending orders, and trade history as tools. Supports stdio (Claude Desktop local), SSE/streamable-HTTP (remote MCP), a REST API (Open WebUI / ChatGPT), and a WebSocket quote stream. Distributed as the PyPI package metatrader-mcp-server. A bundled 'Trading Terminal Assistant' Claude skill (claude-skill/) adds structured knowledge of the trading tools and output formatting.
Tools & capabilities (25)
get_account_infoGet balance, equity, profit, margin level, leverage, and currency.
get_symbolsList all available trading symbols.
get_symbol_priceGet the current bid/ask price for a symbol.
get_candles_latestGet recent price candles (OHLCV data).
get_candles_by_dateGet historical candles for a date range.
get_symbol_infoGet detailed symbol information.
place_market_orderExecute an instant BUY/SELL order.
place_pending_orderPlace a limit/stop order for future execution.
modify_positionUpdate stop loss or take profit on an open position.
modify_pending_orderModify pending order parameters.
get_all_positionsView all open positions.
get_positions_by_symbolFilter open positions by trading pair.
get_positions_by_idGet details for a specific position.
close_positionClose a specific position.
close_all_positionsClose all open positions.
close_all_positions_by_symbolClose all positions for a given symbol.
close_all_profitable_positionsClose only winning trades.
close_all_losing_positionsClose only losing trades.
get_all_pending_ordersList all pending orders.
get_pending_orders_by_symbolFilter pending orders by symbol.
cancel_pending_orderCancel a specific pending order.
cancel_all_pending_ordersCancel all pending orders.
cancel_pending_orders_by_symbolCancel pending orders for a given symbol.
get_dealsGet historical completed trades.
get_ordersGet historical order records.
When to use it
- Check account balance, equity, margin, and trading statistics by asking in natural language
- Get real-time prices, symbol info, and historical OHLCV candles for analysis
- Place market and pending orders with stop loss / take profit via chat
- Bulk-manage positions (e.g. close all profitable or all losing positions)
- Stream live tick data over WebSocket for dashboards and monitoring
- Build trading bots or analysis tools on top of the REST API or Python client
Security notes
Trading involves significant risk of loss; the software is provided as-is with no liability for trading outcomes. Requires MT5 account credentials (login, password, server) passed as CLI args or via a .env file — keep these private. The MCP protocol includes no authentication: when exposing the SSE server over a network, restrict access by IP with a firewall, place it behind an authenticated reverse proxy, or use an SSH tunnel. Algorithmic trading must be explicitly enabled in the MT5 terminal.
MetaTrader MCP Server FAQ
Which AI clients does it support?
Claude Desktop and Claude Code via local stdio or remote SSE; ChatGPT and other LLMs via Open WebUI using the REST/HTTP API server. It can also be used directly as a Python library (MT5Client).
What transports are available?
The MCP server supports stdio, sse, and streamable-http (via --transport / MCP_TRANSPORT). SSE/HTTP bind to 0.0.0.0:8080 by default. There is also a separate FastAPI REST server and a WebSocket quote server (default ws://0.0.0.0:8765).
Is it safe to run the remote SSE server?
The MCP protocol has no built-in authentication. When exposing the SSE server over a network, restrict access by IP with a firewall, put it behind an authenticated reverse proxy, or use an SSH tunnel.
Where do my MT5 credentials go?
Credentials (login, password, server) are passed as CLI arguments or loaded from a local .env file and stay on your machine. The README warns that trading carries real financial risk and the software is provided as-is.
Alternatives to MetaTrader MCP Server
Compare all alternatives →Official Stripe server for payments, customers, subscriptions, invoices, and billing via natural language.
Coinbase's AgentKit MCP extension for onchain actions: transfers, swaps, and contract calls.
Alpaca's official trading server for stocks, ETFs, options, and crypto in plain English.
Compare MetaTrader MCP Server with: