MetaTrader 5

v1.0.0Finance & Fintechstable

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.

mcp-servermetatrader-5
Share:
136
Stars
0
Downloads
0
Weekly
0/5

What is MetaTrader 5?

MetaTrader 5 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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 operation...

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.

This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A Model Context Protocol (MCP) server for interacting with t

Use Cases

Execute trading operations and access market data from MetaTrader 5 platform.
Analyze trading history and monitor open positions through AI assistants.
Qoyyuum

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-metatrader5

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MetaTrader 5

The MetaTrader 5 MCP server bridges AI assistants and the MetaTrader 5 trading platform through the Model Context Protocol, letting agents query live market data, retrieve historical OHLCV rates and tick data, send orders, and inspect open positions or deal history. It is a Python package published as mcp-metatrader5-server and runs via uvx, communicating over HTTP or SSE transport so it can be reached from any MCP client. Traders and quant developers use it to build AI-driven market analysis and automation workflows without manually coding MT5 integrations.

Prerequisites

  • MetaTrader 5 terminal installed and running on Windows (MT5 Python API requires Windows)
  • Python 3.10 or later with uv package manager installed (pip install uv)
  • A funded or demo MetaTrader 5 account with known account number, password, and server name
  • An MCP-compatible client such as Claude Desktop, Cursor, or Windsurf
1

Install the package with uvx

The server is distributed as the mcp-metatrader5-server PyPI package and is designed to be launched via uvx so no manual virtual-environment setup is needed.

uvx --from mcp-metatrader5-server mt5mcp
2

Configure transport environment variables

Set the transport mode and bind address. HTTP transport is required for most MCP clients; the defaults below are recommended for local use.

export MT5_MCP_TRANSPORT=http
export MT5_MCP_HOST=127.0.0.1
export MT5_MCP_PORT=8000
3

Add the server to your MCP client configuration

Open claude_desktop_config.json and add the MetaTrader 5 entry. The env block passes the transport settings so the server binds on startup.

{
  "mcpServers": {
    "mcp-metatrader5-server": {
      "command": "uvx",
      "args": ["--from", "mcp-metatrader5-server", "mt5mcp"],
      "env": {
        "MT5_MCP_TRANSPORT": "http",
        "MT5_MCP_HOST": "127.0.0.1",
        "MT5_MCP_PORT": "8000"
      }
    }
  }
}
4

Ensure the MetaTrader 5 terminal is running

The Python MT5 library connects to the locally running MT5 terminal process. Open MetaTrader 5 and log into your account before invoking any tools.

5

Initialize a session from your AI client

Use the initialize tool to establish the connection to the MT5 terminal, then call login with your account credentials before making market data or trading calls.

6

Query market data or send orders

Use tools like get_symbol_info, copy_rates_from_pos, and positions_get to retrieve market information, or order_send to submit trades programmatically.

MetaTrader 5 Examples

Client configuration

claude_desktop_config.json entry for the MetaTrader 5 MCP server using uvx.

{
  "mcpServers": {
    "mcp-metatrader5-server": {
      "command": "uvx",
      "args": ["--from", "mcp-metatrader5-server", "mt5mcp"],
      "env": {
        "MT5_MCP_TRANSPORT": "http",
        "MT5_MCP_HOST": "127.0.0.1",
        "MT5_MCP_PORT": "8000"
      }
    }
  }
}

Prompts to try

Example prompts that leverage the MetaTrader 5 market data and trading tools.

- "Connect to MetaTrader 5 using account 123456 on the ICMarkets-Live server and show me current EURUSD tick data."
- "Retrieve the last 100 15-minute OHLCV candles for XAUUSD and identify the highest close."
- "List all my currently open positions and their unrealised profit/loss."
- "Get the full deal history for the past 7 days and summarise my win rate."
- "Check the symbol info for BTCUSD including spread, margin, and contract size."

Troubleshooting MetaTrader 5

initialize() returns an error about MT5 terminal not found

The MetaTrader 5 desktop application must be installed and running on the same Windows machine. The Python MT5 library connects to the local terminal process — it cannot reach a remote terminal.

uvx command not found when launching the server

Install uv first with 'pip install uv' or 'curl -LsSf https://astral.sh/uv/install.sh | sh', then verify 'uvx --version' works in your terminal before adding it to the MCP config.

Connection refused on port 8000 when the client tries to reach the server

Ensure MT5_MCP_TRANSPORT is set to 'http' and the server process has started. Check that no firewall or other process is blocking port 8000. Try changing MT5_MCP_PORT to an unused port and updating both the env var and your client config accordingly.

Frequently Asked Questions about MetaTrader 5

What is MetaTrader 5?

MetaTrader 5 is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MetaTrader 5?

Follow the installation instructions on the MetaTrader 5 GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MetaTrader 5?

MetaTrader 5 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MetaTrader 5 free to use?

Yes, MetaTrader 5 is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Finance & Fintech MCP Servers

Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-metatrader5": { "command": "npx", "args": ["-y", "mcp-metatrader5"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use MetaTrader 5?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides