Server data from the Official MCP Registry
Let an AI agent read and trade a MetaTrader 5 account over MCP, behind a human-approval gate.
Let an AI agent read and trade a MetaTrader 5 account over MCP, behind a human-approval gate.
Valid MCP server (1 strong, 2 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.
4 files analyzed · 1 issue found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
This plugin requests these system permissions. Most are normal for its category.
Set these up before or after installing:
Environment variable: MT5_LOGIN
Environment variable: MT5_PASSWORD
Environment variable: MT5_SERVER
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-vincentwongso-mt5-trading-mcp": {
"env": {
"MT5_LOGIN": "your-mt5-login-here",
"MT5_SERVER": "your-mt5-server-here",
"MT5_PASSWORD": "your-mt5-password-here"
},
"args": [
"mt5-trading-mcp"
],
"command": "uvx"
}
}
}From the project's GitHub README.
Let an AI agent manage your MetaTrader 5 account over Model Context Protocol - with configurable human approval gate.
⚠️ This software places real trades through your MetaTrader 5 terminal with real orders and irreversible fills. Read DISCLAIMER.md and SECURITY.md before connecting it to a live account. Always test using your demo account first.
Runs locally - in the same process tree as your agent, no cloud, no telemetry. Windows (native) or Linux (via Docker); Python 3.10+.
📖 The story behind this: this project is built step by step in Wiring AI agent into MetaTrader 5, Part 1 of the Trade with AI agent series on the Fintrix engineering blog.
mt5-mcp lets an AI agent read your MetaTrader 5 account and place trades
through it, over the Model Context Protocol.
place_order, modify_order, cancel_order,
close_position, each behind a preflight + human-consent + idempotency +
audit layer.account://, positions://, and
quotes://{symbol} snapshots that push change notifications..claude/skills/:
mt5-market-data and mt5-trading teach an agent how to read the account and
run the consent flow safely.Full catalogue and the consent flow: docs/tools.md.
place_order as a live
attack surface and says so plainly - the MCP is explicitly not the security
boundary (see SECURITY.md).rpyc version-matching).pip install mt5-trading-mcp
python -m mt5_mcp doctor: expect
[INFO] backend: native and [PASS] lines.python -m mt5_mcp serve.Wire it to OpenClaw in one command (registers the mcp.servers entry):
openclaw mcp set mt5-mcp '{"command":"python","args":["-m","mt5_mcp","serve"]}'
The MT5 terminal + the MCP run headless in an all-in-one image; your agent talks MCP over HTTP. No host Python, no bridge.
cp deploy/.env.example deploy/.env # add MT5_LOGIN / MT5_PASSWORD / MT5_SERVER
docker compose -f deploy/docker-compose.yml up -d
Log the terminal in once via the KasmVNC web UI at http://127.0.0.1:3001
(File -> Login to Trade Account; persists across restarts), then point your
agent at http://127.0.0.1:8765/mcp. Wire it to OpenClaw in one command:
openclaw mcp set mt5-mcp '{"url":"http://127.0.0.1:8765/mcp","transport":"streamable-http"}'
Full walkthrough: docs/installation.md.
If you've been handed this repository to install and run, follow the runbook in docs/agents.md. It covers platform detection, install, verification, registering the server, and the hard safety rules for trades - read it before calling any mutating tool.
| Guide | What's in it |
|---|---|
| Installation & setup | Requirements, Windows + Linux/Docker setup, wiring to an agent. |
| For AI agents | Step-by-step runbook for an agent installing and running the server. |
| Configuration | config.toml schema, storage paths, hot-reload. |
| Tools & resources | Read tools, mutating tools + consent flow, subscribable resources. |
| MCP client setup | Per-client config snippets and Claude Code usage. |
| Transports & deployment | stdio/HTTP transports and Windows VPS patterns. |
| Contributing | How to contribute and run the tests. |
| Changelog | Release history and known limitations. |
mt5-mcp is not the security boundary, the broker's MT5 server enforces
the hard limits (margin, max-lot, symbol permissions). Pre-flight checks in the
policy engine are UX guardrails to catch agent mistakes early, not security
controls.
The human-consent gate is opt-in and off by default: auto_approve_notional
defaults to 0, so mutating calls auto-execute (full-open) - intended for trusted
or unattended agents. Arm the gate by setting auto_approve_notional > 0:
orders/closes whose notional is at or above it then return an ApprovalPreview
you must confirm, and modifying a stop to widen or remove it also requires
approval. The pre-flight limits (max_*) and symbol allow/deny lists are likewise
opt-in (0 / empty = off). Every mutating call is recorded in an append-only audit
JSONL log regardless. For vulnerability disclosure, see
SECURITY.md.
mt5-mcp wraps the MetaTrader 5 Python library behind a FastMCP server. A single MT5Client (src/mt5_mcp/adapter/) owns the terminal connection, broker-timezone inference, and type conversions; everything else sits on top of it. The Pydantic models in src/mt5_mcp/types.py / src/mt5_mcp/config.py are the source of truth for the data and config schemas.
Agent / MCP client (Hermes, OpenClaw, Claude Code, Claude Desktop, …)
│
│ stdio · loopback HTTP
▼
┌──────────────────────────────────────────────────────────┐
│ FastMCP server │
│ │
│ tools/ resources/ policy/ │
│ read + subscribable consent · idempotency │
│ mutating account/quotes · audit (JSONL) │
│ │
│ streaming/ - change-detection poller + dispatcher │
│ types.py · config.py - Pydantic schemas: source of │
│ truth for data + config │
│ │
└──────────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────┐
│ │
│ adapter/ MT5Client │
│ one terminal connection · broker-TZ inference · │
│ type conversions · transparent reinit │
│ │
└──────────────────────────────────────────────────────────┘
│
▼
MetaTrader 5 Python library -> broker terminal -> broker server
The module paths shown (tools/, resources/, policy/, streaming/,
adapter/, types.py, config.py) all live under src/mt5_mcp/.
Contributions are welcome, see CONTRIBUTING.md for the dev setup, test workflow, and project principles.
MIT - see LICENSE.
Be the first to review this server!
by Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace · Developer Tools
Create, build, and publish Python MCP servers to PyPI — conversationally.
by Microsoft · Content & Media
Convert files (PDF, Word, Excel, images, audio) to Markdown for LLM consumption