mt5-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mt5-mcp
mt5-mcp is an MCP server so AI agents can inspect and trade against a MetaTrader 5 terminal — account, symbols, quotes, orders/positions, history — with a full offline mock for CI and demos.
Install (one command)
Grok — recommended
pip install "git+https://github.com/mergeos-bounties/mt5-mcp.git" && grok plugin install mergeos-bounties/mt5-mcp --trustThis installs the Python CLI (mt5-mcp) and the Grok plugin (skill + MCP server from .mcp.json).
Check:
mt5-mcp version
mt5-mcp doctor
mt5-mcp demo
grok plugin list
grok mcp listLocal clone:
git clone https://github.com/mergeos-bounties/mt5-mcp.git
cd mt5-mcp
pip install -e ".[dev]"
grok plugin install . --trustOther agents (stdio MCP)
After pip install "git+https://github.com/mergeos-bounties/mt5-mcp.git", point any MCP host at:
Field | Value |
command |
|
args |
|
env |
|
Claude Desktop — merge examples/claude_desktop_config.json into Claude MCP config.
Cursor — merge examples/cursor_mcp.json.
Grok config.toml (manual, without plugin):
[mcp_servers.mt5_mcp]
command = "mt5-mcp"
args = ["serve"]
env = { MT5_MCP_MODE = "mock" }
enabled = trueOne-liner via Grok CLI:
pip install "git+https://github.com/mergeos-bounties/mt5-mcp.git"
grok mcp add mt5-mcp -- mt5-mcp serveRelated MCP server: OpenTrading
Supported AI agents / hosts
Host | Support | Install |
Grok (CLI / TUI / Build) | Yes |
|
Claude Desktop | Yes | Copy examples/claude_desktop_config.json into Claude MCP settings |
Cursor | Yes | Merge examples/cursor_mcp.json into Cursor MCP config |
Claude Code | Yes | stdio MCP: same |
VS Code (MCP / Continue / Cline) | Yes | Generic stdio server config pointing at |
Windsurf / Cascade | Yes | stdio MCP entry with |
Codex CLI | Yes (stdio) | Register MCP server command |
ChatGPT Desktop | Partial | Only if host supports custom MCP stdio servers |
Gemini CLI | Partial | Only if MCP stdio plugins are enabled |
All packages speak MCP over stdio (mt5-mcp serve). Default mode is mock (offline, no simulator/terminal/GIMP required).
Modes
Mode | When | Behavior |
mock (default) | Windows / CI / no terminal | Seeded demo account, FX/CFD symbols, orders, history |
live | Host has a bridge configured | Optional file/HTTP bridge (see env vars); fails closed if unavailable |
Highlights
Capability | Description |
Offline demo |
|
MCP stdio serve | Plug into Cursor / Claude / Grok as an MCP server |
One-shot call |
|
Safety | Mock never talks to a real broker; live needs explicit env |
Quick start
cd mt5-mcp
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[dev]"
mt5-mcp version
mt5-mcp demo
mt5-mcp tools list
pytest -qMock mode needs no MetaTrader install.
CLI reference
Command | Purpose |
| Version + mode |
| Mode, balance, equity, positions, orders |
| Offline smoke of core backend APIs |
| Backend health |
| MCP server over stdio |
| One-shot tool call |
| List MCP tools |
mt5-mcp serveMCP tools
Tool | Purpose |
| Get/set mock|live |
| Connectivity / account health |
| Reset mock account |
| Balance, equity, margin, trade mode |
| |
| |
| |
| Open positions (filled market orders) |
| Pending orders (limit/stop, not yet filled) |
| Market/pending |
| Close position by ticket |
| Deal history |
| Account + positions snapshot |
MCP host config
{
"mcpServers": {
"mt5-mcp": {
"command": "python",
"args": ["-m", "mt5_mcp"],
"env": {
"MT5_MCP_MODE": "mock"
}
}
}
}Also see examples/cursor_mcp.json.
Live bridge (optional)
Set env (never commit secrets):
Variable | Meaning |
|
|
| Optional magic number for live orders |
| Max order volume cap |
| Comma-sep allowlisted symbols |
| Optional HTTP bridge base URL |
| Optional request/response JSON file path |
Without a working bridge, live mode returns structured errors; demos stay on mock.
Safety
Rule | Detail |
Mock-only env | Copy |
No secrets in git | Add |
Max volume | Set |
Symbol allowlist | Restrict tradeable symbols via |
Deal history
Deal history fields
Field | Type | Description |
| int | Deal ID |
| str | Timestamp |
| str | Instrument |
| str | Deal type (buy/sell) |
| float | Lot size |
| float | Execution price |
| float | Broker commission (mock) |
| float | Overnight swap (mock) |
| float | Net P&L (mock) |
Development
pip install -e ".[dev]"
ruff check src tests
pytest -q
mt5-mcp demoLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Hosted MCP server for MT4 and MT5: read accounts, prices and candles, and place or close orders.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA standalone Model Context Protocol (MCP) server that enables AI assistants to interact with the cTrader trading platform.15-
- AlicenseNot gradedqualityDmaintenanceAn open-source AI trading agent for MetaTrader 5 with MCP support, connecting AI clients to MT5 for market data, analysis, and risk-gated trading.MIT
- AlicenseAqualityCmaintenanceAn MCP server that lets an AI agent read your MetaTrader 5 account and place trades over the Model Context Protocol, with a configurable human approval gate.1566 PyPI6MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for operating headless MetaTrader 5 terminals — over SSH, from your agent.MIT