mt5-ai-execution-gateway
A dedicated Python service that bridges Large Language Models (LLMs) with the MetaTrader 5 environment, facilitating programmatic, AI-driven automated trading operations via the Model Context Protocol (MCP). It abstracts complex platform interactions, allowing diverse generative AI interfaces to issue and manage financial transactions.
Author

ariadng
Quick Info
Actions
Tags
Automated MT5 Trading Bridge via MCP
This component establishes a Model Context Protocol (MCP) intermediary server, constructed in Python, designed explicitly to permit advanced AI language agents to conduct and manage trading activities directly on the MetaTrader platform.

Risk Disclosure
Engaging in financial markets carries inherent, substantial risk. The creators of this software expressly disclaim all responsibility for any monetary outcomes, positive or negative. This utility is provided strictly to enable the execution of trades on MetaTrader 5 utilizing AI models via the MCP framework. Users acknowledge and accept all associated risks, agreeing not to hold developers legally accountable for any transactional losses or gains experienced.
Changelog Highlights
- May 5, 2025: Implementation of broker-specific order filling preferences (v0.2.5)
- April 23, 2025: Official deployment to the Python Package Index (v0.2.0)
- April 16, 2025: Initial stable minor release achieved (v0.1.0)
Setup Instructions
Prerequisites include Python version 3.10 or newer and a functional installation of the MetaTrader 5 client. Install the required library using pip:
bash pip install metatrader-mcp-server
Subsequently, you must explicitly enable automated trading capabilities within the MT5 terminal. Navigate to Tools > Options and ensure the 'Allow algorithmic trading' checkbox is activated.
Enabling Claude Desktop Interaction
To route trading commands generated by the Claude Desktop application through this server, incorporate the following configuration structure into your Claude Desktop settings file:
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login", "
Interoperability with Other LLMs via Open WebUI
This gateway can also serve as an endpoint for models such as OpenAI's GPT series when paired with an HTTP server setup and Open WebUI.
First, verify the package installation. Then, initiate the companion HTTP server component:
metatrader-http-server --login
This command launches a local HTTP service, typically on port 8000, and automatically starts the MT5 client.
Within Open WebUI settings, navigate to the Tools section. Select 'Manage Tool Servers' and add a new connection pointing to http://localhost:8000 (or your configured address/port).

Upon successful setup, generative models (e.g., gpt-4o, o4-mini) can invoke trading functions through the established tool interface.

Development Trajectory
For a comprehensive feature list, refer to the detailed specifications in version-checklist.md.
| Objective | Status | Verification | Testing |
|---|---|---|---|
| MT5 Terminal Linkage | Complete | ✅ | ✅ |
| Client Module Construction | Complete | ✅ | ✅ |
| MCP Server Component | Complete | ✅ | ✅ |
| MCP Tool Implementation | Complete | ✅ | ✅ |
| PyPi Publication | Complete | ✅ | ✅ |
| Claude Desktop Adapter | Complete | ✅ | ✅ |
| OpenAPI Specification Server | Complete | ✅ | ✅ |
| Open WebUI Connector | Complete | ✅ | ✅ |
| Google ADK Integration | In Progress | - | - |
Technical Reference
Detailed implementation guides and architectural overviews are available in the Developer's Documentation.
WIKIPEDIA: Business oversight systems encompass all necessary applications, controls, quantitative methods, frameworks, and procedures employed by enterprises to effectively navigate evolving market conditions, maintain competitive standing, and enhance overall organizational output. These methodologies span departmental functions, covering areas like strategic planning, operational process management, record-keeping, personnel administration, critical decision support, and performance monitoring.
== Conceptual Framework == Management tools can be functionally categorized based on organizational requirements. Key operational aspects include:
- Systems for initial data entry and integrity verification across units.
- Mechanisms for auditing and refining core business workflows.
- Platforms for data aggregation leading to strategic determinations. Modern management solutions have undergone rapid transformation due to technological acceleration, complicating the selection process for optimal tools tailored to specific corporate demands. The drive for operational cost reduction, sales augmentation, deep customer insight acquisition, and precise product delivery mandates a strategic approach to tool adoption. Managers must align technologies with organizational strategy rather than adopting the newest tools without critical adaptation, which often results in systemic instability. Proper selection and customization are paramount for maximizing value.
== Prominent Methodologies (2013 Survey) == A 2013 Bain & Company study highlighted the global usage patterns of business tools, reflecting regional imperatives and economic climates. The leading ten methodologies included:
Strategic planning Customer relationship management Employee engagement surveys Benchmarking Balanced scorecard Core competency Outsourcing Change management programs Supply chain management Mission statement and vision statement Market segmentation Total quality management
== Enterprise Software Systems == Business software refers to packaged programs used by personnel to execute various organizational functions, aimed at elevating productivity, quantifying performance metrics, and ensuring operational precision. The evolution proceeded from Management Information Systems (MIS) to Enterprise Resource Planning (ERP), later incorporating Customer Relationship Management (CRM), and now transitioning toward cloud-based business management suites. While a clear link exists between IT investment and organizational success, two factors are crucial for realizing value: efficacy of deployment and the appropriateness of tool selection and modification.
== SME Focus == Tools specifically targeting Small and Medium-sized Enterprises (SMEs) are vital as they furnish mechanisms to achieve efficiencies and scale, often with constrained resources, enabling them to compete more effectively.
