Connect Claude and ChatGPT to MetaTrader 5 (MCP)
Connect Claude, ChatGPT and AI agents to MT5 with the fxapis hosted MCP server: OAuth sign-in, a read-only connector, and trading only if you allow it.
On this page
fxapis runs a hosted Model Context Protocol (MCP) server for MetaTrader 5. Add it to Claude or ChatGPT, sign in to fxapis, and the assistant can read your MT5 accounts, positions, orders and history — and, only if you allow it, trade. It works with any MT5 broker (Exness, IC Markets, Pepperstone, XM, a prop firm's server such as FTMO's, or another), and there is nothing to install: the MT5 terminals run in fxapis's cloud.
Two connectors: read-only and full
| Aspect | Read-only connector | Full connector |
|---|---|---|
| URL | https://api.fxapis.com/mcp/insights | https://api.fxapis.com/mcp |
| Accounts, figures, positions, orders, history | ||
| Quotes, symbol details, market hours | ||
| Price history (candles) | ||
| Bring accounts online or offline | , if you allow trading | |
| Open, close and modify trades | No trading tools at all | , if you allow trading, on the accounts you pick |
| Sign-in grants | Read access only | Read access, plus trading if you tick it |
Start with the read-only connector. Add the full one later, if and when you want the assistant to trade. Each is listed and revoked separately.
How sign-in works
- OAuth sign-in, no key to copy. The first time the app uses fxapis, it opens fxapis's sign-in page. You choose what it may do: read access is always included; Trading is off unless you tick it, and then applies only to the accounts you pick, with an optional maximum order size and number of orders a day. Trading needs two-factor turned on.
- Revoke any time. Every connected app is listed in the console under API keys → Connected apps, with when it was last used. Revoke ends its access on its very next request.
- The same rules as the REST API. A connected app acts through the ordinary API with exactly what you allowed. Plan limits, idempotency and the workspace kill switch apply.
- Deliberately missing: connecting an MT5 account and managing keys. Connecting takes the broker password, which must never pass through an AI model. Do both in the console.
Connect Claude
On claude.ai or Claude Desktop, on any Claude plan:
- Open Customize → Connectors → Add custom connector. On Team and Enterprise, an Owner adds it under Organization settings → Connectors.
- Remote MCP server URL:
https://api.fxapis.com/mcp/insightsfor read-only, orhttps://api.fxapis.com/mcpfor the full connector. Leave the OAuth client fields empty. - Click Connect, sign in to fxapis in the window that opens, and allow access.
In Claude Code:
claude mcp add --transport http fxapis https://api.fxapis.com/mcp
Then run /mcp, choose fxapis and Authenticate. The fxapis plugin adds the server, a safe-trading skill and a hook that confirms every trade.
Connect ChatGPT
Adding a custom MCP server is done in ChatGPT on the web: open Plugins, choose + and Add custom MCP server, enter one of the URLs above, and choose OAuth. Then sign in to fxapis when ChatGPT asks.
What ChatGPT allows depends on your ChatGPT plan. OpenAI's help page (Connecting custom MCP servers in ChatGPT, checked 26 October 2026) lists full MCP, including actions that change things, for Business, Enterprise and Edu, and read/fetch permissions for Pro. On Business, only workspace owners and admins can add one. Set the app to ask before it acts.
Agents with an API key
For scripts, unattended agents, Cursor and VS Code, use an API key with the fewest scopes that do the job:
| The agent should… | Scopes |
|---|---|
| Report on accounts, positions and history | accounts:read, trading:read, history:read |
| …and bring accounts online or take them offline | add accounts:write |
| …and manage risk: close, move stops, cancel — never open | add trading:reduce |
| …and open new positions | add trading:execute |
claude mcp add --transport http fxapis https://api.fxapis.com/mcp \
--header "Authorization: Bearer $FXAPIS_KEY"
fxapis-mcp-examples has tested configs for Claude Code, Cursor, VS Code, the OpenAI Responses API and the Anthropic Messages API. A tool the key does not cover answers MISSING_SCOPE, and the agent is told to ask you rather than work around it. API keys vs broker logins explains why the key, not the MT5 password, is what you hand out.
Keeping an assistant safe around real money
An assistant can misread a request, act on text planted in something it was asked to summarise, or loop. The protections, strongest first:
- What you allowed at sign-in (or the key's scopes), enforced by the API on every call: read-only means no trading tools; trading is limited to the accounts you picked and the limits you set.
- Two-factor before any app may trade.
- Demo accounts while you learn how an assistant behaves — fxapis has no simulated market.
- Your plan's limits, which refuse opening orders past the allowance; closing is never refused for billing.
- Your app's confirmations. Trading tools are marked destructive, so Claude asks before each trade. Don't choose "always allow" for trading tools on a live account.
If you trade a prop-firm account, the firm decides whether an AI assistant or a hosted service may trade it. Read its current rules and ask it in writing first.
Things to try
- "Which of my MT5 accounts are online, and what positions are open on each?"
- "How much margin would 0.5 lots of XAUUSD need on my demo account?"
- "Is the gold market open right now, and what's the spread?"
- "Did anything go wrong with today's orders? Show me any that are still
unknown."
Where to go next
- The MCP guide has every tool, the scope each needs, and the safety model; the read-only connector guide lists its tools.
- The MCP server on the website, and pricing: Personal ($9 a month) includes the connector; Personal, Production and Business each start with a 14-day free trial of that plan on demo accounts (up to 5; Personal 2), with no card, and Enterprise is priced with you.