Let an AI assistant work with your MT5 account
Updated 2026-11-26 · HostMT5 guides
AI assistants can call tools through the Model Context Protocol (MCP). HostMT5 runs a remote MCP server that turns your whole HostMT5 account into tools, so Claude, ChatGPT, Cursor, VS Code or any MCP client can read prices and history, trade, write and run Expert Advisors, stop and resume trading, and set up copy trading, webhooks and alerts.
What the assistant can do
| Area | Tools |
|---|---|
| Accounts | get_overview, get_account, add_account, relogin_account, power_account, remove_account, get_stats |
| Stop / resume | stop_trading (Algo Trading off, webhook and incoming copy trading paused, optionally close everything), resume_trading |
| Market data | find_symbols, symbol_info, get_quotes, get_bars, get_ticks |
| Trading | get_positions, get_orders, get_history, place_order, modify_position, close_position, close_positions, cancel_order |
| Expert Advisors | list_eas, upload_ea (MQL5 source compiled on the server, errors with line numbers), get_ea_source, ea_inputs, attach_ea, set_ea_inputs, remove_ea, get_logs |
| Copy trading | start_copying, update_copying, stop_copying |
| Webhooks and alerts | get_webhooks, create_webhook, webhook_settings, send_signal, get_alerts, set_alerts |
Every tool goes through the same checks as the website. Removing an account needs an explicit confirmation, and a read-only key only shows the read tools.
Setup
- Sign up (currently free) and add your MT5 account.
- In the dashboard, open the AI & API tab and create a key: Trading or Read-only. It is shown once; store it safely.
- Connect your assistant to
https://hostmt5.com/mcpwith the headerAuthorization: Bearer mc_your_key.
Claude Code:
claude mcp add --transport http hostmt5 https://hostmt5.com/mcp --header "Authorization: Bearer mc_your_key"
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"hostmt5": {
"url": "https://hostmt5.com/mcp",
"headers": { "Authorization": "Bearer mc_your_key" }
}
}
}
Claude.ai and ChatGPT connectors take only a URL: use https://hostmt5.com/mcp/mc_your_key (that URL is then the password, so keep it private). Claude Desktop can run the small mcp_server.py bridge (Python 3.8+, no packages). VS Code and the other clients are in the docs.
Example prompts
- "How did my EURUSD trades do this month? Show win rate and largest loss."
- "Write an EA that buys gold when the 20 EMA crosses above the 50 EMA, compile it and attach it to XAUUSD H1 on my demo account with 0.01 lots."
- "Show me the last 50 lines of the Experts log on account 1."
- "Stop all trading on my live account and close every position."
- "Copy my master account to the prop-firm account at half size."
Developer API
The same keys work for your own code in any language: REST at https://hostmt5.com/api/v1 for history, ticks, symbols and orders, and a live WebSocket stream for prices, candles and account changes. Python and JavaScript clients, examples and the OpenAPI description are in the API docs. Keys can be revoked from the dashboard at any time, and a key cannot create new keys.
Related
FAQ
What is MCP?
The Model Context Protocol is an open standard that lets AI assistants call tools. HostMT5 ships an MCP server that exposes your hosted MT5 accounts as tools.
Can the AI place real trades?
Yes on live accounts, through the same checks as the website. The trading tools say so; start on a demo account.
Where do I get the API key?
In the HostMT5 dashboard, AI & API tab: create a Trading or a Read-only key. A read-only key cannot place or change anything.
Do I need to install anything?
No for Claude.ai, ChatGPT, Claude Code, Cursor and VS Code: they connect to https://hostmt5.com/mcp directly. Claude Desktop can use the small mcp_server.py bridge (Python, no packages).
Can the AI write and run an Expert Advisor?
Yes. It can send MQL5 source, which HostMT5 compiles on the server (errors come back with line numbers), attach the EA to a chart with its inputs, read its logs, change inputs and remove it.
Real MetaTrader 5 in any browser. EAs 24/7, copy trading, TradingView webhooks. No card needed.
Start free →- A free MT5 VPS alternative: hosted MetaTrader 5, free during launch
- Do you still need an MT5 VPS?
- How to run an MT5 Expert Advisor 24/7 without your PC
- TradingView alerts to MT5 orders with a webhook
- Copy trades between MT5 accounts at different brokers
- A MetaApi alternative for traders, not only developers
- A free PineConnector alternative with MT5 hosting included
- The full MT5 terminal in your browser
- Use MT5 from Python on Mac, Linux or a notebook
- A REST API and live stream for MetaTrader 5
- Let Claude or ChatGPT build and run your MT5 EA
- Download years of MT5 price history to CSV
- Moving Skynet MT5 alerts to HostMT5