
How to add MetaTrader MCP Server to Windsurf
Let AI assistants trade on MetaTrader 5 using natural language. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 533★ · stdio · no auth
Windsurf config for MetaTrader MCP Server
pip install metatrader-mcp-server{
"mcpServers": {
"metatrader-mcp-server": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Setup steps
- 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the MetaTrader MCP Server config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5MetaTrader MCP Server's tools become available to Cascade.
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)
What MetaTrader MCP Server can do in Windsurf
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.
Security
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 + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the MetaTrader MCP Server config there under the "mcpServers" key and restart the client.
Is MetaTrader MCP Server safe to use with Windsurf?
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.
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.