How qoyyuum/mcp-metatrader5-server works
This repository implements an MCP server that exposes MetaTrader 5 connection, market-data, trading, and history capabilities to AI clients. The principal workflow is an MCP client calling the server, establishing a terminal connection and optionally logging in, then requesting market or trading operations; results are returned through MCP. The runtime is concentrated in main.py, with CLI transport selection in __init__.py. The README documents additional prompts and resources. Source excerpts are partial, so details beyond the shown calls are represented only where documented.
Main entry points: main.py MCP Tool Server · __init__.py CLI Transport Entry
Components 10
MCP Runtime
- CLI Transport Entry
src/mcp_mt5/__init__.py - MCP Tool Server
src/mcp_mt5/main.py
Connection & Account
- Connection Tools
src/mcp_mt5/main.py - Account & Terminal Info
src/mcp_mt5/main.py
Market Data
- Market Data Tools
src/mcp_mt5/main.py
Trading
- Order & Position Tools
src/mcp_mt5/main.py
History & Guidance
- Trading History Tools
src/mcp_mt5/main.py - Prompts & Resources
src/mcp_mt5/main.py
Other components
- AI MCP Client
- MetaTrader 5 Terminal
Connections 13
- AI MCP Client → CLI Transport Entry: invokes
README.md - CLI Transport Entry → MCP Tool Server: runs transport
src/mcp_mt5/__init__.py - MCP Tool Server → Connection Tools: exposes tools
README.md - MCP Tool Server → Account & Terminal Info: exposes tools
README.md - MCP Tool Server → Market Data Tools: exposes tools
README.md - MCP Tool Server → Order & Position Tools: exposes tools
README.md - MCP Tool Server → Trading History Tools: exposes tools
README.md - MCP Tool Server → Prompts & Resources: provides
README.md - Connection Tools → MetaTrader 5 Terminal: initializes
src/mcp_mt5/main.py - Account & Terminal Info → MetaTrader 5 Terminal: queries
src/mcp_mt5/main.py - Market Data Tools → MetaTrader 5 Terminal: requests data
README.md - Order & Position Tools → MetaTrader 5 Terminal: sends orders
README.md - Trading History Tools → MetaTrader 5 Terminal: queries history
README.md