MetaTrader MCP server

Give an AI agent read access to your MetaTrader 4 and MetaTrader 5 accounts. The FxSocket MCP server lets Claude, Cursor, VS Code and any other Model Context Protocol client answer questions about your trading: balance and equity across accounts, what is open right now, how last month went, live quotes and price history. It is read-only. No tool can place, modify or close an order.

Server URLhttps://mcp.fxsocket.com/mcp

1. Create a read-only API key

On the API Key page, create a read-only key. It starts with fxs_ro_, can call every tool here, and cannot trade through any other endpoint either. Name it and limit it to the accounts the agent should see, and the agent never learns the others exist. Your full fxs_live_ key works too, but an agent has no use for one.

2. Connect your client

Clients that take a remote server URL and a header connect directly. Clients that only start local servers, such as Claude Desktop, use the Docker image.

Claude Code
claude mcp add --transport http fxsocket https://mcp.fxsocket.com/mcp \
  --header "X-API-Key: fxs_ro_xxx"
Cursor: ~/.cursor/mcp.json
{
  "mcpServers": {
    "fxsocket": {
      "url": "https://mcp.fxsocket.com/mcp",
      "headers": { "X-API-Key": "fxs_ro_xxx" }
    }
  }
}
VS Code: .vscode/mcp.json
{
  "servers": {
    "fxsocket": {
      "type": "http",
      "url": "https://mcp.fxsocket.com/mcp",
      "headers": { "X-API-Key": "fxs_ro_xxx" }
    }
  }
}
Claude Desktop: claude_desktop_config.json
{
  "mcpServers": {
    "fxsocket": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "FXSOCKET_API_KEY", "fxsocket/mcp"],
      "env": { "FXSOCKET_API_KEY": "fxs_ro_xxx" }
    }
  }
}

Any other client works the same way: point it at https://mcp.fxsocket.com/mcp with the key in an X-API-Key header (Authorization: Bearer is accepted too), or run the Docker image as a local server.

Tools

Eight tools, all read-only. Each one is shaped around a question rather than an endpoint, so “what is open across my accounts” is one call that reads every terminal at once.

  • list_accounts: Every account the key can see, with its id, nickname, platform, server, login and connection status, optionally with balance, equity and totals per currency. Agents call it first.
  • get_account: One account in full: balance, equity, margin, margin level and leverage, account settings such as the stop-out level, and terminal health.
  • get_open_positions: Open positions and pending orders across accounts, filterable by symbol and type, with floating profit, swap and totals per currency.
  • get_trade_history: Closed trades for a period (the last 7 days by default, up to 366), with wins, losses, win rate, net profit, the best and worst trade, and a breakdown by symbol.
  • search_symbols: The broker's exact symbol name. EURUSD is EURUSD.sd or EURUSDm at some brokers, so agents look it up before asking for prices.
  • get_quotes: Live bid, ask and spread for up to 20 symbols.
  • get_symbol_info: The contract specification: digits, contract size, tick value, volume limits, swap rates, commissions and trading sessions.
  • get_price_history: OHLC candles for a symbol and timeframe, up to 500 bars per call.

What you can ask

  • “What is my total equity across all accounts, per currency?”
  • “Which open positions are in the red right now, and by how much?”
  • “What was my win rate on XAUUSD last month, and what was my worst trade?”
  • “Compare the EURUSD spread on each of my brokers.”
  • “Pull the last 200 H1 candles of GBPUSD and describe the trend.”

Read-only by design

The server cannot trade because of what its code can reach, not because of a setting: every tool reads from the terminal and none of them can send an order. So a confused or manipulated agent still cannot open, change or close a position.

Money is reported in each account’s deposit currency and never added across currencies; the tools return totals per currency so the model does not have to do that arithmetic. Times are broker server time, as everywhere else in the API.

Limits: 60 requests a minute per user, up to 50 accounts and 300 order or trade rows in one reply. Counts and totals always cover everything; only the row lists are cut.

Run it locally with Docker

The fxsocket/mcp image runs the server as a local stdio process, for clients that start their servers themselves. It is a small relay, one Python file with no dependencies, that passes each message to mcp.fxsocket.com with your key. The tools and your data still come from FxSocket, so the image never needs updating when tools change. Published for amd64 and arm64.

Run
FXSOCKET_API_KEY=fxs_ro_xxx docker run -i --rm -e FXSOCKET_API_KEY fxsocket/mcp

Docker Hub · Source on GitHub (MIT)

Protocol details

  • Transport: Streamable HTTP, POST only, JSON responses. Stateless, with no session to keep alive.
  • Protocol versions: 2026-07-28 (per-request metadata, no handshake) and 2025-03-26 through 2025-11-25 (the initialize handshake).
  • Authentication: the same API keys as the platform API, in X-API-Key or Authorization: Bearer.
  • Not yet supported: the web connectors in claude.ai and ChatGPT, which sign in with OAuth rather than a header. Claude Desktop works today through the Docker image.