MTX — Free MT5 Trade Execution MCP for Claude

$0.00

Categories: ,

Description

Free · Open source (MIT) · Claude / MCP tool

The broker always has the final word.

MTX is an MCP server that lets Claude place, manage, and guard real MetaTrader 5 trades. Every order is normalized against your symbol's real broker constraints and previewed through the broker's own order_check before anything executes — config-driven risk guardrails sit between Claude and a bad trade, not the model's judgement. Runs locally, nothing compiled, nothing hidden.

What you actually say to it

“What's my balance and margin level right now?”

get_account_info

“EURUSD swept the previous day low and reclaimed — size a 1% risk position with the stop below the sweep low.”

calc_position_size

“Buy 0.3 lots GBPUSD at market, SL 1.2630, TP 1.2710.”

open_position

“Place a sell limit on USDJPY at 158.50 — that's the premium high on the 4h range — good till Friday.”

place_pending_order

“Move my EURUSD stop to breakeven now that price has displaced through the order block.”

modify_position

“Close half my XAUUSD position, leave the rest running.”

close_position

“Am I within today's loss limit before I take this next setup?”

mm_check

MTX doesn't decide the setup. It's an MCP toolbox for agentic AI — Claude Code or Claude Desktop — giving it hands in MT5: executing trades, reading account and position info, and managing what's already open. The read is still yours, or a skill like ict-analyst you give it; MTX is what turns it into an actual order.

MCP tools

Reads

ToolPurpose
pingConfirm the terminal is reachable
get_configActive terminal, account, execution mode, mm summary
get_account_infoBalance, equity, margin, margin level, leverage
get_symbol_infoDigits, volume step, stops level, filling mode, live bid/ask
get_positionsOpen positions, optionally by symbol
get_pending_ordersWorking pending orders, optionally by symbol
get_historyClosed deals over a date range
calc_position_sizeRisk-based lot sizing from a risk %/amount and stop distance
mm_checkEvaluate guardrails; also acts if mm.enforce: true

Writes

ToolPurpose
open_positionOpen a market position (buy/sell)
place_pending_orderbuy_limit / sell_limit / buy_stop / sell_stop, optional expiration
modify_positionChange SL/TP on an open position
modify_pending_orderChange price/SL/TP/expiration on a pending order
close_positionClose a position, in whole or in part
cancel_pending_orderCancel a working pending order

Every write previews a broker-validated order_check first and only executes on confirm=true (or with execution.mode: auto in config.yaml) — guardrails above still apply either way.

Money-management guardrails

Config keyWhat it does
max_open_positionsRefuses new opens once you're at the cap
max_daily_loss_pct / max_daily_loss_moneyHalts new opens once today's realized + floating loss hits the limit
min_margin_level_pctProtective: flags/flattens when margin level drops too low
equity_stop_pctProtective: flattens everything if equity drops too far below balance
close_position_loss_pct / close_position_loss_moneyProtective: closes a single losing position past its limit

Deterministic, config-driven code — never left to the model's judgement. The protective checks report breaches by default; set mm.enforce: true and mm_check also executes the closes, the setting a cron heartbeat flips on for unattended protection.

Setting it up

Claude Code

No manual steps — just point your agent at the repo and ask it to set MTX up, e.g.:

“Clone github.com/FXDavid-OffbeatForex/MTX and set it up as an MCP server for me.”

It'll clone the repo, install the dependencies, walk you through config.yaml (your MT5 terminal path, execution mode, guardrail limits), and register itself with claude mcp add. Ask it to ping once it's done to confirm the terminal is reachable.

Claude Desktop instead? Settings → Developer → Edit Config, add an mtx entry to mcpServers pointing at the same mcp_server.py, restart.

Full walkthrough (installing MT5, wiring up Claude, MTX's read/backtest sibling MBT): how to connect Claude to MT5 →

Requirements

  • Python 3.9+
  • MetaTrader 5 — native on Windows, or Linux/macOS via Wine
  • A broker MT5 account — test on a demo account first
  • Claude Code, or Claude Desktop via MCP config

Source & support

MIT licensed, fully open on GitHub — nothing compiled, nothing to trust blindly. MTX places real orders on whatever account config.yaml points at; confirm-by-default and the guardrails above exist so nothing happens without your approval or a limit you set yourself.

View source, issues & updates on GitHub

The other half of the loop

MBT — MT5 Backtest Toolkit

Free · Open source

MBT reads and backtests against real broker data; MTX places and manages what you've already verified. Together they cover the whole loop — confirm a strategy first, then let Claude execute it, one confirmed trade at a time.

Get MBT

Reviews

There are no reviews yet.

Be the first to review “MTX — Free MT5 Trade Execution MCP for Claude”

Your email address will not be published. Required fields are marked *