Server facts
metatrader-mcp-server
GitHub stars
860
Last commit
Mar 28, 2026
Runtime
python
License
MIT
Project
- Author
- ariadng
- Repository
- github.com/ariadng/metatrader-mcp-server
- License
- MIT
- Category
- Finance & Commerce
Tech
- Runtime
- python
- Transports
- stdiossestreamable-http
- Remote access
- No
- Authentication
- MetaTrader 5 Account Login, Password, and Broker Server
Activity
- GitHub stars
- 860
- Last commit
- Data as of
Tags
- ai
- finance
- investment
- llm
- mcp
- metatrader
- quantitative finance
- trading
Overview
Traders and quantitative developers searching for metatrader mcp need a direct local bridge between LLMs and their broker terminal—specifically **MetaTrader 5 (MT5)**, not MT4. Installed via `pip install metatrader-mcp-server` (Python 3.10+, powered by FastMCP, FastAPI, and the `MetaTrader5` Python package), this MIT-licensed server connects to a live MT5 desktop installation with algorithmic trading enabled and credentials supplied via CLI flags (`--login`, `--password`, `--server`, optional `--path`) or a `.env` file. All account credentials remain local on the machine running MT5, and a bundled `claude-skill/trading` skill equips Claude Code and Claude Desktop with formatted dashboard workflows across its 32 trading tools.
Clients choose among multiple interfaces: local `--transport stdio` for Claude Desktop, remote `--transport sse` (default on `0.0.0.0:8080`) or `--transport streamable-http` for Windows VPS deployments, `metatrader-http-server` (port `8000`) for Open WebUI/ChatGPT OpenAPI tool integration, and `metatrader-quote-server` (`ws://0.0.0.0:8765`) for real-time WebSocket tick streaming. Important safeguards apply: MCP SSE/HTTP endpoints ship with no built-in authentication—so remote hosts must stay behind IP firewalls, authenticated reverse proxies, or SSH tunnels—and financial trading carries substantial risk of loss with no developer liability.
Install & configure
Requirements
- Python 3.10 or higher (`pip install metatrader-mcp-server`)
- Installed and running MetaTrader 5 terminal with `Allow algorithmic trading` enabled under Tools → Options → Expert Advisors
- Demo or live MT5 account credentials (`LOGIN`, `PASSWORD`, `SERVER`, and optional `MT5_PATH` executable path)
pip install metatrader-mcp-serverInstall via `pip install metatrader-mcp-server`, enable algorithmic trading in MetaTrader 5, and configure Claude Desktop with `--transport stdio` plus `--login`, `--password`, and `--server` (or `.env` variables). For Windows VPS remote setups, protect the SSE/HTTP port (`8080`) with a firewall, authenticated reverse proxy, or SSH tunnel.
Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Config file · Project: .cursor/mcp.json
User: ~/.cursor/mcp.json
The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Config file · Workspace: .vscode/mcp.json
For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.
{
"servers": {
"metatrader": {
"type": "stdio",
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"metatrader": {
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Config file · Project scope: .mcp.json at the repository root
The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.
{
"mcpServers": {
"metatrader": {
"type": "stdio",
"command": "metatrader-mcp-server",
"args": [
"--login",
"YOUR_MT5_LOGIN",
"--password",
"YOUR_MT5_PASSWORD",
"--server",
"YOUR_MT5_SERVER",
"--transport",
"stdio"
]
}
}
}Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.
Tools
Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.
| Tool | What it does |
|---|---|
| get_account_info | Returns MT5 account balance, equity, floating profit, margin level, leverage, and deposit currency. |
| get_symbols | Lists all trading symbols available through the connected MetaTrader 5 broker. |
| get_symbol_price | Fetches current live bid and ask quotes for a specified trading symbol. |
| get_candles_latest | Retrieves recent OHLCV candlestick price bars for technical analysis. |
| get_candles_by_date | Pulls historical OHLCV candles across a requested date range. |
| get_symbol_info | Returns detailed broker contract specifications and metadata for a symbol. |
| place_market_order | Executes an immediate BUY or SELL market order on MetaTrader 5 with optional stop-loss and take-profit levels. |
| place_pending_order | Places a pending limit or stop order for future trigger execution. |
| modify_position | Updates stop-loss or take-profit parameters on an existing open position. |
| modify_pending_order | Edits price or protection parameters on an active pending order. |
| get_all_positions | Lists all currently open positions in the MT5 account. |
| get_positions_by_symbol | Filters open MT5 positions to a specific trading instrument. |
| close_position | Closes a single open trading position by its identifier. |
| close_all_positions | Closes every currently open position across the account. |
| close_all_profitable_positions | Closes only open positions currently in profit. |
| close_all_losing_positions | Closes only open positions currently showing a loss. |
| get_all_pending_orders | Lists all unfilled pending orders queued on the account. |
| cancel_pending_order | Cancels a targeted pending order before execution. |
| get_deals | Retrieves historical executed deals for trade review and journaling. |
| get_orders | Fetches historical MT5 order records across prior sessions. |
Use cases
- Review account balance, equity, margin level, open positions, and historical deals conversationally inside Claude Desktop or Claude Code.
- Fetch live bid/ask prices and historical OHLCV candles (`get_candles_latest`, `get_candles_by_date`) on demo accounts before placing trades.
- Execute, modify, and bulk-close positions (such as closing only profitable or losing positions) with natural-language instructions.
- Stream real-time MT5 tick updates over WebSocket (`metatrader-quote-server`) or attach Open WebUI / ChatGPT via the bundled FastAPI REST server.
Strengths
- Supports stdio, SSE, and Streamable HTTP MCP transports plus standalone FastAPI REST (`metatrader-http-server`), WebSocket tick streaming (`metatrader-quote-server`), and a Python client library.
- Includes a pre-built `claude-skill/trading` skill providing terminal-style formatting and workflow chaining across 32 trading tools.
- Keeps MT5 broker credentials local on your own machine or VPS with customizable timeouts, retries, and portable terminal paths.
Limitations
- Supports MetaTrader 5 (MT5) only—MetaTrader 4 (MT4) is not supported, and MT5 desktop terminal must be running with algorithmic trading enabled.
- Remote SSE/HTTP transports have no built-in MCP authentication and bind `0.0.0.0` by default unless restricted with `--host 127.0.0.1`, firewalls, or tunnels.
- Live order execution carries real financial risk, especially when combined with direct-execution prompts; always test thoroughly on a demo account first.
metatrader-mcp-server setup notes
- metatrader-mcp-server's example uses stdio, while its catalog transports are stdio / sse / streamable-http; use the example's connection type.