HTS MetaTrader5 Trading MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@HTS MetaTrader5 Trading MCP get EURUSD daily candles for the last week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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:
MCP Server (Node.js/TypeScript)
Exposes tools via Model Context Protocol
Manages command queue for EA communication
Provides HTTP API for MT5 integration
MetaTrader 5 EA (MQL5)
Executes trading operations
Retrieves market data
Communicates with MCP server via HTTP
Installation
npm install
npm run buildConfiguration
Create a .env file:
HTTP_PORT=3000Usage
Start the MCP Server
npm startConfigure Claude Desktop
Add to your Claude desktop config:
{
"mcpServers": {
"mcp-server": {
"command": "node",
"args": ["/path/to/trading-mcp/dist/index.js"]
}
}
}Deploy MT5 EA
Copy
ea/info-bot.mq5to your MetaTrader 5ExpertsfolderCompile the EA in MetaEditor
Attach the EA to any chart
Ensure the EA has the correct HTTP endpoint configured
API Tools
Market Data Tools
get_candles- Historical candle data for a symbolget_bulk_candles- Multi-timeframe candle dataget_accounts- All trading accountsget_account- Specific account by numberget_positions- All open positionsget_orders- All pending orders
Trading Tools
open_order- Create new trading ordermodify_order- Update pending ordercancel_order- Cancel pending orderclose_position- Close open positionmodify_position- Update position SL/TPget_command_queue- View pending commandsget_handler_queue- View command results
Available Tools
14 toolscancel_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
Scored across 14 tools
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.
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.
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.
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
Related MCP Connectors
Let AI agents trade and read MetaTrader 5 accounts. Hosted — no terminal for you to run.
Read-only access to your MetaTrader 4 and 5 accounts for AI agents: balances, open positions, trade history with win rate, live quotes, symbol specs and candles. It cannot place, modify or close orders.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables 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-
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MetaTrader 5 for market data, technical analysis, Fibonacci calculations, and trading via MCP clients such as Claude.MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to trade on MetaTrader 5 via REST API or MCP tools, supporting market/pending orders, position management, and account info retrieval.-
- FlicenseNot gradedqualityDmaintenanceEnables 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.-