metatrader5
MCP server from geekjapan/metatrader5-mcp-server
claude mcp add --transport stdio geekjapan-metatrader5-mcp-server python -m metatrader_mcp.cli serve --login <LOGIN> --password <PASS> --server <SERVER>
How to use
This MCP server provides a WebSocket-based MCP interface to interact with MetaTrader 5 terminal data and commands, enabling AI applications to subscribe to market data, request account information, and place or manage trades through a real-time channel. The repository also includes a Python client library for convenient interaction and a REST OpenAPI server (via FastAPI) for broader integrations. Start the MCP server to expose a WebSocket API that AI agents can connect to, and use the provided Python client or REST endpoints to access MT5 data and order execution capabilities. The OpenAPI server can be launched with the standard Uvicorn command to expose HTTP endpoints for discovery and interactions, while the MCP WebSocket server handles streaming and command execution.
How to install
Prerequisites:
- Python 3.12 or later
- git (optional, for cloning)
- Access to a running MetaTrader 5 terminal
Installation steps:
-
Install Python dependencies pip install -r requirements.txt
-
Run the MCP server (requires MT5 login credentials and server address) python -m metatrader_mcp.cli serve --login <LOGIN> --password <PASS> --server <SERVER>
-
(Optional) Run the OpenAPI server for REST endpoints uvicorn metatrader_openapi.main:app
-
Connect a client (WebSocket or REST) to the appropriate endpoints as documented in the repo
Note: Replace <LOGIN>, <PASS>, and <SERVER> with your MetaTrader 5 account details and target MT5 server. Ensure the MT5 terminal is running and accessible from the machine hosting this MCP server.
Additional notes
Environment variables and configuration tips:
- Keep MT5 terminal running and accessible to the MCP server process.
- If the MT5 login requires two-factor or IP whitelisting, ensure those constraints are handled by the environment where this MCP server runs.
- The MCP server exposes a WebSocket API for real-time data streams and command execution; use the Python client library or REST endpoints to interact.
- If you need to run multiple MT5 accounts, consider duplicating the configuration with distinct login/server pairs and unique server names.
- Check requirements.txt for additional Python dependencies; ensure network access to MT5 terminal and any remote data sources.
- For debugging, start with a minimal login/server and verify connectivity before integrating with AI workflows.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP