================== /// MCP /// /// MET /// ================== [server:online] [protocol:ready]
metatrader-mcp-server
by ariadng
Model Context Protocol (MCP) server that lets AI LLMs execute trades through the MetaTrader 5 terminal.
79
19
SpecializedInstallation
1. Clone the repository
git clone https://github.com/ariadng/metatrader-mcp-server.git
cd metatrader-mcp-server
2. Create & activate a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
3. Install Python dependencies
pip install -r requirements.txt
4. 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/db
6. Start the MCP server
uvicorn mcp_server.app:app --reload --host 0.0.0.0 --port 8000
7. Verify
Open http://localhost:8000/docs to view the autogenerated Swagger UI and test endpoints.
Documentation
License: MIT License
Updated 7/30/2025