metatrader-mcp-server
Author: ariadng
Description: Model Context Protocol (MCP) server that lets AI LLMs execute trades through the MetaTrader 5 terminal.
Stars: 79
Forks: 19
License: MIT License
Category: Specialized
Overview
Installation
1. Clone the repository
git clone https://github.com/ariadng/metatrader-mcp-server.git
cd metatrader-mcp-server2. Create & activate a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate3. Install Python dependencies
pip install -r requirements.txt4. Configure MetaTrader bridge
• Copy the supplied `MCP_EA.ex4` (or `ex5`) file from `metatrader/` to your MT4/MT5 `Experts` folder.
• In MetaTrader, enable algo-trading and attach the EA to a chart.
• Note the local REST port shown in the EA inputs (default 18080).
5. Create an environment file `.env` (or edit `config.yaml`) with
MT_HOST=127.0.0.1
MT_PORT=18080
API_KEY=<strong random string>
DATABASE_URL=sqlite:///mcp.db # or postgres://user:pass@host/db6. Start the MCP server
uvicorn mcp_server.app:app --reload --host 0.0.0.0 --port 80007. Verify
Open http://localhost:8000/docs to view the autogenerated Swagger UI and test endpoints.
License: MIT License
Updated 7/30/2025