mt5-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mt5-mcpFetch daily EURUSD OHLCV data for the last 3 months"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MetaTrader 5 (MT5) MCP Server & Web GUI Workstation
A high-performance Model Context Protocol (MCP) Server and interactive Web GUI Workstation for MetaTrader 5 on Windows. This project connects AI assistants (Antigravity, Claude Desktop, Cursor, etc.) and quantitative traders directly to their local MT5 installation to:
Pull historical market data (OHLCV bars across timeframes M1–MN1 and millisecond-precision tick streams) with high-speed Parquet and CSV exports.
Execute strategy backtests via built-in Python quantitative engines and native MT5 Strategy Tester automation (
terminal64.exe /config:tester.ini).Inspect demo account status, equity curves, active symbols, market watch quotes, and open positions.
Interactive Financial Web GUI: Built with TradingView Lightweight Charts, real-time telemetry, Strategy Studio with equity curve visualizer, and account login manager.
Strict Trading Safety Guard: Ensures demo and live orders can only execute with explicit confirmation.
Architecture Overview
┌────────────────────────────────────────────────────────┐
│ 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: Meta-Trader-MCP
Installation & Prerequisites
1. Requirements
Windows 10 / 11 (64-bit)
MetaTrader 5 desktop terminal installed
Python 3.10, 3.11, or 3.12 (64-bit)
uv(recommended) or standardpip
2. Enable Algorithmic Trading in MT5
In your MetaTrader 5 terminal:
Navigate to Tools -> Options -> Expert Advisors.
Check Allow algorithmic trading.
Check Allow DLL imports (if required by custom indicators).
3. Setup Virtual Environment
# 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 Workstation (Interactive Dashboard)
The repository includes a dedicated financial-grade Web GUI Dashboard with TradingView charting, real-time market watch, strategy backtesting studio, and account management:
# Launch via console script
mt5-mcp-gui
# Or launch via Python module
.venv\Scripts\python -m mt5_mcp.gui --port 8000Then open http://127.0.0.1:8000 in your browser.
GUI Features:
📊 TradingView Lightweight Charts: Smooth candlestick and volume charting with interactive timeframe selector (
M1,M5,M15,M30,H1,H4,D1).📈 Strategy Backtest Studio: Configure strategy parameters (
SMA Crossover,RSI Reversal,Bollinger Bands), run simulations, and inspect Equity Growth Curves, KPIs (Sharpe ratio, Max Drawdown %, Win Rate %), and closed trades logs.📦 Historical Data Exporter: Instant one-click extraction of candlestick data to Parquet and CSV files.
🔍 Market Watch: Real-time symbol exploration with wildcard search (e.g.
*USD*,Crypto*) and live floating spread indicators.⚙️ MT5 Connect & Account Login Modal: Seamlessly connect to your active MT5 terminal or switch/log in to any demo account with custom Login ID, Password, Broker/Server, and optional executable path (with Enter key submission and Esc key dismissal).
📋 Open Positions & Native MT5 Tester Panel: View open trades and automate native MQL5 Expert Advisors headlessly with batch
.iniconfigurations.
MCP Client Configuration
Claude Desktop / Antigravity / Cursor (mcp_config.json)
Add the MT5 MCP server to your MCP client configuration:
{
"mcpServers": {
"mt5": {
"command": "C:\\Users\\<USER>\\source\\repos\\mt5_mcp\\.venv\\Scripts\\python.exe",
"args": [
"-m",
"mt5_mcp.server"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}Available MCP Tools
1. Connection & Account Management
Tool | Parameters | Description |
|
| Initializes connection to MT5 terminal or logs in to a specific demo account. |
| None | Returns demo account balance, equity, leverage, free margin, and profit. |
| None | Returns MT5 build version, connection state, ping, and data directories. |
2. Market Exploration & Historical Data
Tool | Parameters | Description |
|
| Searches available symbols with wildcard filtering. |
|
| Returns contract specifications (spread, point, digits, swap rates). |
|
| Retrieves real-time bid, ask, and last price. |
|
| Extracts historical OHLCV data across timeframes ( |
|
| Extracts millisecond-precision tick streams with optional Parquet/CSV export. |
3. Strategy Testing & Simulation
Tool | Parameters | Description |
| None | Lists built-in backtest models ( |
|
| Executes backtest on historical MT5 data and returns Sharpe ratio, Max Drawdown %, Win Rate %, Profit Factor, and trade log. |
|
| Automates native MT5 Strategy Tester using generated |
4. Positions & Trading (Guarded)
Tool | Parameters | Description |
|
| Lists open positions on the demo account. |
|
| Lists closed deals and historical order executions. |
|
| Places demo orders with strict safety guard requiring |
Running Tests
Run the comprehensive pytest suite verifying connectivity, historical extraction, quantitative backtesters, and GUI REST APIs:
.venv\Scripts\pytest -vLicense
MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables AI applications to interact with MetaTrader 5 terminals via WebSocket MCP protocol for trading operations and account management.4
- Alicense-qualityAmaintenanceExposes 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
- Alicense-qualityAmaintenanceEnables AI assistants to trade on MetaTrader 5 using natural language, supporting account management, order placement, and real-time market data.1MIT
- Alicense-qualityCmaintenanceA 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
Related MCP Connectors
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Build, backtest, and deploy quantitative trading strategies from your AI agent.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/remomein05/mt5-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server