12 Commits

Author SHA1 Message Date
Devid HW c895eb9b33 fix: update all scripts for correctness and consistency
release.sh:
- Add --yes/-y flag (and CI=true) for non-interactive execution
- Auto-resolve server.json conflict during rebase-before-push so CI's
  SHA256 commit no longer blocks the push
- Fix major version bump (was double-assigned, now single expression)

build-release.sh:
- Remove cp of /CLAUDE.md (gitignored personal file — caused build failure)
- Bundle all IDE setup docs (QUICKSTART, CLAUDE, CURSOR, VSCODE, WINDSURF)
- Use set -euo pipefail; chmod +x binary; clean up dist/ subdir after tar

build-rust.sh:
- Replace Windsurf-specific install hint with generic cargo install --path . --force
- Use set -euo pipefail

setup.sh:
- Replace "Antigravity" with "Claude Desktop" in comments and output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 07:24:03 +07:00
Devid HW 20a2d3d6e4 ci: add release automation scripts and workflows
- scripts/release.sh: one-command local release (bump, changelog, tag, push)
- .github/workflows/release.yml: fix SHA256 auto-commit back to master,
  dynamic mcp-publisher version detection, cargo cache, security hardening
- .claude/commands/release.md: /release slash command
- .windsurf/workflows/release.md: streamlined to use release.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 06:15:38 +07:00
Devid HW 8f71f1629d docs: unify all docs to use single installation path ~/.local/bin/mt5-quant
- Update WINDSURF.md: Use registry name io.github.masdevid/mt5-quant
- Update CURSOR.md: Use ~/.local/bin/mt5-quant path
- Update QUICKSTART.md: Use standard path for all clients
- Update VSCODE.md: Use standard path
- Update setup.sh: Prefer ~/.local/bin/mt5-quant over project path
- Add fallback warning in setup.sh if project path used

Single source of truth: ~/.local/bin/mt5-quant
2026-04-22 05:17:20 +07:00
Devid HW 896aa6111e feat: auto-detect and register MCP on multiple platforms
- Add multi-platform MCP detection (Claude, Windsurf, Cursor, VS Code)
- Auto-unregister previous installations before reinstall
- Create platform-specific docs (CURSOR.md, VSCODE.md, ANTIGRAVITY.md)
- Update Windsurf config to use correct JSON path (~/.codeium/windsurf/mcp_config.json)
- Fix VS Code config format (uses 'servers' not 'mcpServers')
- Remove MT5_MCP_HOME requirement from MCP configs (binary auto-detects)
- Slim down README installation section with platform table
- Update QUICKSTART.md with all platform instructions
2026-04-20 00:40:41 +07:00
Devid HW 94eb8927fd fix: 0 warnings build and rename package to mcp-mt5-quant 2026-04-19 06:11:43 +07:00
Devid HW 2104fabe50 fix: correct WINDSURF.md path in build script 2026-04-19 06:09:35 +07:00
Devid HW 331b7fbb73 Complete migration to Rust implementation
- Migrate optimization from optimize.sh to src/optimization/
- Remove all Python files (analytics/, server/, hooks/, pyproject.toml)
- Add optimization module: optimizer.rs, parser.rs, mod.rs
- Implement all missing MCP tool handlers (35 total tools)
- Add handle_patch_set_file handler
- Clean up orphan files: .venv/, __pycache__, test files
- Move test_rcp_server.sh to tests/integration_test.sh
- Add Rust integration tests in tests/integration_tests.rs
- Fix all compiler warnings with #[allow(dead_code)]
- Update test fixtures and structure
2026-04-18 15:57:28 +07:00
Devid HW a3b046c68f feat: complete Rust migration with modular architecture
Major changes:
- Migrate Python/shell scripts to Rust modules:
  - analytics/extract.py → src/analytics/extract.rs (ReportExtractor)
  - analytics/analyze.py → src/analytics/analyze.rs (DealAnalyzer)
  - scripts/mqlcompile.sh → src/compile/mql_compiler.rs (MqlCompiler)
  - scripts/backtest_pipeline.sh → src/pipeline/backtest.rs (BacktestPipeline)

- New modular structure:
  - src/models/ - Config, Deal, Metrics, Report structs
  - src/analytics/ - Report parsing and deal analysis
  - src/compile/ - MQL5 compilation via Wine
  - src/pipeline/ - 5-stage backtest orchestration
  - src/tools/ - 27 MCP tool definitions and handlers

- Remove PyInstaller setup (now pure Rust)
- Remove migrated shell scripts (backtest_pipeline.sh, mqlcompile.sh)
- Add GitHub Actions CI/CD for macOS & Linux releases
- Update all documentation for Rust architecture

Binary size: 4.3MB (no Python dependencies)
Tools: 27 MCP tools fully functional
2026-04-18 15:07:08 +07:00
Devid HW 3cfd374160 Add PyInstaller build support for deployment
- Add PyInstaller spec files (onefile and onedir modes)
- Add build scripts for executable creation
- Add MCP hooks for PyInstaller compatibility
- Add test script for MCP server validation
- Add Windsurf integration setup guide
- Update main.py with better error reporting
- Successfully tested MCP server works with ONEDIR build (45MB)

Features:
- Single executable deployment without Python dependency
- ONEDIR mode preserves stdio communication for MCP
- Build scripts with deployment instructions
- Windsurf config integration guide

Files added:
- mt5-quant.spec (PyInstaller spec)
- mt5-quant-onedir.spec (directory mode)
- scripts/build-executable.sh (onefile)
- scripts/build-executable-onedir.sh (directory)
- hooks/hook-mcp.py (PyInstaller hook)
- test_mcp.py (validation script)
- WINDSURF_SETUP.md (integration guide)
2026-04-18 13:00:28 +07:00
Devid HW 3a52ccf398 feat: add list_symbols and list_experts MCP tools; fix symbol check
list_symbols:
- Reads terminal.ini to detect active broker server (LastScanServer)
- Lists all servers in Bases/ with their available symbols
- Warns if OptMode=-1 needs reset
- Accepts optional server filter

list_experts:
- Recursively scans MQL5/Experts/ including sub-folders
- Returns name, subfolder, and ready-to-use run_backtest_expert value
- Accepts optional name filter (case-insensitive)

backtest_pipeline.sh:
- Fail fast with clear actionable message when MT5 is running and
  --kill-existing not set (instead of silently timing out after 900s)
- Updated help text for --kill-existing flag

_check_symbol fix:
- Was reading terminal_dir/history/ (does not exist)
- Now reads Bases/<active_server>/history/ from terminal.ini
- When symbol missing: shows which other servers have it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 12:05:47 +07:00
Devid HW ffc2b5246c feat: keep MT5 open after backtest; pass config to running instance
Default behavior change:
- ShutdownTerminal=0: MT5 stays open after backtest completes
- Report detected via file watching (poll every 5s) instead of
  waiting for process exit — decouples completion from shutdown
- Running MT5 instance: launch a second terminal64.exe with /config:
  (Windows single-instance passthrough delivers config to running
  window without killing it, then second instance exits)

New flags (script + MCP tool):
- --shutdown / shutdown:true  — ShutdownTerminal=1, synchronous wait,
  kills running instance first (CI/headless use case)
- --kill-existing / kill_existing:true — explicit opt-in to SIGTERM
  existing MT5 before launch (fallback if passthrough fails)

Progress reporting during file-watch poll (elapsed counter printed
every 5s); timeout error now includes actionable hints.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 11:51:16 +07:00
Devid HW 3f763827f4 feat: MT5-Quant MCP server for backtesting and optimization
MCP server exposing MetaTrader 5 strategy development tools to AI
assistants (Claude, Cursor, etc.) on macOS (CrossOver) and Linux (Wine).

Tools:
- run_backtest: full pipeline — compile EA, clean cache, backtest,
  parse HTML/XML report, analyze deals → metrics.json + analysis.json
- run_optimization: background genetic optimization with nohup/disown,
  UTF-16LE .set file handling, OptMode reset
- compile_ea: MQL5 compilation via MetaEditor with auto-detected
  include/ directory sync
- get_backtest_status / get_optimization_status: job polling
- verify_environment: Wine/MT5 path validation

Analytics:
- extract.py: MT5 HTML and SpreadsheetML XML report parser
- analyze.py: deal-level analysis (drawdown events, grid depth,
  loss sequences, monthly P&L) → analysis.json
- optimize_parser.py: optimization result parser with convergence analysis

Platform support:
- macOS CrossOver (GUI mode, no Xvfb needed)
- Linux Wine + Xvfb (headless, CI/CD compatible)
- Auto-detection of Wine executable and MT5 terminal paths
2026-04-18 11:41:41 +07:00