by ariadng
MetaTrader MCP Server is a Python-based Model Context Protocol (MCP) server that enables AI Large Language Models (LLMs) to execute trades on the MetaTrader platform.
MetaTrader MCP Server is a Python-based Model Context Protocol (MCP) server designed to bridge the gap between AI Large Language Models (LLMs) and the MetaTrader 5 trading platform. It allows LLMs to interact with MetaTrader 5 and execute trading operations programmatically.
To use MetaTrader MCP Server, you need Python 3.10+ and MetaTrader 5 terminal installed. Install the package via pip:
pip install metatrader-mcp-server
After installation, enable algorithmic trading in your MetaTrader 5 terminal (Tools > Options > Allow algorithmic trading
).
For Claude Desktop integration, add the provided JSON configuration to your Claude Desktop settings, including your MetaTrader 5 login, password, and server details.
For other LLMs using Open WebUI, run the HTTP server locally with your MetaTrader 5 credentials:
metatrader-http-server --login <YOUR_MT5_LOGIN> --password <YOUR_MT5_PASSWORD> --server <YOUR_MT5_SERVER> --host 0.0.0.0 --port 8000
Then, add http://localhost:8000
(or your chosen port) as a tool server in Open WebUI settings under the "Tools" menu.
Q: Is financial trading with this package risky? A: Yes, financial trading involves significant risk. The developers explicitly disclaim any liability for losses or profits. This package is provided solely to facilitate MetaTrader 5 trade executions via AI LLMs, and users assume all risks.
Q: What Python version is required? A: Python 3.10+ is required.
Q: Do I need MetaTrader 5 installed? A: Yes, you need the MetaTrader 5 terminal installed in your workspace.
Q: Can I use this with LLMs other than Claude Desktop? A: Yes, you can use it with other LLMs like OpenAI's GPT models via its HTTP server and Open WebUI integration.
This is a Model Context Protocol (MCP) server built with Python to enable AI LLMs to trade using MetaTrader platform.
Financial trading involves significant risk, and the developers of this package disclaim any liability for any losses or profits; this package is provided solely to facilitate MetaTrader 5 trade executions via AI LLMs using the Model Context Protocol (MCP). By using this package, you assume all risks and agree not to hold the developers liable or to initiate any legal action for any damages, losses, or profits.
Make sure you have Python version 3.10+ and MetaTrader 5 terminal installed in your workspace. Then install the package:
pip install metatrader-mcp-server
Then you need to enable algorithmic trading on MetaTrader 5 terminal. Open Tools > Options
and check Allow algorithmic trading
.
To use this package to enable trading operations via Claude Desktop app, please add this into your Claude Desktop configuration:
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login", "<YOUR_MT5_LOGIN>",
"--password", "<YOUR_MT5_PASSWORD>",
"--server", "<YOUR_MT5_SERVER>"
]
}
}
}
You can use this MCP server with other LLMs such as OpenAI's GPT by using its HTTP server and Open WebUI.
To start, make sure you have installed the package. Then, run the server:
metatrader-http-server --login <YOUR_MT5_LOGIN> --password <YOUR_MT5_PASSWORD> --server <YOUR_MT5_SERVER> --host 0.0.0.0 --port 8000
It will launch HTTP server locally on port 8000 and automatically launch MetaTrader 5 terminal.
On Open WebUI settings page, navigate to Tools menu. Then click plus button on "Manage Tool Servers". Add http://localhost:8000
(or whatever you set your port is).
If all is well, you can now access the tools via chat using available models, such as gpt-4o
or o4-mini
.
For full version checklist, see version-checklist.md.
Task | Status | Done | Tested |
---|---|---|---|
Connect to MetaTrader 5 terminal | Finished | ✅ | ✅ |
Develop MetaTrader client module | Finished | ✅ | ✅ |
Develop MCP Server module | Finished | ✅ | ✅ |
Implement MCP tools | Finished | ✅ | ✅ |
Publish to PyPi | Finished | ✅ | ✅ |
Claude Desktop integration | Finished | ✅ | ✅ |
OpenAPI server | Finished | ✅ | ✅ |
Open WebUI integration | Finished | ✅ | ✅ |
Google ADK integration | On progress | - | - |
For developers, see Developer's Documentation.
Reviews feature coming soon
Stay tuned for community discussions and feedback