MCP Directory

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

  1. 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
  2. 2Paste the MetaTrader MCP Server config below.
  3. 3Fill in placeholder secrets, then save.
  4. 4Click Refresh in the MCP panel.
  5. 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_info

Get balance, equity, profit, margin level, leverage, and currency.

get_symbols

List all available trading symbols.

get_symbol_price

Get the current bid/ask price for a symbol.

get_candles_latest

Get recent price candles (OHLCV data).

get_candles_by_date

Get historical candles for a date range.

get_symbol_info

Get detailed symbol information.

place_market_order

Execute an instant BUY/SELL order.

place_pending_order

Place 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.

View repo Full MetaTrader MCP Server page