---
title: "MCP and AI - MetaTrader 5 Help"
description: "The trading platform integrates artificial intelligence directly into the trading environment, allowing AI agents to work with... - MCP and AI - MetaTrader 5 Help"
image: "https://www.metatrader5.com/i/logo_metatrader5.png"
url: "https://www.metatrader5.com/en/terminal/help/mcp_and_ai"
---

[MetaTrader 5 Help](https://www.metatrader5.com/en/terminal/help) → MCP and AI

# MCP Servers and AI Assistant

The trading platform integrates artificial intelligence directly into the trading environment, allowing AI agents to work with real data and functionality rather than operate as standalone chatbots. Through the Model Context Protocol (MCP), AI can access relevant market and account data, analyze charts and trading history, work with Expert Advisors, use the Strategy Tester, and perform supported operations in response to natural-language instructions.

This integration is especially useful for complex, multi-step tasks. Instead of manually collecting data, switching between tools, and performing each operation separately, you can describe the desired result and let the AI Assistant coordinate the necessary steps. For example, it can analyze market conditions and open positions, review trading performance, prepare charts, test and optimize Expert Advisors, examine logs and test reports, or help investigate issues in MQL5 programs.

The [built-in AI Assistant](https://www.metatrader5.com/en/terminal/help/mcp_and_ai#using_ai_assistant) provides immediate access to these capabilities. MCP also offers an open interface for connecting compatible third-party AI applications and agents, allowing you to choose the tools and models that best suit your workflow.

You remain in control of what AI can access and which operations it is allowed to perform. AI-generated results should always be reviewed and verified before use.

**Video**

- **Video:** [Video](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/video.en.mp4)
- **Poster:** [Image](https://www.metatrader5.com/i/help/terminal/en/https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/poster.jpg)
- **Subtitles (en):** [English](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.en.vtt)
- **Subtitles (de):** [Deutsch](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.de.vtt)
- **Subtitles (es):** [Español](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.es.vtt)
- **Subtitles (fr):** [Français](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.en.vtt)
- **Subtitles (ja):** [日本語](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.ja.vtt)
- **Subtitles (pt):** [Português](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.pt.vtt)
- **Subtitles (ru):** [Русский](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.ru.vtt)
- **Subtitles (tr):** [Türkçe](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.tr.vtt)
- **Subtitles (zh):** [中文](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.zh.vtt)
- **Subtitles (ko):** [???](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.ko.vtt)
- **Subtitles (it):** [Italiana](https://www.metatrader.video/video/mt5/client/mcp-ai-assistant/subtitles.it.vtt)

## About MCP

The [Model Context Protocol](https://modelcontextprotocol.io/) is an open standard that acts as a universal bridge between AI agents and apps. It enables you to connect your trading platform to any MCP-supported environment or agent, such as [Claude Code](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/configuration#claude_code_mcp_config) or [Codex](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/configuration#codex_mcp_config).

Through MCP, an AI discovers the platform's capabilities, gets data, analyzes markets, executes and manages trades, and performs any supported task. Unlike traditional chatbots that can only generate texts in a question-answer format, MCP-enabled agents typically execute multi-step workflows and interact directly with applications.

## Using the Built-in AI Assistant [#](#using_ai_assistant)

The built-in AI Assistant is powered by a free MQL5 lite model by default. To use the AI Assistant, make sure you are [signed in](https://www.metatrader5.com/en/terminal/help/startworking/settings#community) to your MQL5.community account. Then click the AI icon in the top menu to start a new session.

![AI Assistant icon in the top menu](https://www.metatrader5.com/i/help/terminal/en/ai_icon_top_menu.png)

After that, type in what you want and send it.

![Using the AI Assistant](https://www.metatrader5.com/i/help/terminal/en/using_ai_assistant.png)

You can [configure the AI Assistant](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/configuration#ai_assistant_settings) as you like and restrict it from trading, using the web, and running shell commands. This allows for safe, secure AI use while keeping sensitive capabilities under your control.

Optionally, you can set up the AI assistant to [use an AI model](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/configuration#ai_assistant_settings) from a leading provider, including OpenAI, Anthropic, Google, and others. This gives you the flexibility to choose the best model for your needs and budget.

> MetaEditor also features MCP servers and a built-in AI Assistant, supporting algorithm development and complex file operations via simple natural language commands.

## Prompt Examples

The prompts in the table illustrate common AI use cases in trading and analysis. However, you may benefit from learning about [each tool](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/capabilities) provided by the platform's MCP servers and studying [practical examples](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/practical_examples).

> Adapt the symbols, periods, position sizes, risk limits, and any criteria to your approach or preferences. Carefully study every prompt before using it and review any proposed action before executing it.
>
> You are solely responsible for AI-generated content, AI-assisted actions, trading decisions, trading results, and any resulting losses.

| Category | Prompt |
| --- | --- |
| Analysis | ```<br>Fetch H1 candle data for GBPUSD for the last 7 days and analyze the current trend and momentum.<br><br>Pull and study the income statement, quarterly metrics, and recent news for Apple to evaluate its profitability.<br>``` |
| Trading | ```<br>Open a 0.5-lot EURUSD market order with the stop loss and take profit set to the H4 volatility distance.<br><br> Modify position #12345678 and set its stop loss to 1.0820 and take profit to 1.0950.<br>``` |
| Account/portfolio management | ```<br>Pull my 30-day trading history, calculate the expectancy per trade and correlation risk, and provide insights.<br><br>Check the web for news and upcoming events and tell me how they affect my open positions and pending orders.<br>``` |
| Charts | ```<br>Open EURUSD and GBPUSD charts on M5, H1, and H4.<br><br>List all currently open charts and the indicators or Expert Advisors attached to them.<br><br>Close all the charts where I don't have a pending order or open position.<br><br>Apply my swing reversal template to all open H4 charts and tell me the best setup to trade right now.<br>``` |
| Watchlists | ```<br>Add EURUSD, USDJPY, XAUUSD, and all symbols with active charts to my Market Watch.<br><br>Arrange the symbols in my Market Watch in descending order of trade frequency for the last 7 days.<br>``` |
| Strategy testing | ```<br>Backtest the Quantum Excellence EA on H1 real ticks for the last 5 years.<br><br>Optimize the trend period, stop loss, and take profit of the Smart Gold EA.<br>``` |
| MQL5 development | ```<br>Create an indicator that applies the full chart color profile of MetaTrader Web light mode to charts.<br><br>Create an Expert Advisor that opens buy and sell positions using MACD crossovers.<br>``` |

## In this section

- [Configuration](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/configuration)
- [Capabilities](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/capabilities)
- [Examples](https://www.metatrader5.com/en/terminal/help/mcp_and_ai/practical_examples)

```json
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ {"@type": "ListItem", "position": 1, "item": {"@id": "https://www.metatrader5.com/en/terminal/help", "name": "MetaTrader 5 Help"}}, {"@type": "ListItem", "position": 2, "item": {"@id": "https://www.metatrader5.com/en/terminal/help/mcp_and_ai", "name": "MCP and AI"}} ]}
{ "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "MetaTrader 5: MCP and AI", "acceptedAnswer": { "@type": "Answer", "text": "The trading platform integrates artificial intelligence directly into the trading environment, allowing AI agents to work with real data and..." } }] }
```
