mt4-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., "@mt4-mcpshow my current account balance"
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.
mt4-mcp
mt4-mcp is an MCP server so AI agents can inspect and trade against a MetaTrader 4 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/mt4-mcp.git" && grok plugin install mergeos-bounties/mt4-mcp --trustThis installs the Python CLI (mt4-mcp) and the Grok plugin (skill + MCP server from .mcp.json).
Check:
mt4-mcp version
mt4-mcp doctor
mt4-mcp demo
grok plugin list
grok mcp listLocal clone:
git clone https://github.com/mergeos-bounties/mt4-mcp.git
cd mt4-mcp
pip install -e ".[dev]"
grok plugin install . --trustOther agents (stdio MCP)
After pip install "git+https://github.com/mergeos-bounties/mt4-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.mt4_mcp]
command = "mt4-mcp"
args = ["serve"]
env = { MT4_MCP_MODE = "mock" }
enabled = trueOne-liner via Grok CLI:
pip install "git+https://github.com/mergeos-bounties/mt4-mcp.git"
grok mcp add mt4-mcp -- mt4-mcp serveRelated MCP server: ctrader-mcp-server
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 (mt4-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 mt4-mcp
python -m venv .venv
.\.venv\Scripts\activate
pip install -e ".[dev]"
mt4-mcp version
mt4-mcp status
mt4-mcp demo
mt4-mcp tools list
pytest -qMock mode needs no MetaTrader install. For a copy-pasteable offline trading walkthrough, see docs/MOCK_TRADING_DEMO.md.
CLI reference
Command | Purpose |
| Version + mode |
| Mode, balance, equity, and open order count |
| Offline smoke of core backend APIs |
| Backend health |
| MCP server over stdio |
| One-shot tool call |
| List MCP tools |
mt4-mcp serveMCP tools
Tool | Purpose |
| Get/set mock|live |
| Connectivity / account health |
| Reset mock account |
| Balance, equity, margin |
| Symbol list |
| Bid/ask for a symbol |
| Recent quote ticks for a symbol |
| Open orders |
| Market/pending OrderSend-style |
| SL/TP/price modify |
| Close by ticket |
| Closed order history |
Mock pending fills
In mock mode, pending orders are converted to market orders when quotes cross
their trigger price. The mock supports deterministic tests for buy_limit,
sell_limit, buy_stop, and sell_stop crossing behavior.
MCP host config
{
"mcpServers": {
"mt4-mcp": {
"command": "python",
"args": ["-m", "mt4_mcp"],
"env": {
"MT4_MCP_MODE": "mock"
}
}
}
}Also see examples/cursor_mcp.json.
Live bridge (optional)
Set env (never commit secrets):
Variable | Meaning |
|
|
| 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 |
Development
pip install -e ".[dev]"
ruff check src tests
pytest -q
mt4-mcp demoLicense
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
- MIT
- Flicense-qualityFmaintenanceA standalone Model Context Protocol (MCP) server that enables AI assistants to interact with the cTrader trading platform.Last updated14
- Alicense-qualityDmaintenanceAn open-source AI trading agent for MetaTrader 5 with MCP support, connecting AI clients to MT5 for market data, analysis, and risk-gated trading.Last updatedMIT
- AlicenseAqualityAmaintenanceAn 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.Last updated154MIT
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
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/mergeos-bounties/mt4-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server