metatrader5-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., "@metatrader5-mcpshow my current positions"
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.
metatrader5-mcp
A local MCP (Model Context Protocol) server that connects Claude (or any MCP client) to a running MetaTrader 5 terminal.
Phase 1 scope only: read-only market/account data, basic performance analysis, and order planning (margin/profit calculations, order validation, plan assembly). No tool in this server sends, modifies, or cancels an order, and live trading is always blocked. This is a read/analysis/planning foundation, not a trading bot.
Naming
The two names below differ intentionally:
Repository / project identity:
metatrader5-mcpInstallable package / command:
mt5-mcp(the Python import package ismt5_mcp, andpip install -e .also exposes anmt5-mcpconsole command)
Related MCP server: metatrader-mcp
Requirements
Windows, with a running MetaTrader 5 terminal (the
MetaTrader5Python package only works on Windows, next to the terminal). On other platforms the server still runs and lists its tools, but every tool that touches MT5 will raise a clearMT5NotAvailableError.Python 3.10+
Install
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -e .Configure
Copy .env.example to .env and adjust as needed. Nothing here is a secret
that gets committed - .env is gitignored, and the server never logs your
password.
cp .env.example .envKey settings:
Variable | Default | Purpose |
| unset | Optional explicit terminal/account to connect to. If unset, attaches to the terminal already running on the machine. |
|
|
|
|
| Order-planning tools are disabled even on a demo account unless this is |
|
| Where |
|
| Directory that |
Run the server locally
python -m mt5_mcp.serverThis starts the MCP server over stdio. Point any MCP client (Claude Desktop,
Claude Code, the mcp Python client, etc.) at this command. Example Claude
Desktop / Claude Code config:
{
"mcpServers": {
"metatrader5": {
"command": "python",
"args": ["-m", "mt5_mcp.server"],
"cwd": "/path/to/metatrader5-mcp"
}
}
}See examples/example_client.py for a minimal standalone client that lists
tools and calls a couple of them.
What's implemented
SAFE_READ (always allowed, logged, no approval needed):
get_account_info, get_terminal_info, get_symbol_info, get_tick,
get_rates, get_positions, get_orders, get_history_deals, read_log,
read_strategy_report.
SAFE_ANALYSIS (pure computation over data you already read, no approval
needed): summarize_positions, analyze_drawdown, analyze_trade_history,
calculate_profit_risk_basic.
REQUIRES_APPROVAL (order planning - margin/profit math and MT5's own
dry-run order_check; a human must approve every call, and the risk guard
still requires a demo account with MT5_MCP_ENABLE_DEMO_TRADING=true):
calculate_margin, calculate_profit, check_order, prepare_order_plan.
BLOCKED (not implemented at all - no tool by these names exists, and the router refuses them by name as a safety net): sending, modifying, or cancelling any order; live trading in general.
See docs/TOOLS.md for full parameter reference, docs/SAFETY.md for how
the approval gate and risk guard work, and docs/ARCHITECTURE.md for the
module layout and request flow.
Run the tests
pip install -e ".[dev]"
pytestTests run against a fake in-memory MT5 module (see tests/conftest.py), so
they pass on any platform without a real terminal.
Known limitations (Phase 1)
No order execution (
order_send) - intentionally not implemented.No VPS/remote mode, no plugin system, no multi-strategy framework.
get_ratesonly supports the "most recent N bars" mode (copy_rates_from_pos), not arbitrary date ranges.read_strategy_reportuses a generic HTML table parser (label/value cell pairing); unusual report layouts may need raw row inspection.The file-based approval mode polls the filesystem; it is not push-based.
No persistence/database - approvals and logs are plain files.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/alikhande70/metatrader5-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server