### Development Setup and Commands Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md Instructions for cloning the MCP-MT5 repository, installing development dependencies using pip, and running linting checks with ruff. ```bash git clone https://github.com/PHUICMT/mcp-mt5 cd mcp-mt5 pip install -e ".[dev]" pytest # runs the 18-test suite ruff check src tests # lints ``` -------------------------------- ### Install mcp-mt5 Package Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md Use pip to install the mcp-mt5 package. This is the first step to get started. ```bash pip install mcp-mt5 ``` -------------------------------- ### Verify MT5 Installation with env_info Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md After registration, use the agent to call `env_info` to verify the installation. An empty `issues` array indicates a successful setup. ```json { "edition": "mt5", "install": "C:\\Program Files\\MetaTrader 5", "terminal_hash": "<32-char-hex-hash>", "metaeditor": "C:\\Program Files\\MetaTrader 5\\MetaEditor64.exe", "experts_dir": "C:\\Users\\\\AppData\\Roaming\\MetaQuotes\\Terminal\\\\MQL5\\Experts", "issues": [] } ``` -------------------------------- ### Example LLM-Driven Iteration Workflow Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md Illustrates a common workflow involving environment verification, compilation, deployment, backtesting configuration, execution, report analysis, log inspection, and iterative refinement. ```text 1. env_info → verify paths 2. compile_and_deploy source="MyEA.mq5" → 0 errors, .ex5 deployed ✅ 3. patch_tester_ini config="tester.ini" updates={ "Tester.Symbol": "EURUSD", "Tester.FromDate": "2025.01.01", "TesterInputs.RiskPct": "1.5" } 4. run_backtest config="tester.ini" wait=true 5. read_tester_report → summary.net_profit = 1234.56 summary.profit_factor = 1.45 6. tail_log mode="tester" lines=200 structured=true → diagnose journal warnings 7. 8. → loop back to step 2 ``` -------------------------------- ### MCP-MT5 Project Directory Structure Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md Outlines the main directories within the MCP-MT5 project, including source code, tests, examples, and GitHub workflows. ```text mcp-mt5/ ├── src/mcp_mt5/ │ ├── server.py # FastMCP tool definitions │ ├── paths.py # Layout detection + origin.txt scan │ └── parsers.py # Compile log + tester HTML report parsers ├── tests/ # 18 pytest tests, no live MT5 required ├── examples/ # Sample tester.ini + client config └── .github/workflows/ # CI + PyPI release ``` -------------------------------- ### Sample tester.ini Configuration Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md A sample configuration file for the MetaTrader 5 tester, specifying backtesting parameters such as expert advisor, symbol, period, date range, and initial deposit. Includes comments on period codes and model types. ```ini ; Launch: terminal64.exe /config:tester.ini ; Period codes: M1=1, M5=5, M15=15, H1=16385, H4=16388, D1=16408 ; Model: 0=Every tick, 1=1 min OHLC, 4=Real ticks [Tester] Expert=MyEA Symbol=EURUSD Period=M15 Model=1 FromDate=2024.01.01 ToDate=2024.12.31 Deposit=10000 Currency=USD Leverage=500 Visual=0 ShutdownTerminal=1 ; required so run_backtest can wait for the run to finish Report=tester_report [TesterInputs] ; ParamName=value||start||step||stop||(N=fixed|Y=optimize) ; RiskPct=1.0||0.1||0.1||3.0||N ``` -------------------------------- ### Register MCP Client with MT5 Server Configuration Source: https://github.com/phuicmt/mcp-mt5/blob/main/README.md Configure your MCP client to recognize the MT5 server. The server's configuration is inherited from environment variables. ```json { "mcpServers": { "mt5": { "command": "mcp-mt5", "env": { "MT5_INSTALL": "C:\\Program Files\\MetaTrader 5" } } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.