Skip to main content

MQL5 Developer MCP Server

A specialized Model Context Protocol (MCP) server for MetaTrader 5 (MQL5) developers. It bridges the gap between AI assistants (Claude, Cursor, Antigravity) and your local MetaEditor.

Maintained by [Elliott Waves 2.0] – Advanced Algorithmic Trading Solutions.

Features

  1. Local Compilation (compile_mql5)

    • Compiles MQL5 code locally using your installed metaeditor64.exe.
    • Returns the exact compiler log with line and column numbers, error codes and warnings, which is what lets an assistant fix its own code instead of guessing.
    • No trading account connection required (safe and fast).
    • Code is written to a temporary directory that is removed after each call.
  2. Documentation Lookup (search_mql5_docs)

    • Queries the MQL5 reference through Context7, which serves it as a pre-indexed library.
    • Returns function signatures, parameters, return values and examples.
    • max_tokens controls how much comes back per call, so broad topics and narrow ones both stay usable.

Requirements

  • Python 3.10 or newer
  • uv (recommended)
  • MetaTrader 5 installed on Windows

Setup

Add this to your MCP configuration (for example claude_desktop_config.json):

{
  "mcpServers": {
    "mql5-dev": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/elliottwaves-20/mcp-server-mql5.git", "mcp-server-mql5"],
      "env": {
        "MQL5_EDITOR_PATH": ""
      }
    }
  }
}

MetaEditor path

The server looks for MetaEditor by itself, checking these locations:

  • C:\Program Files\MetaTrader 5*\metaeditor64.exe
  • C:\Program Files (x86)\MetaTrader 5*\metaeditor64.exe
  • %APPDATA%\MetaQuotes\Terminal\*\metaeditor64.exe

If none of them match — brokers install into their own folders — set the path manually:

  1. Right-click the MetaEditor shortcut → Properties → Shortcut tab
  2. Copy the full path from the Target field
  3. Put it into the config and double every backslash
"env": {
  "MQL5_EDITOR_PATH": "C:\\Program Files\\MetaTrader 5 [YOUR_BROKER]\\metaeditor64.exe"
}

Context7 API key (optional)

Documentation lookups work without a key, subject to Context7's public rate limit. That is fine for occasional questions but throttles during longer sessions. With a key from context7.com, pass it through the environment — never commit it to a repository:

"env": {
  "MQL5_EDITOR_PATH": "",
  "CONTEXT7_API_KEY": "${CONTEXT7_API_KEY}"
}

Some MCP clients resolve ${VAR} against your system environment; others do not. If yours does not, set the variable for your user account and let the client inherit it.

Environment variables

Variable Purpose Default
MQL5_EDITOR_PATH Full path to metaeditor64.exe auto-detected
CONTEXT7_API_KEY Raises the Context7 rate limit unset (public limit)
MQL5_DOCS_LIBRARY Context7 library ID for the MQL5 reference /websites/mql5docs_onrender
CONTEXT7_BASE_URL Context7 API host https://context7.com/api/v1

Usage

Ask your assistant to write MQL5 code and compile it. A clean run returns:

Result: 0 errors, 0 warnings, 1327 ms elapsed, cpu='X64 Regular'

A failing one returns the diagnostics the assistant needs to correct itself:

TestFehler.mq5(9,15) : error 256: undeclared identifier 'UndefinierteFunktion'
TestFehler.mq5(9,36) : error 157: ')' - expression expected
TestFehler.mq5(11,4) : error 154: 'return' - semicolon expected
TestFehler.mq5(8,16) : warning 93: implicit conversion from 'string' to 'int'
Result: 3 errors, 1 warnings

For documentation, ask about one concept per call (OrderSend, ArrayResize, MqlTradeRequest). Context7 always answers with its closest match, so an unrelated term returns unrelated documentation rather than an error.

Version history

0.2.0

  • Documentation lookup moved from DuckDuckGo scraping to Context7. The old approach parsed search-result HTML, broke whenever DuckDuckGo answered 202 to block automated traffic, and truncated every page at 12,000 characters.
  • Migrated to the MCP Python SDK 2.x, where FastMCP became MCPServer. The dependency is now pinned to mcp>=2,<3, because 1.x and 2.x are not interchangeable.
  • Dropped the beautifulsoup4 dependency; no HTML is parsed any more.
  • Status codes from the documentation API (401, 404, 429) are now reported with what to do about them instead of a bare number.

0.1.2

  • Automatic MetaEditor detection, PyPI entry point fix.

Metadata

Release files for mcp-server-mql5 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-server-mql5 0.2.0
File Size Uploaded Provenance
mcp_server_mql5-0.2.0.tar.gz 5.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server-mql5 0.2.0
File Interpreter ABI Platform
mcp_server_mql5-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / mcp_server_mql5-0.2.0.tar.gz

Download URL mcp_server_mql5-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9f7bdd2dfb33cf78eb81aa6c2b73a4068723a2448eb0336c3637c4bf2d921ae2
BLAKE2b-256 checksum
How to use checksums
4c07c709031624e73b872b1cab9dc7baecccbdc50e01458f4eb576c53a7aad02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / mcp_server_mql5-0.2.0-py3-none-any.whl

Download URL mcp_server_mql5-0.2.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dd820b5cf869a34bec46cda4e0a29b7467dd8b6d23c8f21ff553053a4b03528
BLAKE2b-256 checksum
How to use checksums
48e71eb17d8229421198ff66890f3c9aeb430a7d026c2206399131fa985a1a22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Security for mcp-server-mql5 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_server_mql5-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page