MT5 MCP Server
MT5 MCP Server
MetaTrader 5 터미널을 Claude에 연결하는 로컬 MCP 서버입니다. 시장 데이터, 계정 상태 및 내역을 읽고, 차트 스크린샷을 캡처하며, 라이브 주문을 보낼 수 있습니다.
요구 사항
MetaTrader 5 터미널이 실행 중이어야 합니다.
**도구 → 옵션 → 전문가 자문 → "알고리즘 트레이딩 허용"**이 활성화되어야 합니다.
계정에 로그인되어 있어야 합니다.
터미널이 닫혀 있으면 모든 도구가 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)
시장 데이터
도구 | 기능 |
| 터미널 빌드, 연결, 계정, 잔액, 평가액, 증거금, DEMO/REAL |
| 심볼 검색 — 와일드카드 지원 ( |
| 자릿수, 포인트, 스프레드, 계약 크기, 랏 한도, 증거금 및 스왑 비율 |
| 하나 이상의 심볼에 대한 실시간 매수/매도 호가 및 스프레드 |
| M1부터 MN1까지의 OHLCV, 개수 또는 날짜 범위로 조회 |
| 원시 매수/매도 틱 스트림, 백테스팅에 유용 |
계정
도구 | 기능 |
| 오픈 포지션 및 총 변동 손익 |
| 활성 지정가 및 스톱 주문 |
| 손익, 수수료 및 스왑 합계가 포함된 체결 내역 |
| 제출되었거나 취소되거나 거부된 주문 |
| 아무것도 보내기 전에 증거금과 예상 손익 계산 (주문이 생성되지 않음) |
화면 캡처
도구 | 기능 |
| 심볼, 타임프레임 및 크기가 포함된 열린 차트 |
| 터미널 창 또는 개별 차트의 PNG |
screenshot은 MetaTrader5 Python API에서 비롯된 것이 아닙니다. 해당 API에는 스크린샷 함수가 전혀 없습니다. 이 기능은 Windows PrintWindow 호출(mt5_capture.py)을 기반으로 구축되었습니다. 백그라운드 창에서는 작동하지만 최소화된 창에서는 작동하지 않습니다.
전체 터미널을 캡처하려면 target='window'를, 단일 차트를 캡처하려면 target='XAUUSD,M30'를 전달하세요. 'XAUUSD'만 전달하면 해당 심볼에 대해 가장 큰 차트가 선택됩니다.
트레이딩 — 라이브
도구 | 기능 |
| 시장가 매수/매도, SL/TP를 절대 가격 또는 포인트로 지정 |
| 매수/매도 지정가 또는 스톱 주문, 선택적 만료 시간 |
| 오픈 포지션의 SL/TP 변경 |
| 대기 주문의 가격, SL 또는 TP 변경 |
| 전체 또는 부분 청산 |
| 대기 주문 삭제 |
| 전체 포지션 닫기 또는 특정 심볼만 닫기 |
⚠️ 트레이딩 도구에는 데모/실계좌 보호 장치가 없습니다. 주문은 터미널에 로그인된 계정으로 전송됩니다. 브로커의 체결 모드는 자동으로 감지되며 필요에 따라 심볼이 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의 선택적 환경 변수는 다음과 같습니다:
변수 | 용도 |
|
|
| 다른 계정으로 로그인 (기본값: 터미널에서 이미 사용 중인 계정) |
스모크 테스트
.venv/Scripts/python.exe -c "import mt5_mcp_server as s; print(s.mt5_status()['account'])"This server cannot be deployed
Maintenance
Related MCP Connectors
Let AI agents trade and read MetaTrader 5 accounts. Hosted — no terminal for you to run.
Connect Claude, ChatGPT, Gemini or Grok to your broker: live charts, backtests and trades
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables 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.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables users to capture real MetaTrader 5 chart snapshots with custom indicators and fetch market data through natural language in Claude Desktop.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with MetaTrader 5 for market data, technical analysis, Fibonacci calculations, and trading via MCP clients such as Claude.MIT
- FlicenseAqualityDmaintenanceEnables 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-