Skip to main content
Glama
HTS MetaTrader5 Trading MCP

HTS MetaTrader5 Trading MCP

by Yumin-Kim

HTS(MetaTrader5) Trading MCP

A Model Context Protocol (MCP) server that connects Claude AI with MetaTrader 5 for forex trading operations and market data analysis.

Features

Market Data

  • Historical Candles: Retrieve OHLC data for any forex symbol and timeframe

  • Multi-Timeframe Analysis: Fetch candle data across multiple timeframes simultaneously

  • Account Information: View trading account details and metrics

  • Position Tracking: Monitor all open positions

  • Order Management: Track pending orders

Trading Operations

  • Order Placement: Create market and pending orders (BUY, SELL, LIMIT, STOP)

  • Order Modification: Update price levels, SL/TP, and expiration times

  • Order Cancellation: Cancel pending orders

  • Position Management: Close positions (full/partial) and modify SL/TP levels

Related MCP server: MT5 MCP Server

Architecture

The system consists of two components:

  1. MCP Server (Node.js/TypeScript)

    • Exposes tools via Model Context Protocol

    • Manages command queue for EA communication

    • Provides HTTP API for MT5 integration

  2. MetaTrader 5 EA (MQL5)

    • Executes trading operations

    • Retrieves market data

    • Communicates with MCP server via HTTP

Installation

npm install
npm run build

Configuration

Create a .env file:

HTTP_PORT=3000

Usage

Start the MCP Server

npm start

Configure Claude Desktop

Add to your Claude desktop config:

{
  "mcpServers": {
    "mcp-server": {
      "command": "node",
      "args": ["/path/to/trading-mcp/dist/index.js"]
    }
  }
}

Deploy MT5 EA

  1. Copy ea/info-bot.mq5 to your MetaTrader 5 Experts folder

  2. Compile the EA in MetaEditor

  3. Attach the EA to any chart

  4. Ensure the EA has the correct HTTP endpoint configured

API Tools

Market Data Tools

  • get_candles - Historical candle data for a symbol

  • get_bulk_candles - Multi-timeframe candle data

  • get_accounts - All trading accounts

  • get_account - Specific account by number

  • get_positions - All open positions

  • get_orders - All pending orders

Trading Tools

  • open_order - Create new trading order

  • modify_order - Update pending order

  • cancel_order - Cancel pending order

  • close_position - Close open position

  • modify_position - Update position SL/TP

  • get_command_queue - View pending commands

  • get_handler_queue - View command results

Available Tools

14 tools
cancel_orderB

Cancel a pending order. (대기 주문을 취소합니다.)

Inputs: ticket (required).

close_positionA

Close an open position (full or partial). (포지션을 종료합니다. 전체 또는 부분 종료 가능합니다.)

Inputs: ticket (required), volume.

get_accountA

Get specific trading account information by account number. (계정 번호로 특정 트레이딩 계정 정보를 조회합니다.)

Inputs: accountNumber (required).

get_accountsA

Get all trading accounts information. (모든 트레이딩 계정 정보를 조회합니다.)

Inputs: no named parameters.

get_bulk_candlesA

Get historical candle data for multiple timeframes at once. Sends a command to EA and waits for the result (up to 120 seconds). Returns candle data for all requested timeframes. (다중 타임프레임 캔들 데이터 조회. EA에 커맨드를 전송하고 결과를 기다립니다. 요청한 모든 타임프레임의 캔들 데이터를 반환합니다.)

Inputs: symbol (required), timeframes (required), limit.

get_candlesA

Get historical candle data for a forex symbol. Sends a command to EA and waits for the result (up to 60 seconds). Returns the complete candle data with OHLC values. (Forex 심볼의 캔들 데이터 조회. EA에 커맨드를 전송하고 결과를 기다립니다. 완료된 캔들 데이터를 반환합니다.)

Inputs: symbol (required), timeframe (required), limit.

get_command_queueA

Get the current command queue status. Shows pending commands waiting for EA to process. (현재 커맨드 큐 상태 조회. EA가 처리 대기 중인 커맨드 목록을 보여줍니다.)

Inputs: no named parameters.

get_handler_queueB

Get the handler queue status. Shows command execution results from EA. (핸들러 큐 상태 조회. EA로부터 받은 커맨드 실행 결과 목록을 보여줍니다.)

Inputs: no named parameters.

get_handler_resultB

Get a specific handler result by command ID. (특정 커맨드 ID로 핸들러 결과를 조회합니다.)

Inputs: commandId.

get_ordersA

Get all pending orders, optionally filtered by symbol. (모든 대기 주문을 조회합니다. 심볼로 필터링할 수 있습니다.)

Inputs: symbol.

get_positionsA

Get all open positions, optionally filtered by symbol. (모든 오픈 포지션을 조회합니다. 심볼로 필터링할 수 있습니다.)

Inputs: symbol.

modify_orderA

Modify an existing pending order. You can update price, stop loss, take profit, and expiration time. The expiry parameter accepts Unix timestamp (seconds since 1970-01-01). If expiry is set, the order will be automatically cancelled at that time if not filled. (기존 대기 주문을 수정합니다. 가격, 손절가, 익절가, 만료시간을 업데이트할 수 있습니다.)

Inputs: ticket (required), sl, tp, price, +1 more.

modify_positionA

Modify an open position's stop loss and/or take profit. (포지션의 손절가 및/또는 익절가를 수정합니다.)

Inputs: ticket (required), sl, tp.

open_orderA

Open a new trading order (market or pending). Order types explained:

  • BUY/SELL: Market orders execute immediately at current price

  • BUY_LIMIT: Buy BELOW current price (buy when price drops)

  • SELL_LIMIT: Sell ABOVE current price (sell when price rises)

  • BUY_STOP: Buy ABOVE current price (buy on breakout up)

  • SELL_STOP: Sell BELOW current price (sell on breakdown) IMPORTANT: For SELL_STOP, price must be BELOW current market price. (새로운 거래 주문을 생성합니다. SELL_STOP은 현재가 아래에 설정해야 합니다.)

Inputs: type (required), symbol (required), volume (required), sl, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 14 tools

    Disambiguation5/5

    Each tool targets a distinct resource/action: accounts, candles, positions, orders, and internal queues. Even similar tools like get_accounts vs get_account and get_candles vs get_bulk_candles are clearly differentiated by singular/plural and bulk/single scope.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case (e.g., get_accounts, open_order, close_position). The naming is uniform and predictable, with no mixed styles or vague verbs.

    Tool Count5/5

    14 tools is well-scoped for a trading server, covering account info, market data, order management, position management, and internal queue monitoring. Each tool earns its place without feeling excessive or sparse.

    Completeness4/5

    Core trading lifecycle is covered: accounts (get), market data (candles), pending orders (open/modify/cancel/list), and open positions (close/modify/list). Minor gaps include lack of real-time price quotes and historical trade/deal history, but these are workaroundable.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with the MetaTrader 5 trading platform for market data analysis, placing trades, and managing trading positions. Provides comprehensive access to forex and financial market operations through the Model Context Protocol.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with MetaTrader 5 for market data, technical analysis, Fibonacci calculations, and trading via MCP clients such as Claude.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to trade on MetaTrader 5 via REST API or MCP tools, supporting market/pending orders, position management, and account info retrieval.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to interact with a running MetaTrader 5 terminal, providing market data, account information, chart screenshots, and live order execution through a set of 20 tools.
      -