# metatrader-mcp-server: a Python MCP bridge between LLM assistants and MetaTrader 5

> The project exposes MetaTrader 5 account, market and order operations as MCP tools, plus an HTTP interface and a WebSocket quote stream. It is Windows-bound, beta-classified, and the README is explicit that losses are the user's problem.

**ariadng/metatrader-mcp-server** — Model Context Protocol (MCP) to enable AI LLMs to trade using MetaTrader platform

- Repository: https://github.com/ariadng/metatrader-mcp-server
- Stars: 814 · Forks: 261
- Language: Python
- License: MIT
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/ariadng-metatrader-mcp-server

## What a MetaTrader 5 MCP server actually replaces

MetaTrader 5 ships with an MQL5 IDE, a Python package, and a terminal UI. None of those is conversational. The step this project inserts is a Model Context Protocol server: a process that advertises a fixed set of trading operations to an LLM client, so the model can call them as tools instead of you writing a script per task. The README states the flow plainly: you, then the AI assistant, then the MCP server, then MetaTrader 5, then your trades.

The audience named in the README is traders who want to automate with AI, developers building bots or analysis tools, and analysts who want quick market data. That is a wider net than the code supports. The real user is someone with a Windows machine running the MT5 terminal and a login they are willing to type into a config file, because the MetaTrader5 Python package talks to a local terminal rather than to a broker API over the network. The README's prerequisite list makes this concrete: Python 3.10 or higher, the MetaTrader 5 terminal, and demo or live credentials consisting of a login number, a password and a server name.

The value is not that the model becomes a trader. It is that account queries and order placement stop being separate scripts. A single prompt can read balance, pull recent bars, and submit an order, and the model sees the results as tool output rather than as a shell transcript you have to paste back in.

## The transport layer: stdio, HTTP, SSE and a WebSocket tick stream

The repository installs four entry points, which is more surface than most MCP servers expose. The pyproject.toml declares metatrader-mcp-server, metatrader-http-server, and a third script whose name is cut off in the truncated file, and the README documents a quote server as well. The packages found by setuptools are metatrader_mcp, metatrader_client, metatrader_openapi and metatrader_quote, so the split into an MCP layer, a shared client, an OpenAPI service and a quote service is visible in the layout rather than only in prose.

Each transport answers a different question. STDIO is the local case: the MCP client spawns the server as a child process and speaks over standard input and output, which is why the Claude Desktop config passes credentials as arguments. SSE runs the server on a host and port so a client elsewhere can connect; the README's remote example starts it on 0.0.0.0:8080 and describes running it on a Windows VPS where MT5 lives. The HTTP server exists so Open WebUI can register it as a tool server at http://localhost:8000, which is the path to ChatGPT and other LLMs that do not speak MCP natively.

The quote server is the odd one out. It is not an MCP tool surface at all; it streams tick data (bid, ask, spread, volume) as JSON over a WebSocket, defaulting to port 8765, with QUOTE_SYMBOLS and QUOTE_POLL_INTERVAL_MS in .env.example showing that symbol selection and polling cadence are configurable. Polling at an interval is not the same as subscribing to broker ticks, and the README does not claim otherwise. For a dashboard or a monitoring loop that distinction rarely matters. For latency-sensitive execution it does.

## Installing metatrader-mcp-server and wiring it into Claude Desktop

Installation is a single PyPI package. The README's quick start gives this as step one:

```bash
pip install metatrader-mcp-server
```

Before anything will work, the README requires a manual change inside the terminal: open MetaTrader 5, go to Tools, then Options, then the Expert Advisors tab, and check Allow algorithmic trading. Without that box ticked the Python package can read data but order calls will not go through. This is the step people skip, and it fails silently from the assistant's point of view.

For Claude Desktop, edit the client config file. On Windows it is %APPDATA%\Claude\claude_desktop_config.json; on macOS it is ~/Library/Application Support/Claude/claude_desktop_config.json. Add a server entry named metatrader that runs the installed script with stdio transport:

```json
{
  "mcpServers": {
    "metatrader": {
      "command": "metatrader-mcp-server",
      "args": [
        "--login",     "YOUR_MT5_LOGIN",
        "--password",  "YOUR_MT5_PASSWORD",
        "--server",    "YOUR_MT5_SERVER",
        "--transport", "stdio"
      ]
    }
  }
}
```

Replace the three placeholders with the login number, password and server name from your MT5 account. If the terminal is not in a standard location, the README shows adding --path with the full path to terminal64.exe. After restarting Claude Desktop, the first thing the README suggests asking is What's my account balance? A correct answer means the chain from client to server to terminal to broker is intact.

For an LLM that does not speak MCP, start the HTTP variant instead. The README's command binds it to all interfaces on port 8000, and the interactive docs are then at http://localhost:8000/docs:

```bash
metatrader-http-server --login YOUR_LOGIN --password YOUR_PASSWORD --server YOUR_SERVER --host 0.0.0.0 --port 8000
```

In Open WebUI, go to Settings, then Tools, click Add Tool Server, and enter http://localhost:8000. The same credentials can instead come from a .env file, since .env.example lists LOGIN, PASSWORD, SERVER, MT5_PATH, MCP_TRANSPORT, MCP_HOST, MCP_PORT, QUOTE_HOST, QUOTE_PORT, QUOTE_SYMBOLS and QUOTE_POLL_INTERVAL_MS.

## Where the design gets uncomfortable: credentials, platform lock-in and no rollback

The README markets the project as secure on the grounds that all credentials stay on your machine. That is true of the local STDIO path and it is a real advantage over handing an API key to a hosted service. It stops being true the moment you follow the remote SSE option, which binds to 0.0.0.0:8080 on a VPS. The README does not document authentication on that endpoint, and a server that can place trades and is reachable on all interfaces is a different risk profile from a child process. Anyone choosing the remote path should treat network exposure as their own problem to solve, because the README does not solve it for them.

The second constraint is the platform. The MetaTrader5 package is a Windows dependency, and the README's remote deployment advice is to run the server on a Windows VPS precisely because that is where the terminal can live. There is no macOS or Linux path described. A related search term asks about a MetaTrader 4 MCP server; the README covers MT5 only, and the dependency list pins MetaTrader5, so MT4 users have no documented route here.

Third, the order surface is live. The README's own examples include buying 0.01 lots of EUR/USD and closing all profitable positions. There is no dry-run flag, paper-trading mode or confirmation step described in the README, and no documented rollback for a mistaken order. The disclaimer is unusually direct about this: the developers accept no liability for trading losses, and the user is responsible for every trade executed through the system. That is not boilerplate. It is an accurate description of a tool that will submit what the model tells it to submit.

Finally, the project classifies itself as Development Status 4 - Beta in pyproject.toml. The version there is 0.5.1 while the newest release listed is v0.2.3 from 2025-04-23, so the packaged version and the tagged releases have drifted apart. The last push to the default branch was on 2026-03-28, which is recent enough that the repository is not stale, but a beta classifier plus a version gap is a reason to pin a version rather than track the tip.

## How it compares with the MetaTrader5 Python package or an MQL5 expert advisor

The obvious alternative is to skip MCP entirely and call the MetaTrader5 Python package yourself. The difference is who decides the sequence. With the raw package you write the script: connect, select a symbol, read ticks, compute a condition, send an order. With this server the model chooses which of the exposed operations to call and in what order, and your code shrinks to a config file. If your logic is fixed and testable, the raw package is the better tool, because it has no LLM in the decision path and no prompt-injection surface. If your logic is exploratory, asking for balance, then positions, then a close, the MCP layer removes the glue code.

The second alternative is an MQL5 expert advisor running inside the terminal. That approach executes on the broker's tick stream in-process, with no Python, no subprocess and no network hop, and it is the conventional way to automate MT5. The trade-off is development cost and iteration speed: MQL5 is a narrower ecosystem than Python, and you cannot ask it a question in English. The MCP server is better suited to analysis, ad hoc queries and prototyping than to a strategy that must run unattended for months.

A third comparison point is the HTTP interface this project also ships. If your target is Open WebUI or any client that consumes an OpenAPI schema, metatrader-http-server is a plain FastAPI service and you never need an MCP client at all. The MCP transport is for clients that speak the protocol; the HTTP transport is for everything else. Choosing between them is a client-side decision, not a feature difference.

## Maintenance, licence and what upgrading costs you

The licence is MIT, declared in the LICENSE file and in the pyproject classifier, and the README repeats it in a badge. MIT permits commercial use and modification with the copyright notice retained. It also means the authors disclaim warranty, which lines up with the README's liability section. None of that is legal advice; if you are deploying this inside a firm, the compliance question is about automated trading and credential handling, not about the licence text.

On maintenance, the facts are narrow. The repository is not archived. The last push to main was on 2026-03-28. The newest listed release is v0.2.3 from 2025-04-23, tagged Trade using other LLMs, and pyproject.toml declares version 0.5.1, so the packaged artifact is ahead of the release tags. That combination suggests commits land without a matching release, which is common in small projects but means you should install a pinned version and read the commit history rather than trusting a release note to describe what you get.

The dependency surface is the real upgrade cost. The list includes MetaTrader5, numpy, pandas, fastapi, uvicorn, pydantic, pydantic-settings, mcp[cli], httpx, websockets, click, tabulate, python-dotenv, pytz, build and pytest. Several of those move quickly, and the mcp package in particular is young. An upgrade can break the tool schema the model sees, which is a failure mode that does not show up until the assistant calls a tool and gets an unexpected shape back. Pinning in a lockfile and re-running the balance query after every bump is the cheap check.

## Conclusion

Adopt it if you already run MetaTrader 5 on Windows, you want an LLM to read account state and place orders through MCP, and you are willing to keep the terminal, the credentials and the process on one machine. Skip it if you trade from macOS or Linux without a Windows host, if you need a documented rollback or dry-run mode (the README does not describe one), or if you want a strategy engine rather than a tool layer. Verify first that your MT5 build accepts algorithmic trading, that the terminal path resolves on your machine, and that you have tested the whole chain on a demo account before pointing it at a funded login.

## FAQ

### What is the point of an MCP server in metatrader-mcp-server?

It gives an AI assistant a fixed set of trading operations to call as tools, so the model can read account state, fetch market data and place orders on MetaTrader 5 without you writing a script per task. The README describes the chain as you, then the AI assistant, then the MCP server, then MetaTrader 5.

### Is it safe to use the metatrader-mcp-server?

The README states that all credentials stay on your machine, which holds for the local STDIO transport. The remote SSE option starts the server on 0.0.0.0:8080, and the README does not document authentication on that endpoint. The project also disclaims all liability for trading outcomes and puts responsibility for every executed trade on the user.

### Is metatrader-mcp-server a real server?

Yes. It installs several server entry points plus a quote stream: metatrader-mcp-server for MCP over stdio or SSE, metatrader-http-server for an OpenAPI service that Open WebUI can register, and a WebSocket quote server. The MCP variant can also run as a child process of the client rather than as a listening service.

## Sources

- [ariadng/metatrader-mcp-server on GitHub](https://github.com/ariadng/metatrader-mcp-server)
- [Issues](https://github.com/ariadng/metatrader-mcp-server/issues)
- [License: MIT](https://github.com/ariadng/metatrader-mcp-server/blob/main/LICENSE)
- [README](https://github.com/ariadng/metatrader-mcp-server/blob/main/README.md)
- [Releases](https://github.com/ariadng/metatrader-mcp-server/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/ariadng-metatrader-mcp-server
