MetaTrader 5
A Model Context Protocol (MCP) server for interacting with the MetaTrader 5 trading platform. This server provides AI assistants with tools and resources to access market data, perform trading operations, and analyze trading history.
What is MetaTrader 5?
MetaTrader 5 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server for interacting with the metatrader 5 trading platform. this server provides ai assistants with tools and resources to access market data, perform trading operation...
A Model Context Protocol (MCP) server for interacting with the MetaTrader 5 trading platform. This server provides AI assistants with tools and resources to access market data, perform trading operations, and analyze trading history.
This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol (MCP) server for interacting with t
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-metatrader5Configuration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MetaTrader 5
The MetaTrader 5 MCP server bridges AI assistants and the MetaTrader 5 trading platform through the Model Context Protocol, letting agents query live market data, retrieve historical OHLCV rates and tick data, send orders, and inspect open positions or deal history. It is a Python package published as mcp-metatrader5-server and runs via uvx, communicating over HTTP or SSE transport so it can be reached from any MCP client. Traders and quant developers use it to build AI-driven market analysis and automation workflows without manually coding MT5 integrations.
Prerequisites
- MetaTrader 5 terminal installed and running on Windows (MT5 Python API requires Windows)
- Python 3.10 or later with uv package manager installed (pip install uv)
- A funded or demo MetaTrader 5 account with known account number, password, and server name
- An MCP-compatible client such as Claude Desktop, Cursor, or Windsurf
Install the package with uvx
The server is distributed as the mcp-metatrader5-server PyPI package and is designed to be launched via uvx so no manual virtual-environment setup is needed.
uvx --from mcp-metatrader5-server mt5mcpConfigure transport environment variables
Set the transport mode and bind address. HTTP transport is required for most MCP clients; the defaults below are recommended for local use.
export MT5_MCP_TRANSPORT=http
export MT5_MCP_HOST=127.0.0.1
export MT5_MCP_PORT=8000Add the server to your MCP client configuration
Open claude_desktop_config.json and add the MetaTrader 5 entry. The env block passes the transport settings so the server binds on startup.
{
"mcpServers": {
"mcp-metatrader5-server": {
"command": "uvx",
"args": ["--from", "mcp-metatrader5-server", "mt5mcp"],
"env": {
"MT5_MCP_TRANSPORT": "http",
"MT5_MCP_HOST": "127.0.0.1",
"MT5_MCP_PORT": "8000"
}
}
}
}Ensure the MetaTrader 5 terminal is running
The Python MT5 library connects to the locally running MT5 terminal process. Open MetaTrader 5 and log into your account before invoking any tools.
Initialize a session from your AI client
Use the initialize tool to establish the connection to the MT5 terminal, then call login with your account credentials before making market data or trading calls.
Query market data or send orders
Use tools like get_symbol_info, copy_rates_from_pos, and positions_get to retrieve market information, or order_send to submit trades programmatically.
MetaTrader 5 Examples
Client configuration
claude_desktop_config.json entry for the MetaTrader 5 MCP server using uvx.
{
"mcpServers": {
"mcp-metatrader5-server": {
"command": "uvx",
"args": ["--from", "mcp-metatrader5-server", "mt5mcp"],
"env": {
"MT5_MCP_TRANSPORT": "http",
"MT5_MCP_HOST": "127.0.0.1",
"MT5_MCP_PORT": "8000"
}
}
}
}Prompts to try
Example prompts that leverage the MetaTrader 5 market data and trading tools.
- "Connect to MetaTrader 5 using account 123456 on the ICMarkets-Live server and show me current EURUSD tick data."
- "Retrieve the last 100 15-minute OHLCV candles for XAUUSD and identify the highest close."
- "List all my currently open positions and their unrealised profit/loss."
- "Get the full deal history for the past 7 days and summarise my win rate."
- "Check the symbol info for BTCUSD including spread, margin, and contract size."Troubleshooting MetaTrader 5
initialize() returns an error about MT5 terminal not found
The MetaTrader 5 desktop application must be installed and running on the same Windows machine. The Python MT5 library connects to the local terminal process — it cannot reach a remote terminal.
uvx command not found when launching the server
Install uv first with 'pip install uv' or 'curl -LsSf https://astral.sh/uv/install.sh | sh', then verify 'uvx --version' works in your terminal before adding it to the MCP config.
Connection refused on port 8000 when the client tries to reach the server
Ensure MT5_MCP_TRANSPORT is set to 'http' and the server process has started. Check that no firewall or other process is blocking port 8000. Try changing MT5_MCP_PORT to an unused port and updating both the env var and your client config accordingly.
Frequently Asked Questions about MetaTrader 5
What is MetaTrader 5?
MetaTrader 5 is a Model Context Protocol (MCP) server that model context protocol (mcp) server for interacting with the metatrader 5 trading platform. this server provides ai assistants with tools and resources to access market data, perform trading operations, and analyze trading history. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MetaTrader 5?
Follow the installation instructions on the MetaTrader 5 GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MetaTrader 5?
MetaTrader 5 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MetaTrader 5 free to use?
Yes, MetaTrader 5 is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
MetaTrader 5 Alternatives — Similar Finance & Fintech Servers
Looking for alternatives to MetaTrader 5? Here are other popular finance & fintech servers you can use with Claude, Cursor, and VS Code.
ValueCell
★ 10.7kValueCell is a community-driven, multi-agent platform for financial applications.
Vibe Trading
★ 8.1k'Vibe-Trading: Your Personal Trading Agent'
Quantdinger
★ 6.2kAI quantitative trading platform for crypto, stocks, and forex with backtesting, live trading, market data, and multi-agent research.vibe-trading ,trading-agents,ai-trader,ai-trading
TradingView
★ 2.8kReal-time crypto & stock screening, advanced technical indicators, Bollinger Bands intelligence, candlestick patterns + native Claude Desktop integration. Multi-exchange (Binance, KuCoin, Bybit+). Open-source AI trading infrastructure.
Financial Datasets
★ 2.1kProvides access to comprehensive financial data including income statements, balance sheets, cash flow statements, stock prices, company news, SEC filings, and cryptocurrency information with built-in financial ratio analysis.
Stripe
★ 1.6kThe Stripe Model Context Protocol server allows you to integrate with Stripe APIs through function calling. This protocol supports various tools to interact with different Stripe services.
Browse More Finance & Fintech MCP Servers
Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MetaTrader 5 in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MetaTrader 5?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.