home / mcp / metatrader 5 mcp server

MetaTrader 5 MCP Server

Provides an MCP interface to MetaTrader 5 for market data access, order placement, and trading history analysis.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "sameerasulakshana-mcpmt5": {
      "command": "uv",
      "args": [
        "run",
        "mt5mcp",
        "dev"
      ]
    }
  }
}

This MCP server lets an AI assistant interact with MetaTrader 5 to query market data, manage trades, and analyze history in an automated, scalable way. You can run the server locally for development, connect via an MCP client, and optionally deploy or configure it for tools like Claude Desktop to enable seamless trading workflows.

How to use

You will connect an MCP client to the MetaTrader 5 MCP Server to access market data, place and manage trades, and review trading history. Start by launching the server in development mode, then send requests through your MCP client to initialize the MT5 terminal, log in to your account, retrieve symbols and price data, and place orders. Use the available market data endpoints to fetch rates, ticks, and historical bars, and use trading endpoints to open, monitor, and close positions. When you are finished, shut down the connection to MT5 gracefully.

How to install

Prerequisites you need before installing:

  • Python 3.11 or higher
  • MetaTrader 5 terminal installed
  • MT5 account (demo or real)
  • Network access to MT5 terminal if required

From source, install and set up the server with these steps:

git clone https://github.com/Qoyyuum/mcp-metatrader5-server.git
cd mcp-metatrader5-server
pip install -e .

Running the server locally

Run the server in development mode to start listening on the default host and port.

uv run mt5mcp dev

By default, the server will be available at http://127.0.0.1:8000. You can change the host and port as needed:

uv run mt5mcp dev --host 0.0.0.0 --port 8080

Claude Desktop installation (example)

If you are integrating with Claude Desktop, clone the project and install the server using the runtime helper, then configure Claude to load the MCP server.

git clone https://github.com/Qoyyuum/mcp-metatrader5-server
cd mcp-metatrader5-server
uv run fastmcp install src\mcp_metatrader5_server\server.py

Configuration snippet for Claude Desktop

Your Claude Desktop configuration can include an MCP server entry like this (paths may vary):

{
  "mcpServers": {
    "MetaTrader 5 MCP Server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "MetaTrader5",
        "--with",
        "fastmcp",
        "--with",
        "numpy",
        "--with",
        "pandas",
        "--with",
        "pydantic",
        "fastmcp",
        "run",
        "C:\\FULL_PATH_TO\\src\\mcp_metatrader5_server\\server.py"
      ]
    }
  }
}