MetaTrader 4

MetaTrader 4 is an MCP server that provides cross-platform integration between large language model clients and the MetaTrader 4 trading platform over a network. Designed for algorithmic traders, financial developers, and automated trading system builders, it enables AI assistants to inspect account balances, query real-time market quotes, monitor positions, place market or pending orders, and close existing trades. The integration architecture connects a Node.js-based MCP server to a Windows machine running a local HTTP bridge and an MQL4 Expert Advisor attached to a chart in MetaTrader 4. Communication leverages HTTP requests converted into file I/O operations inside the platform. Additionally, the system supports Expert Advisor lifecycle workflows, allowing users to sync MQL4 files, trigger remote compilation with detailed error logs, run strategy backtests with configurable parameters, and read backtest progress reports with automated fallback to JSON status files.

Category: CRM, ERP & E-commerce

Tags: automation, finance, forex, metatrader, trading

Visit MetaTrader 4

How to install and configure MetaTrader 4

Follow these steps to set up and configure the MetaTrader 4 MCP server: 1. On your Linux host, install dependencies and compile the server: bash npm install npm run build 2. On the Windows host running MetaTrader 4, navigate to the windows-server directory, install packages, and start the HTTP bridge on port 8080: cmd npm install npm start 3. Copy mcp/MCP_Ultimate.mq4 to the MT4 MQL4/Experts/ folder, compile it in MetaEditor, attach it to a chart, and verify that DLL imports and automated trading are enabled. 4. Add the server to Claude Code using the command line: bash MT4_HOST=192.168.50.161 MT4_PORT=8080 claude mcp add mt4-server npm run start Alternatively, add it to your client configuration JSON under mcpServers: json { "mcpServers": { "mt4-server": { "command": "node", "args": ["dist/index.js"], "env": { "MT4_HOST": "192.168.50.161", "MT4_PORT": "8080" } } } }

What you can do with MetaTrader 4

  • Fetch current trading account statistics including total balance, equity, and margin levels directly inside chat prompts. - Query current market prices, bid-ask spreads, and ticker information across active currency pairs and commodities. - Place market or pending orders with custom lot sizes, take-profit values, and stop-loss levels. - Inspect open positions and execute targeted order closures based on MT4 ticket numbers. - Trigger automated backtests on Expert Advisors over specific date ranges and review generated JSON performance metrics. - Sync local MQL4 strategy files to the MetaTrader 4 environment and verify compilation errors remotely.

Key facts

  • https://github.com/8nite/metatrader-4-mcp
  • CRM, ERP & E-commerce, Finance, Crypto & Payments
  • automation, finance, forex, metatrader, trading

Part of MCP Servers

Related MCP servers

  • MCP Microsoft Office Bridge — MCP Microsoft Office Bridge is an MCP server that connects AI assistants like Claude to Microsoft 365 services through the…
  • MCP Mempool — MCP Mempool is an MCP server that exposes the mempool.space WebSocket and REST APIs to AI agents, LLM assistants, and…
  • MCP NIF.PT — MCP NIF.PT is an MCP server that connects LLM clients to the Portuguese NIF.PT public API to retrieve and analyze…
  • MCP Options Order Flow Server — MCP Options Order Flow Server is an MCP server that provides real-time options order flow data, institutional bias tracking, and…
  • MCP Open Library — MCP Open Library is an MCP server that connects AI assistants to the Open Library catalogue API to retrieve book,…
  • MCP Orlen Wholesale Price — MCP Orlen Wholesale Price is an MCP server that provides access to Polish Orlen fuel wholesale pricing data directly inside…

How do I install MetaTrader 4 MCP server?

You build the TypeScript MCP server using npm run build, run the provided Node.js HTTP bridge on your Windows machine hosting MetaTrader 4, compile and attach the MCP_Ultimate.mq4 Expert Advisor to a chart, and then register the server in your MCP client configuration using the target host IP and port.

What can MetaTrader 4 MCP server do?

The server allows AI assistants to retrieve account metrics, read market prices, execute market and pending orders, inspect or close active positions, review trade history, trigger backtests, and sync or compile Expert Advisor code remotely.

Which MCP clients work with MetaTrader 4?

It is designed to work with Claude Code and any MCP-compliant client such as Claude Desktop or Cursor that supports stdio-based MCP servers configured with custom environment variables.

Does MetaTrader 4 MCP require Windows?

Yes, MetaTrader 4 itself and the required Node.js HTTP bridge must run on Windows. However, the MCP server itself can run on a separate Linux machine communicating with the Windows bridge across your local network.

Why are my trading orders not executing through MetaTrader 4 MCP?

Orders will not execute if automated trading is disabled in MetaTrader 4, if Allow DLL imports is unticked in the Expert Advisor properties, or if the MT4 chart running the bridge Expert Advisor is closed.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories