- Home
- MCP servers
- MetaTrader 5
MetaTrader 5
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"cloudmeru-metatrader-5-mcp-server": {
"command": "python",
"args": [
"-m",
"mt5_mcp"
]
}
}
}You will run a read-only bridge that exposes MT5 market data through the Model Context Protocol (MCP). This server keeps trading actions blocked while giving you reliable access to price data, history, indicators, forecasts, and charts via Python commands or HTTP transports. It’s designed for safe, scriptable analysis and integration with MCP clients.
How to use
You interact with the MT5 MCP Server by starting it in one of several modes and connecting via an MCP client. Use the stdio mode for local, script-based work, or enable an HTTP transport to access the data remotely from an API-enabled client. You can also run both transports simultaneously for flexible workflows.
In stdio mode you execute the server locally and send commands through standard input/output. In HTTP mode you expose a REST/Gradio-style endpoint that MCP clients can query. The server provides read-only access to MT5 data, including market data history, indicators, charts, and forecasting signals, while blocking all trading operations.
Operational guidance:
- Use read-only tools to fetch price histories, compute indicators, and generate charts.
- Chain queries with analyses to produce combined results and visualizations.
- Rely on built-in guardrails and validation to prevent unsafe inputs or actions.
How to install
Prerequisites you need before installation:
- Windows OS (MetaTrader 5 library is Windows-only)
- MetaTrader 5 terminal running
- Python 3.10 or newer
Install the MCP server in stdio mode (local use):
- Ensure you have Python installed
- Install the package in editable mode and run the module as the entry point
# Install in editable mode
pip install -e .
# Run in stdio mode (default, backward compatible)
python -m mt5_mcp
# Alternative CLI name (same stdio mode)
mt5-mcp
Additional sections
Configuration
- You can run a dual transport setup (stdio + HTTP) or HTTP only, depending on your client needs. The server supports rate limiting when serving HTTP clients and includes robust error handling for resilience.
Security and data access
- This server provides read-only access to MT5 data. Trading calls are blocked, preventing order placement or position modification through the MCP namespace.
Troubleshooting tips
- Ensure the MT5 terminal is running and algo trading is enabled if you plan to access MT5 data.
- If you encounter connection issues, check that the MT5 terminal has historical data for the requested symbol and period.
- Start with stdio mode to verify basic functionality, then enable HTTP transport for remote access.
Example startup commands for all supported modes:
- Default stdio mode (no HTTP):
- Run both transports (stdio + HTTP):
- Run only HTTP transport on a specific port and host
Tool overview
The server exposes a curated set of tools for MT5 data work. You can execute Python code in a safe, sandboxed namespace, perform structured MT5 queries, and run end-to-end analyses with indicators and forecasts.
Available tools
execute_mt5
Free-form Python execution inside a curated namespace for quick calculations, prototyping, and bespoke formatting.
mt5_query
Structured JSON interface that maps directly to MT5 read-only operations with automatic validation and friendly error messages.
mt5_analyze
Pipeline tool that chains a query, optional indicators, charts, and forecasts (including ML signals) in a single request.