Skip to main content
Glama
tradingmavenfx-cmd

MT5 MCP Server

MT5 MCP Server

MetaTrader 5 터미널을 Claude에 연결하는 로컬 MCP 서버입니다. 시장 데이터, 계정 상태 및 내역을 읽고, 차트 스크린샷을 캡처하며, 라이브 주문을 보낼 수 있습니다.

요구 사항

  1. MetaTrader 5 터미널이 실행 중이어야 합니다.

  2. **도구 → 옵션 → 전문가 자문 → "알고리즘 트레이딩 허용"**이 활성화되어야 합니다.

  3. 계정에 로그인되어 있어야 합니다.

터미널이 닫혀 있으면 모든 도구가 MT5 initialize failed를 반환합니다. 터미널을 열고 다시 시도하세요.

Related MCP server: metatrader-mcp

설치

uv venv --python 3.12 .venv
uv pip install --python .venv/Scripts/python.exe -r requirements.txt

그런 다음 .mcp.json의 경로를 조정하고 Claude Code를 다시 시작하세요.

도구 (20)

시장 데이터

도구

기능

mt5_status

터미널 빌드, 연결, 계정, 잔액, 평가액, 증거금, DEMO/REAL

list_symbols

심볼 검색 — 와일드카드 지원 (EUR*, *USD*)

symbol_info

자릿수, 포인트, 스프레드, 계약 크기, 랏 한도, 증거금 및 스왑 비율

get_ticks

하나 이상의 심볼에 대한 실시간 매수/매도 호가 및 스프레드

get_candles

M1부터 MN1까지의 OHLCV, 개수 또는 날짜 범위로 조회

get_tick_history

원시 매수/매도 틱 스트림, 백테스팅에 유용

계정

도구

기능

get_positions

오픈 포지션 및 총 변동 손익

get_pending_orders

활성 지정가 및 스톱 주문

get_history_deals

손익, 수수료 및 스왑 합계가 포함된 체결 내역

get_history_orders

제출되었거나 취소되거나 거부된 주문

calc_trade

아무것도 보내기 전에 증거금과 예상 손익 계산 (주문이 생성되지 않음)

화면 캡처

도구

기능

list_charts

심볼, 타임프레임 및 크기가 포함된 열린 차트

screenshot

터미널 창 또는 개별 차트의 PNG

screenshot은 MetaTrader5 Python API에서 비롯된 것이 아닙니다. 해당 API에는 스크린샷 함수가 전혀 없습니다. 이 기능은 Windows PrintWindow 호출(mt5_capture.py)을 기반으로 구축되었습니다. 백그라운드 창에서는 작동하지만 최소화된 창에서는 작동하지 않습니다.

전체 터미널을 캡처하려면 target='window'를, 단일 차트를 캡처하려면 target='XAUUSD,M30'를 전달하세요. 'XAUUSD'만 전달하면 해당 심볼에 대해 가장 큰 차트가 선택됩니다.

트레이딩 — 라이브

도구

기능

open_position

시장가 매수/매도, SL/TP를 절대 가격 또는 포인트로 지정

place_pending_order

매수/매도 지정가 또는 스톱 주문, 선택적 만료 시간

modify_position

오픈 포지션의 SL/TP 변경

modify_pending_order

대기 주문의 가격, SL 또는 TP 변경

close_position

전체 또는 부분 청산

cancel_pending_order

대기 주문 삭제

close_all_positions

전체 포지션 닫기 또는 특정 심볼만 닫기

⚠️ 트레이딩 도구에는 데모/실계좌 보호 장치가 없습니다. 주문은 터미널에 로그인된 계정으로 전송됩니다. 브로커의 체결 모드는 자동으로 감지되며 필요에 따라 심볼이 Market Watch에 추가됩니다.

CLI (trade.py)

Claude 없이 동일한 도구를 명령줄에서 바로 사용할 수 있습니다:

.venv/Scripts/python.exe trade.py buy XAUUSD 0.01 --sl-points 500 --tp-points 1000
.venv/Scripts/python.exe trade.py modify 10090941191 --sl 4345.56 --tp 4360.56
.venv/Scripts/python.exe trade.py close 10090941191
.venv/Scripts/python.exe trade.py close-all --symbol XAUUSD
.venv/Scripts/python.exe trade.py positions
.venv/Scripts/python.exe trade.py calc buy XAUUSD 0.01 --close-price 4360

모든 하위 명령에 대해 trade.py --help를 실행하세요.

시간 형식

모든 시간 입력은 UTC입니다: YYYY-MM-DD, YYYY-MM-DD HH:MM 또는 YYYY-MM-DD HH:MM:SS. 출력 타임스탬프도 UTC입니다.

구성

.mcp.json의 선택적 환경 변수는 다음과 같습니다:

변수

용도

MT5_PATH

terminal64.exe의 경로. 터미널이 닫혀 있을 때 터미널을 시작하는 데 사용됩니다

MT5_LOGIN / MT5_PASSWORD / MT5_SERVER

다른 계정으로 로그인 (기본값: 터미널에서 이미 사용 중인 계정)

스모크 테스트

.venv/Scripts/python.exe -c "import mt5_mcp_server as s; print(s.mt5_status()['account'])"

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables comprehensive access to the MetaTrader 5 trading platform for retrieving market data, managing accounts, and executing trading operations. It provides 32 specialized tools for interacting with MT5 functionalities, including historical OHLCV data access, real-time position monitoring, and automated order management.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables users to capture real MetaTrader 5 chart snapshots with custom indicators and fetch market data through natural language in Claude Desktop.
    3
    MIT
  • 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
    A
    quality
    D
    maintenance
    Enables Claude AI to perform forex trading operations and market data analysis through MetaTrader 5, including order placement, position management, and multi-timeframe candle data retrieval.
    16
    -