MTContext — MetaTrader MCP server: what it does, how to install
MTContext — a hosted MCP server that lets Claude, Cursor or any MCP client read and trade a MetaTrader 4/5 terminal through one Expert Advisor on a chart.
no license 161 installs updated 2026-07-28
claude mcp add --transport http mtcontext https://mtcontext--tranvietthanh.run.toolsWhat MTContext does
Nothing runs on your machine. The endpoint is cloud-hosted, so there is no Python package and no local process to keep alive. You drag an Expert Advisor onto a chart in MetaTrader 4 or 5, and the terminal starts answering your MCP client: Claude, Codex, Cursor, Copilot, Windsurf, Cline, Zed or Gemini CLI.
Read tools return quotes, OHLCV bars, contract specs, balance and equity, open positions, pending orders and closed trade history. Beyond that you get indicator values, EA logs, the terminal journal, win rate and profit factor over closed trades, P&L split by symbol or by time bucket, symbol correlation and an economic calendar. Indicators come back as raw numbers with no verdict attached; the agent does the interpreting.
Order tools, from placing and partial close to breakeven, trailing stop and reversal, act as a dry run unless you pass dry_run=false, and live execution also needs the trade capability with inp_AllowTrading=true on the EA. Two rough edges: a software trailing stop is forgotten when the EA restarts, and depth of market does not exist on MT4, where the call answers NOT_SUPPORTED_ON_MT4.
What it helps with
- Check free margin before sending an order
- Size a lot from account equity and a risk share
- Break P&L down by symbol or by time period
- Move a stop to entry once the position is in profit
- Read recent lines from the EA log or terminal journal
Example prompts for the agent
- What's the bid, ask and spread on EURUSD right now?
- Size a lot for GBPUSD from equity at the risk share I give you, then check the margin
- Set a trailing stop of 10 points on position
<ticket>as a dry run
How to install MTContext
Platform CLI: remote server
claude mcp add --transport http mtcontext https://mtcontext--tranvietthanh.run.toolsPlatform CLI: remote server
codex mcp add mtcontext --url https://mtcontext--tranvietthanh.run.toolsConfig file
{
"mcpServers": {
"mtcontext": {
"url": "https://mtcontext--tranvietthanh.run.tools"
}
}
}Config file
{
"servers": {
"mtcontext": {
"type": "http",
"url": "https://mtcontext--tranvietthanh.run.tools"
}
}
}Platform CLI: remote server
gemini mcp add -t http mtcontext https://mtcontext--tranvietthanh.run.toolsStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about MTContext
How do I install MTContext in Claude Code?
Run claude mcp add --transport http mtcontext https://mtcontext--tranvietthanh.run.tools. The endpoint is hosted, so that command is the whole setup.
What does MTContext do?
It bridges an MCP client and a MetaTrader 4/5 terminal running the supplied Expert Advisor, exposing market data, account state and order management as tools.
What is needed for live trades instead of dry runs?
Pass dry_run=false on the order call, and enable the trade capability plus inp_AllowTrading=true on the Expert Advisor. Without both, execution stays simulated.