MT5 MCP Server

MT5 MCP Server

Enables Claude to interact with a running MetaTrader 5 terminal, providing market data, account information, chart screenshots, and live order execution through a set of 20 tools.

Category
Visit Server

README

MT5 MCP Server

A local MCP server that connects a MetaTrader 5 terminal to Claude. It reads market data, account state and history, captures chart screenshots, and can send live orders.

Requirements

  1. The MetaTrader 5 terminal must be running
  2. Tools → Options → Expert Advisors → "Allow algorithmic trading" must be enabled
  3. An account must be logged in

If the terminal is closed, every tool returns MT5 initialize failed — open it and retry.

Install

uv venv --python 3.12 .venv
uv pip install --python .venv/Scripts/python.exe -r requirements.txt

Then adjust the paths in .mcp.json and restart Claude Code.

Tools (20)

Market data

Tool What it does
mt5_status Terminal build, connection, account, balance, equity, margin, DEMO/REAL
list_symbols Search symbols — wildcards supported (EUR*, *USD*)
symbol_info Digits, point, spread, contract size, lot limits, margin and swap rates
get_ticks Live bid/ask and spread for one or more symbols
get_candles OHLCV from M1 to MN1, by count or by date range
get_tick_history Raw bid/ask tick stream, useful for backtesting

Account

Tool What it does
get_positions Open positions and total floating P/L
get_pending_orders Active limit and stop orders
get_history_deals Closed trades with profit, commission and swap totals
get_history_orders Orders that were placed, cancelled or rejected
calc_trade Margin and expected profit before sending anything (no order is placed)

Screen capture

Tool What it does
list_charts Open charts with symbol, timeframe and size
screenshot PNG of the terminal window or of a single chart

screenshot does not come from the MetaTrader5 Python API — that API has no screenshot function at all. It is built on the Windows PrintWindow call (mt5_capture.py). It works on a background window, but not on a minimised one.

Pass target='window' for the whole terminal, or target='XAUUSD,M30' for one chart. Passing just 'XAUUSD' picks the largest chart for that symbol.

Trading — live

Tool What it does
open_position Market buy/sell, SL/TP as absolute price or in points
place_pending_order Buy/sell limit or stop, with optional expiry
modify_position Change SL/TP on an open position
modify_pending_order Change price, SL or TP on a pending order
close_position Full or partial close
cancel_pending_order Remove a pending order
close_all_positions Close everything, or only one symbol

⚠️ There is no demo/real guard on the trading tools. Orders go to whichever account the terminal is logged into. The broker's filling mode is detected automatically and the symbol is added to Market Watch as needed.

CLI (trade.py)

The same tools without Claude, straight from the command line:

.venv/Scripts/python.exe trade.py buy XAUUSD 0.01 --sl-points 500 --tp-points 1000
.venv/Scripts/python.exe trade.py modify 10090941191 --sl 4345.56 --tp 4360.56
.venv/Scripts/python.exe trade.py close 10090941191
.venv/Scripts/python.exe trade.py close-all --symbol XAUUSD
.venv/Scripts/python.exe trade.py positions
.venv/Scripts/python.exe trade.py calc buy XAUUSD 0.01 --close-price 4360

Run trade.py --help for every subcommand.

Time format

All time inputs are UTC: YYYY-MM-DD, YYYY-MM-DD HH:MM, or YYYY-MM-DD HH:MM:SS. Output timestamps are UTC as well.

Configuration

These environment variables are optional in .mcp.json:

Variable Purpose
MT5_PATH Path to terminal64.exe, used to launch the terminal if it is closed
MT5_LOGIN / MT5_PASSWORD / MT5_SERVER Log into a different account (default: whatever the terminal already uses)

Smoke test

.venv/Scripts/python.exe -c "import mt5_mcp_server as s; print(s.mt5_status()['account'])"

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured