mt5-mcp
MetaTrader 5 (MT5) MCP Server & Web GUI Workstation
Windows에서 MetaTrader 5를 위한 고성능 Model Context Protocol (MCP) 서버이자 대화형 Web GUI Workstation입니다. 이 프로젝트는 AI 어시스턴트(Antigravity, Claude Desktop, Cursor 등)와 퀀트 트레이더를 로컬 MT5 설치에 직접 연결하여 다음을 수행합니다:
과거 시장 데이터 가져오기 (M1–MN1 시간대에 걸친 OHLCV 바 및 밀리초 정밀도 틱 스트림) 및 고속 Parquet 및 CSV 내보내기.
전략 백테스트 실행 내장 Python 퀀트 엔진 및 네이티브 MT5 Strategy Tester 자동화(
terminal64.exe /config:tester.ini)를 통해.데모 계정 상태, 자본 곡선, 활성 심볼, 마켓 워치 호가 및 오픈 포지션을 검사합니다.
대화형 금융 Web GUI: TradingView Lightweight Charts, 실시간 텔레메트리, 자본 곡선 시각화 도구를 갖춘 Strategy Studio 및 계정 로그인 관리자로 구축되었습니다.
엄격한 트레이딩 안전 가드: 데모 및 실거래 주문이 명시적 확인이 있어야만 실행되도록 보장합니다.
아키텍처 개요
┌────────────────────────────────────────────────────────┐
│ AI Client │
│ (Antigravity / Claude Desktop / Cursor) │
└───────────────────────────┬────────────────────────────┘
│ MCP Protocol (stdio)
┌───────────────────────────▼────────────────────────────┐
│ MT5 MCP Server (Python) │
│ - FastMCP Server (`src/mt5_mcp/server.py`) │
│ - Data Caching & Parquet/CSV Export Engine │
│ - Quantitative Strategy Backtesting Engine │
└─────────────┬────────────────────────────┬─────────────┘
│ │
┌─────────────▼──────────────┐ ┌──────────▼─────────────┐
│ MetaTrader5 Python API │ │ MT5 Native Tester Auto │
│ - copy_rates_range() │ │ - tester.ini builder │
│ - copy_ticks_range() │ │ - terminal64.exe CLI │
│ - account_info() / login()│ │ - Report XML/HTML │
└─────────────┬──────────────┘ └──────────┬─────────────┘
│ │
┌─────────────▼────────────────────────────▼─────────────┐
│ MetaTrader 5 Windows Terminal │
│ (Demo Account Connected) │
└────────────────────────────────────────────────────────┘Related MCP server: MetaTrader MCP Server
설치 및 사전 요구 사항
1. 요구 사항
Windows 10 / 11 (64비트)
MetaTrader 5 데스크톱 터미널 설치
Python 3.10, 3.11 또는 3.12 (64비트)
uv(권장) 또는 표준pip
2. MT5에서 알고리즘 트레이딩 활성화
MetaTrader 5 터미널에서:
도구 -> 옵션 -> 전문가 자문으로 이동합니다.
알고리즘 트레이딩 허용을 선택하세요.
DLL 가져오기 허용을 선택하세요 (사용자 지정 지표에 필요한 경우).
3. 가상 환경 설정
# Clone the repository
git clone https://github.com/remomein05/mt5-mcp.git
cd mt5-mcp
# Create virtual environment and install dependencies
uv venv --python 3.12 .venv
.venv\Scripts\activate
uv pip install -e ".[dev]"Web GUI 워크스테이션 (대화형 대시보드)
이 저장소에는 TradingView 차트, 실시간 마켓 워치, 전략 백테스트 스튜디오 및 계정 관리를 제공하는 전용 금융 등급 Web GUI Dashboard가 포함되어 있습니다:
# Launch via console script
mt5-mcp-gui
# Or launch via Python module
.venv\Scripts\python -m mt5_mcp.gui --port 8000그런 다음 브라우저에서 **http://127.0.0.1:8000**을 엽니다.
GUI 기능:
📊 TradingView Lightweight Charts: 대화형 시간대 선택기(
M1,M5,M15,M30,H1,H4,D1)를 갖춘 부드러운 캔들스틱 및 거래량 차트.📈 Strategy Backtest Studio: 전략 매개변수(
SMA Crossover,RSI Reversal,Bollinger Bands)를 구성하고 시뮬레이션을 실행하여 자본 성장 곡선, KPI(샤프 비율, 최대 손실률 %, 승률 %) 및 종료 거래 로그를 검사합니다.📦 Historical Data Exporter: 원클릭으로 캔들스틱 데이터를 Parquet 및 CSV 파일로 즉시 추출합니다.
🔍 Market Watch: 와일드카드 검색(예:
*USD*,Crypto*) 및 실시간 변동 스프레드 표시기를 통한 실시간 심볼 탐색.⚙️ MT5 Connect & Account Login Modal: 활성 MT5 터미널에 원활하게 연결하거나 사용자 지정 Login ID, Password, Broker/Server 및 선택적 실행 파일 경로를 사용하여 데모 계정으로 전환/로그인합니다(Enter 키 제출 및 Esc 키 닫기).
📋 Open Positions & Native MT5 Tester Panel: 오픈 포지션을 확인하고 일괄
.ini구성으로 네이티브 MQL5 Expert Advisors를 헤드리스로 자동화합니다.
MCP 클라이언트 구성
Claude Desktop / Antigravity / Cursor (mcp_config.json)
MT5 MCP 서버를 MCP 클라이언트 구성에 추가합니다:
{
"mcpServers": {
"mt5": {
"command": "C:\\Users\\<USER>\\source\\repos\\mt5_mcp\\.venv\\Scripts\\python.exe",
"args": [
"-m",
"mt5_mcp.server"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}사용 가능한 MCP 도구
1. 연결 및 계정 관리
도구 | 매개변수 | 설명 |
|
| MT5 터미널에 대한 연결을 초기화하거나 특정 데모 계정에 로그인합니다. |
| 없음 | 데모 계정의 잔액, 자본, 레버리지, 유효 증거금 및 이익을 반환합니다. |
| 없음 | MT5 빌드 버전, 연결 상태, 핑 및 데이터 디렉터리를 반환합니다. |
2. 시장 탐색 및 과거 데이터
도구 | 매개변수 | 설명 |
|
| 와일드카드 필터링으로 사용 가능한 심볼을 검색합니다. |
|
| 계약 사양(스프레드, 포인트, 자릿수, 스왑 금리)을 반환합니다. |
|
| 실시간 매수 호가, 매도 호가 및 마지막 가격을 검색합니다. |
|
| 선택적 Parquet/CSV 내보내기와 함께 다양한 시간대( |
|
| 선택적 Parquet/CSV 내보내기와 함께 밀리초 정밀도 틱 스트림을 추출합니다. |
3. 전략 테스트 및 시뮬레이션
도구 | 매개변수 | 설명 |
| 없음 | 내장 백테스트 모델( |
|
| 과거 MT5 데이터에서 백테스트를 실행하고 샤프 비율, 최대 손실률 %, 승률 %, 손익 비율 및 거래 로그를 반환합니다. |
|
| 생성된 |
4. 포지션 및 거래 (안전 가드)
도구 | 매개변수 | 설명 |
|
| 데모 계정의 오픈 포지션을 나열합니다. |
|
| 체결된 거래 및 과거 주문 실행 내역을 나열합니다. |
|
|
|
테스트 실행
연결성, 과거 데이터 추출, 정량적 백테스터 및 GUI REST API를 검증하는 포괄적인 pytest 스위트를 실행합니다:
.venv\Scripts\pytest -v라이선스
MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Trader.AI turns trading ideas into strategies you can trade. Describe an idea, paste a strategy, or share the source of an MT5 Expert Advisor, and Trader.AI makes the rules exact (entries, exits, stops and position sizing), then backtests them on historical MT5 data for EURUSD, GBPUSD, AUDUSD, XAUUSD, XAGUSD, NAS100, SP500, USOIL, BTCUSD or ETHUSD. Results come back in the chat: return, max drawdown, win rate, Sharpe and every trade, with the rule that opened it and why it closed, plus a report link. Change the rules and backtest again; every version is saved so you can compare runs. Start from a starter strategy or see how Trader.AI's own AI traders perform in live trading. When a version backtests the way you want, export it as an MT5 Expert Advisor. Backtest results are hypothetical and don't guarantee future returns. Trader.AI doesn't place trades on your account or give investment advice. Connecting requires signing in with a Trader.AI account.
Read-only MetaTrader 5 for AI agents: balances, positions, history and prices. Sign in with OAuth.
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.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceExposes a unified AI interface to MetaTrader 5 over the Model Context Protocol, enabling live quotes, historical data, technical indicators, order execution, position management, and headless backtests.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to trade on MetaTrader 5 using natural language, supporting account management, order placement, and real-time market data.1MIT
- AlicenseNot gradedqualityCmaintenanceA local-first MCP server that bridges AI coding agents with MetaTrader 5 for inspection, market data, MQL5 development, compiling, Strategy Tester review, workspace sync, logs, audit trails, demo trading, and carefully gated live trading.MIT
- FlicenseNot gradedqualityDmaintenanceUniversal MCP server that enables AI assistants to control MetaTrader 5 directly, executing trades, managing data, and automating MT5 operations through natural language.4-