MCP Directory

MetaTrader MCP Server

Let AI assistants trade on MetaTrader 5 using natural language.

Unverified
stdio (local)
No auth
Python

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
pip install metatrader-mcp-server

Paste 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_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.

modify_position

Update stop loss or take profit on an open position.

modify_pending_order

Modify pending order parameters.

get_all_positions

View all open positions.

get_positions_by_symbol

Filter open positions by trading pair.

get_positions_by_id

Get details for a specific position.

close_position

Close a specific position.

close_all_positions

Close all open positions.

close_all_positions_by_symbol

Close all positions for a given symbol.

close_all_profitable_positions

Close only winning trades.

close_all_losing_positions

Close only losing trades.

get_all_pending_orders

List all pending orders.

get_pending_orders_by_symbol

Filter pending orders by symbol.

cancel_pending_order

Cancel a specific pending order.

cancel_all_pending_orders

Cancel all pending orders.

cancel_pending_orders_by_symbol

Cancel pending orders for a given symbol.

get_deals

Get historical completed trades.

get_orders

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

Featured
Verified
stdio (local)
API key
TypeScript
12 tools
Updated 1 month agoRepo

Coinbase's AgentKit MCP extension for onchain actions: transfers, swaps, and contract calls.

Verified
stdio (local)
API key
TypeScript
9 tools
Updated 1 month agoRepo

Alpaca's official trading server for stocks, ETFs, options, and crypto in plain English.

Verified
stdio (local)
API key
Python
12 tools
Updated 1 month agoRepo