Skip to main content
Glama
edkdev

MetaTrader5 MCP Server

by edkdev

MetaTrader5 MCP Server

Ein Model Context Protocol (MCP)-Server, der Handelsschnittstellen für die MetaTrader5 (MT5)-Plattform bereitstellt.

Funktionen

  • Kontoverwaltung: Kontoinformationen, Guthaben, Eigenkapital, Marge abrufen

  • Positionsverwaltung: Offene Positionen anzeigen, ändern und schließen

  • Auftragsoperationen: Markt-/Pending-Orders platzieren, Aufträge stornieren

  • Marktdaten: Symbolinformationen, aktuelle Kurse (Ticks) abrufen

  • Kurse/Kerzen: OHLCV-Daten via start_pos/count oder Datumsbereich abrufen

  • Indikatoren: SMA, EMA, RSI, MACD, Bollinger-Bänder, ATR, Stochastic berechnen

  • Indikatorpakete: Mehrere Indikatoren in einem einzigen Aufruf berechnen

  • Signal-Tools: EMA-Crossover-Regime-Flags und Konfluenz-Scoring für Einstiege

Related MCP server: MetaTrader 5 MCP Server

Installation

Abhängigkeiten mit uv installieren:

uv sync

Konfiguration

Umgebungsvariablen werden jetzt direkt in Ihren MCP-Client-Einstellungen konfiguriert (keine .env-Datei erforderlich).

Claude Desktop / Kiro

Fügen Sie in Ihrer mcp.json-Konfigurationsdatei hinzu:

{
  "mcpServers": {
    "mt5-trading": {
      "command": "uvx",
      "args": ["mt5-mcp"],
      "env": {
        "MT5_LOGIN": "your_account_number",
        "MT5_PASSWORD": "your_password",
        "MT5_SERVER": "your_broker_server",
        "MT5_PATH": "C:\\Program Files\\MetaTrader 5\\terminal64.exe",
        "MT5_TIMEOUT": "60000",
        "DEFAULT_DEVIATION": "20",
        "DEFAULT_MAGIC": "234000"
      }
    }
  }
}

Erforderliche Umgebungsvariablen:

  • MT5_LOGIN - Ihre MT5-Kontonummer

  • MT5_PASSWORD - Ihr MT5-Kontopasswort

  • MT5_SERVER - Der Servername Ihres Brokers

  • MT5_PATH - Pfad zur ausführbaren MT5-Terminaldatei

Optionale Umgebungsvariablen:

  • MT5_TIMEOUT - Verbindungs-Timeout in Millisekunden (Standard: 60000)

  • DEFAULT_DEVIATION - Standard-Kursabweichung in Punkten (Standard: 20)

  • DEFAULT_MAGIC - Standard-Magic-Nummer für Aufträge (Standard: 234000)

Alternative: Lokale Entwicklung

Für die lokale Entwicklung können Sie auch direkt ausführen:

# Set environment variables and run
MT5_LOGIN=your_account MT5_PASSWORD=your_pass MT5_SERVER=your_server MT5_PATH="C:\Program Files\MetaTrader 5\terminal64.exe" uv run python mt5_mcp/server.py

Oder die veraltete Methode mit dem uv-Verzeichnis verwenden:

{
  "mcpServers": {
    "mt5-trading": {
      "command": "uv",
      "args": [
        "--directory",
        "D:\\path\\mt5-mcp",
        "run",
        "python",
        "mt5_mcp/server.py"
      ],
      "env": {
        "MT5_LOGIN": "your_account_number",
        "MT5_PASSWORD": "your_password",
        "MT5_SERVER": "your_broker_server",
        "MT5_PATH": "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
      }
    }
  }
}

Verfügbare Werkzeuge

Kontoinformationen

  • mt5_get_account_info - Kontoguthaben, Eigenkapital, Marge usw. abrufen

  • mt5_get_positions - Offene Positionen abrufen (alle oder gefiltert nach Symbol)

  • mt5_get_orders - Ausstehende Aufträge abrufen

Auftragsoperationen

  • mt5_place_order - Markt- oder Pending-Orders platzieren (bzw. limitierte oder Stop-Orders)

    • Unterstützt: buy, sell, buy_limit, sell_limit, buy_stop, sell_stop

    • Optional SL/TP

  • mt5_close_position - Eine offene Position per Ticket schließen

  • mt5_cancel_order - Einen ausstehenden Auftrag stornieren

  • mt5_modify_position - SL/TP einer offenen Position ändern

Marktdaten

  • mt5_get_symbol_info - Kontraktspezifikationen abrufen

  • mt5_get_tick - Aktuelle Geld-/Briefkurse abrufen

Kurse / Kerzen

  • mt5_get_rates_from_pos - OHLCV ab einer Position abrufen (0=aktueller Balken) mit start_pos und count

  • mt5_get_rates_range - OHLCV innerhalb eines ISO-Datumsbereichs date_fromdate_to abrufen

Indikatoren

Alle Indikator-Werkzeuge unterstützen entweder direkte Daten (Schlusskurse/Kerzen) oder automatisches Abrufen via symbol + timeframe und entweder date_from/date_to oder start_pos/count. Setzen Sie return_last_only=true, um nur die neuesten Werte zurückzugeben.

  • mt5_calc_sma - Einfacher gleitender Durchschnitt

    • Parameter: period (Standard 20)

  • mt5_calc_ema - Exponentiell gleitender Durchschnitt

    • Parameter: period (Standard 20)

  • mt5_calc_rsi - Relative-Stärke-Index

    • Parameter: period (Standard 14)

  • mt5_calc_macd - MACD-Linie, Signallinie, Histogramm

    • Parameter: fast (12), slow (26), signal (9)

  • mt5_calc_bbands - Bollinger-Bänder (obere/mittlere/untere)

    • Parameter: period (20), stddev (2,0)

  • mt5_calc_atr - Durchschnittliche true range (benötigt Kerzen)

    • Parameter: period (14)

  • mt5_calc_stochastic - Stochastischer Oszillator %K/%D (benötigt Kerzen)

    • Parameter: k_period (14), d_period (3), smooth_k (1)

Indikatorpakete

  • mt5_calc_bundle - Mehrere Indikatoren in einem Aufruf mit denselben abgerufenen Kerzen berechnen

    • Argumente:

      • indicators: Array von Namen aus ["sma","ema","rsi","macd","bbands","atr","stochastic"]

      • Optionales params-Objekt für indikatorspezifische Überschreibungen (z. B. { "sma": {"period": 50}, "bbands": {"stddev": 2.5} })

      • Unterstützt symbol/timeframe mit Bereich/Anzahl oder direkte candles/closes

      • return_last_only: Wenn true, werden nur die neuesten Werte zurückgegeben

Signal-Werkzeuge

  • mt5_signal_crossover - EMA-Crossover- und Regime-Flags

    • Parameter: fast (Standard 50), slow (200), lookback_bars (200)

    • Gibt zurück: state (above/below/equal), crossed_up, crossed_down, age_bars, slope_fast, slope_slow, spread, spread_pct, price_above_both, price_below_both, price

  • mt5_signal_confluence - Konfluenz-Scoring für Einstiege

    • Indikator-Parameter: ema_fast (50), ema_slow (200), ema_near (20), rsi_period (14), macd_fast (12), macd_slow (26), macd_signal (9), bb_period (20), bb_stddev (2,0), atr_period (14)

    • Schwellenwerte: near_k_atr (0,5), atr_expansion_ratio (1,0), score_threshold (3)

    • Steuerung: direction (auto|long|short), optionale weights für trend/momentum/volatility/location/trigger

    • Gibt Komponenten-Flags und Scores für Long/Short sowie eine vorgeschlagene Richtung zurück

Beispielverwendung

# In Claude Desktop, you can now ask:

"What's my MT5 account balance?"
"Show me my open positions on EURUSD"
"Place a buy order for 0.1 lot EURUSD at market"
"Close position with ticket 12345"
"Get current price for XAUUSD"

# Indicators (auto-fetch candles)
"Compute RSI(14) on EURUSD H1 using the last 300 bars (latest value only)"
"Compute MACD and Bollinger Bands on EURUSD H4 for September"

# Bundle
"Compute RSI+MACD+BBands (latest values) on EURUSD H1 using last 300 bars"

# Signals
"Give me EMA(50/200) crossover regime info on EURUSD H1"
"Compute confluence score on EURUSD H1 (defaults) and tell me if entry is ready"

Anforderungen

  • Windows-Betriebssystem (MT5 läuft nur unter Windows)

  • MetaTrader5-Terminal installiert und ausgeführt

  • Python >=3.11

  • Aktives MT5-Handelskonto

Architektur

mt5-mcp/
├── mt5_mcp/
│   ├── __init__.py          # Package init
│   ├── server.py            # MCP server with tool definitions
│   ├── mt5_service.py       # MT5 SDK wrapper
│   └── indicators.py        # Pure-Python technical indicators
├── pyproject.toml           # Project dependencies (uv)
├── .env.example             # Environment template
└── README.md

Entwicklung

Im Entwicklungsmodus ausführen:

uv run python mt5_mcp/server.py

Lizenz

MIT

Hinweise

  • Die Software wird wie besehen bereitgestellt; der Autor der Software haftet nicht für Verluste aus dem Handel. Devisenhandel ist äußerst volatil und riskant; gehen Sie mit äußerster Vorsicht vor.

  • Das MT5-Terminal muss bei Verwendung dieses MCP ausgeführt werden

  • Stellen Sie sicher, dass Ihr Konto über aktivierte Handelsberechtigungen verfügt

  • Testen Sie zuerst mit einem Demokonto, bevor Sie echtes Geld verwenden

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables access to MetaTrader5 market data and trading functionality, including real-time quotes, historical OHLCV data, tick data, symbol information, and technical indicators for forex and other trading instruments.
    21
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables AI assistants to connect to MetaTrader 5 for trading, market data access, and account management through the Model Context Protocol.
    209
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI applications to interact with MetaTrader 5 terminals via WebSocket MCP protocol for trading operations and account management.
    4
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with MetaTrader 5 for market data, technical analysis, Fibonacci calculations, and trading via MCP clients such as Claude.
    MIT

View all related MCP servers

Related MCP Connectors

  • Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.

  • Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.

  • MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/edkdev/mt5-forex-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server