Get the FREE Ultimate OpenClaw Setup Guide →

mcp-metatrader5

A Model Context Protocol (MCP) server for interacting with the MetaTrader 5 trading platform. This server provides AI assistants with tools and resources to access market data, perform trading operations, and analyze trading history.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio qoyyuum-mcp-metatrader5-server uvx --from mcp-metatrader5-server mt5mcp

How to use

This MCP server provides a bridge to MetaTrader 5, allowing AI assistants to interact with MT5 for market data access, order placement, and trading workflow analysis. The server exposes a set of MT5-related capabilities through the MCP interface, such as retrieving available symbols, fetching price data (rates and ticks), and performing trading operations like placing orders, checking feasibility, and querying positions or history. Typical use involves running the server in stdio mode for MCP clients (e.g., Claude Desktop) and issuing MCP requests through the client’s integrated prompts or flows. When using HTTP transport for development, you can enable an HTTP endpoint by configuring environment variables and running the server in development mode, which helps test data retrieval and trading flows over a web transport before integrating into a larger assistant pipeline.

How to install

Prerequisites:

  • Python 3.11 or higher
  • MetaTrader 5 terminal installed on Windows (for MT5 integration) and a configured MT5 account (demo or real)
  • uv (recommended) or pip for Python package management

From PyPI (quick start):

  1. Install the MCP server package via uvx: uvx --from mcp-metatrader5-server mt5mcp

From source:

  1. Clone the repository: git clone https://github.com/Qoyyuum/mcp-metatrader5-server.git
  2. Navigate to the project folder: cd mcp-metatrader5-server
  3. Install dependencies and set up the server with uv: uv sync uv run mt5mcp

Development/testing workflow (optional):

  • Run the server in stdio mode for MCP clients: uv run mt5mcp
  • For HTTP testing, create a .env file with HTTP transport variables and start the server: MT5_MCP_TRANSPORT=http MT5_MCP_HOST=127.0.0.1 MT5_MCP_PORT=8000 uv run mt5mcp

Additional notes

Notes and tips:

  • The server communicates with MetaTrader 5 through the MT5 API bindings. Ensure MT5 terminal is installed and accessible from the machine running the MCP server.
  • Default operation is stdio mode, which is suitable for Claude Desktop and similar MCP clients. To test HTTP transport, enable the MT5_MCP_TRANSPORT=http setting and run the server, which will expose an HTTP endpoint at the configured host and port.
  • Common MCP operations include initializing the MT5 session, logging in, obtaining symbol data, fetching bars/ticks, and submitting/tracking orders. Use the provided prompts and function calls to orchestrate trading workflows.
  • If you’re deploying in a production-like environment, consider pinning the Python/MT5 dependencies and using a proper environment configuration strategy (e.g., .env files or orchestrator secrets).
  • The project name on PyPI is mcp-metatrader5-server and the CLI entry point is typically mt5mcp when invoked via uv run or uvx from the package.

Related MCP Servers

Sponsor this space

Reach thousands of developers