Skip to main content

Model Context Protocol (MCP) server built with Python to enable AI LLMs to trade using MetaTrader platform.

Project description

MetaTrader MCP Server

This is a Model Context Protocol (MCP) server built with Python to enable AI LLMs to trade using MetaTrader platform.

MetaTrader MCP Server

Disclaimer

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.

Updates

  • May 5, 2025: Use broker-based filling modes (0.2.5)
  • April 23, 2025: Published to PyPi (0.2.0)
  • April 16, 2025: We have our first minor version release (0.1.0)

Installation Guide

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.

Claude Desktop Integration

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>"
      ]
    }
  }
}

Other LLMs using Open WebUI

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).

Open WebUI - Add Connection

If all is well, you can now access the tools via chat using available models, such as gpt-4o or o4-mini.

Open WebUI - Chat

Project Roadmap

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 - -

Developer Documentation

For developers, see Developer's Documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metatrader_mcp_server-0.2.5.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metatrader_mcp_server-0.2.5-py3-none-any.whl (86.8 kB view details)

Uploaded Python 3

File details

Details for the file metatrader_mcp_server-0.2.5.tar.gz.

File metadata

  • Download URL: metatrader_mcp_server-0.2.5.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for metatrader_mcp_server-0.2.5.tar.gz
Algorithm Hash digest
SHA256 3d134f795d54d8fe063b2b4a20c0b8e9e0f5f2cf956c7a5d874c6a4eca192649
MD5 576adb23d0d4b27649e25021ee52e4dc
BLAKE2b-256 6e72c3db3bb1774fe206c9d37a5573d5bc0d2dc3ecf1d8ab62eb4a3eecaa77f6

See more details on using hashes here.

File details

Details for the file metatrader_mcp_server-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for metatrader_mcp_server-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f2c4d6c9dcdbaf8855524a8fd98ae2b5a00dca4c49d9e6c1005433d14cb064a2
MD5 a661c75bf1fcbc49ea7c7e0b6e494d6a
BLAKE2b-256 20c5797af441372a353b4552d90a3e56713ff8a189e78c2b67536c08900ef100

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page