MCP Hub
Back to servers

MT5-Quant

MCP server for MT5 strategy development. Compile, backtest, analyze MQL5 EAs on macOS/Linux.

Registry
Updated
Apr 19, 2026

MT5-Quant

MCP server for MT5 strategy development on macOS/Linux. 57 tools to compile, backtest, analyze, optimize, and manage MQL5 Expert Advisors — no Windows required.

You: "Backtest MyEA Jan-Mar, what caused the February drawdown?"

Claude: [compile → clean → backtest → analyze 1,847 deals]
        → Feb 14: BUY grid at L6, locking lot 1.75× base
        → Cutloss fired 17 points later
        → Recommendation: cap locking multiplier to ≤1.2×

Why MT5-Quant

MT5-QuantOther MT5 MCPsQuantConnect
Backtest pipeline✅ FullCloud only
Deal-level analytics✅ 15+ dims
MQL5 compilation
macOS/Linux nativeWindows onlyCloud
Optimization✅ Background✅ Paid

Quick Install

1. Download & Setup

curl -L -o mt5.tar.gz https://github.com/masdevid/mt5-mcp/releases/latest/download/mt5-quant-macos-arm64.tar.gz
tar -xzf mt5.tar.gz
bash scripts/setup.sh

2. Register MCP Server

Claude Code

# Navigate to your project directory first
cd /path/to/your/mt5-quant

# Register MCP server (requires absolute path)
claude mcp add MT5-Quant -- $(pwd)/mt5-quant

# Verify installation
claude mcp list

Windsurf

Add to ~/.windsurf/config.yaml:

mcpServers:
  mt5-quant:
    command: /absolute/path/to/mt5-quant
    env:
      MT5_MCP_HOME: /absolute/path/to/mt5-quant

Or use the config command:

# Get absolute path
which mt5-quant

# Add to Windsurf config
cat >> ~/.windsurf/config.yaml << EOF
mcpServers:
  mt5-quant:
    command: $(which mt5-quant)
    env:
      MT5_MCP_HOME: $(dirname $(which mt5-quant))
EOF

Full Setup →

Note: MCP servers require absolute paths. Use $(pwd) or full path like /Users/name/mt5-quant/mt5-quant, not relative paths like ./mt5-quant.

Quick Start

Run a backtest on MyEA from 2025.01.01 to 2025.03.31

The AI runs the full pipeline: compile → clean cache → backtest → extract → analyze.

Documentation

DocPurpose
QUICKSTART.mdComplete setup for macOS/Linux
CONFIG.mdConfiguration reference
WINDSURF.mdWindsurf IDE integration
TOOLS.mdAll 57 tools documented
ARCHITECTURE.mdDesign and internals
TROUBLESHOOTING.mdCommon issues
REMOTE_AGENTS.mdLinux optimization agents

MCP Tools (57)

Core workflow

ToolDescription
run_backtestFull pipeline: compile → clean → backtest → extract → analyze
run_optimizationGenetic optimization (background, returns immediately)
get_optimization_resultsParse optimization results after MT5 finishes
analyze_reportRead analysis.json from any report directory
compare_baselineCompare report vs baseline, return winner/loser verdict
compile_eaCompile MQL5 EA via MetaEditor
list_expertsList all EAs in MQL5/Experts directory
list_indicatorsList all indicators in MQL5/Indicators directory
list_scriptsList all scripts in MQL5/Scripts directory
healthcheckQuick server health check

Granular Analytics (individual analysis)

ToolDescription
analyze_monthly_pnlMonthly P/L breakdown only
analyze_drawdown_eventsDrawdown events and causes only
analyze_top_lossesWorst losing deals only
analyze_loss_sequencesConsecutive loss patterns only
analyze_position_pairsPosition hold time and P/L pairs
analyze_direction_biasBuy vs Sell performance
analyze_streaksWin/loss streak analysis
analyze_concurrent_peakPeak simultaneous positions

Use these for targeted analysis, or analyze_report to run all at once.

Monitoring

ToolDescription
verify_setupCheck Wine/MT5 paths, Wine version, and EA/set file counts
get_backtest_statusCheck live progress of a running backtest pipeline
get_optimization_statusCheck live state of a background optimization job
list_jobsAll optimization jobs with compact status in one call

Reports & logs

ToolDescription
list_reportsCompact table of all runs with key metrics — no full analysis needed
get_latest_reportGet most recent report with optional equity chart
search_reportsFind reports by EA, symbol, date range, or profit criteria
tail_logRead last N lines of any log; filter=errors to see only failures
prune_reportsDelete old report directories, keep last N (skips _opt dirs)

History & baseline

ToolDescription
archive_reportConvert one report dir → compact JSON entry in backtest_history.json, optionally delete source
archive_all_reportsBulk-archive all report dirs then optionally delete them; keeps N newest safe
get_historyQuery history with filters (EA, symbol, verdict, profit, DD) and sort options
annotate_historyAttach verdict / notes / tags to any history entry
promote_to_baselineWrite a history entry or report to baseline.json for compare_baseline

Cache management

ToolDescription
cache_statusMT5 tester cache size breakdown by symbol — check before cleaning
clean_cacheDelete tester cache files; supports per-symbol and dry_run

Pre-flight & Validation

ToolDescription
get_active_accountGet current MT5 account session (login, server, available symbols)
check_symbol_data_statusValidate symbol has sufficient history data for date range
check_mt5_statusCheck if MT5 terminal is installed and ready
validate_ea_syntaxPre-compile syntax check without running full compilation

Project Management

ToolDescription
init_projectScaffold new MQL5 project with templates (scalper/swing/grid/basic)
create_set_templateGenerate .set parameter file from EA input variables
export_reportExport backtest report to CSV, JSON, or Markdown

History & Comparison

ToolDescription
get_backtest_historyList all backtests for EA/symbol with summary metrics
compare_backtestsCompare 2+ backtest results side-by-side with analysis

.set file — read / write

ToolDescription
list_set_filesAll .set files in tester profiles dir with sweep stats and combination counts
read_set_fileParse UTF-16LE .set file → structured JSON params
write_set_fileWrite full params dict → UTF-16LE .set with chmod 444
patch_set_fileUpdate specific params in-place, return diff — replaces read→edit→write
clone_set_fileCopy .set to new path with optional overrides in one call

.set file — analysis & generation

ToolDescription
describe_sweepSwept params, value counts, and total optimization combinations
diff_set_filesSide-by-side diff of two .set files — only changed params returned
set_from_optimizationGenerate a clean backtest .set from get_optimization_results params; optionally narrow sweep

Search & Discovery

ToolDescription
search_expertsSearch EAs by name pattern across all directories
search_indicatorsSearch indicators by name pattern
search_scriptsSearch scripts by name pattern
copy_indicator_to_projectCopy indicator to project directory
copy_script_to_projectCopy script to project directory

Full schema: docs/MCP_TOOLS.md

Troubleshooting

Run verify_setup from Claude first — it checks all paths and returns actionable hints.

Full Troubleshooting Guide →


License

MIT


Built from battle-tested production infrastructure. Every edge case in the pipeline was hit in production.

Reviews

No reviews yet

Sign in to write a review