XBTFX MCP Trading Server
Trade forex, crypto, metals, indices, stocks, and energies on XBTFX MetaTrader 5 accounts via MCP.
Check API key status, login, margin mode, permissions, and tier
Get account balance, equity, margin, free margin, unrealized P&L, and leverage
List open positions, pending orders, and deal history
List all tradeable symbols and get detailed specs for one symbol
Get live bid/ask quotes for up to 20 symbols
Open market buy/sell positions with optional SL/TP and idempotency keys
Close positions fully or partially by ticket
Modify SL/TP on open positions
Close two opposing positions against each other (hedging only)
Reverse a position direction
Bulk close all open positions or all positions for a specific symbol
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@XBTFX MCP Trading Server Show my current open positions and total P&L"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
XBTFX MCP Trading Server
MCP server for the XBTFX Trading API — trade forex, crypto, metals, indices, stocks, and energies through XBTFX MetaTrader 5 accounts, from any AI agent that supports the Model Context Protocol.
Works with Claude Code, Claude Desktop, OpenAI Codex, Cursor, Windsurf, and any other MCP-compatible client.
Note: This API is for XBTFX trading accounts only. Create an account in the XBTFX Portal and manage API keys at console.xbtfx.com.
Setup
Get an API key from console.xbtfx.com
Add to your AI tool:
Claude Code
claude mcp add xbtfx-trading -e XBTFX_API_KEY=xbtfx_live_your_key_here -- npx @xbtfx/mcp-tradingClaude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"xbtfx-trading": {
"command": "npx",
"args": ["@xbtfx/mcp-trading"],
"env": {
"XBTFX_API_KEY": "xbtfx_live_your_key_here"
}
}
}
}OpenAI Codex
codex mcp add xbtfx-trading -- npx @xbtfx/mcp-tradingThen set the API key in your environment before running Codex:
export XBTFX_API_KEY="xbtfx_live_your_key_here"Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"xbtfx-trading": {
"command": "npx",
"args": ["@xbtfx/mcp-trading"],
"env": {
"XBTFX_API_KEY": "xbtfx_live_your_key_here"
}
}
}
}Related MCP server: ReadyTrader-FOREX
Tools
Account & Market Data
Tool | Description |
| Check API key status, login, margin mode, permissions |
| Balance, equity, margin, P&L, leverage |
| All open positions with P&L |
| Pending limit/stop orders |
| Deal history by period or date range |
| All 400+ tradeable instruments |
| Detailed spec for one symbol (digits, volume limits, spread, swaps, margins, sessions) |
| Live bid/ask prices for one or more symbols (max 20) |
Trading
Tool | Description |
| Open a position (buy/sell) with optional SL/TP |
| Close a position (full or partial) |
| Change SL/TP on an existing position |
| Close against an opposite position (hedging mode) |
| Reverse a position direction |
| Close all open positions |
| Close all positions for one symbol |
Example Conversation
You: What's my account balance?
AI: calls get_account — Your balance is $988.00 with $888.00 free margin. Leverage is 1:1000. No open positions.
You: Buy 0.01 lots of EURUSD with a 50 pip stop loss
AI: calls get_symbol for EURUSD, then calls trade — Opened BUY 0.01 EURUSD at 1.15350. Set SL at 1.14850 (50 pips). Ticket #23015470.
You: How's that position doing?
AI: calls get_positions — EURUSD BUY 0.01 lots: opened at 1.15350, current price 1.15380, P&L: +$0.30.
API Documentation
XBTFX Console — API key management
XBTFX Skills Hub — Detailed API reference
API Examples — Python, JavaScript, Go, curl
License
MIT
Available Tools
15 toolsclose_allADestructive
Close ALL open positions on the account. Destructive bulk operation — confirm with user first. Costs 10 weight.
Inputs: comment, idempotency_key.
close_byADestructive
Close two opposing positions against each other (saves spread on smaller side). Hedging accounts only — check get_auth_status first. Returns 400 on netting accounts.
Inputs: position (required), position_by (required), comment, idempotency_key.
close_positionADestructive
Close an open position by ticket. Omit volume for full close, or specify volume for partial close.
Inputs: ticket (required), volume, comment, idempotency_key.
close_symbolADestructive
Close all positions for a specific symbol. Destructive — confirm with user first. Costs 10 weight.
Inputs: symbol (required), comment, idempotency_key.
get_accountBRead-only
Get account balance, equity, margin, free margin, unrealized P&L, and leverage
Inputs: no named parameters.
get_auth_statusARead-only
Check API key status — returns login, margin mode (hedging/netting), permissions, and tier. Call this once at session start.
Inputs: no named parameters.
get_historyARead-only
Get trade deal history. Use EITHER a preset period OR a from/to date range, not both. Custom ranges limited to 90 days. Costs 2 weight.
Inputs: period, from, to.
get_ordersARead-only
List pending limit/stop orders with ticket, symbol, type, volume, and trigger price
Inputs: no named parameters.
get_positionsARead-only
List open positions with ticket, symbol, side, volume, entry/current price, SL/TP, and P&L. Optionally filter by symbol.
Inputs: symbol.
get_quoteARead-only
Get the current live bid/ask price for one or more symbols. Returns prices from the Continuum feed. Use this to check prices before trading or to monitor price levels.
Inputs: symbols (required).
get_symbolARead-only
Get detailed spec for one symbol — digits, contract size, volume min/max/step, spread, margin rate, swap rates, trading sessions, and live bid/ask. Call before trading to validate volume.
Inputs: symbol (required).
get_symbolsARead-only
List all 400+ tradeable symbols with bid/ask. Warning: large response, costs 2 weight. Prefer get_symbol for a single instrument.
Inputs: no named parameters.
modify_positionAIdempotent
Update SL and/or TP on an open position. Pass 0 to remove SL or TP. At least one of sl or tp is required.
Inputs: ticket (required), sl, tp.
reverse_positionADestructive
Close a position and immediately open the opposite side with same volume. Two-step composite — if the re-open fails (207), the position is already closed. Costs 2 weight.
Inputs: ticket (required), comment, idempotency_key.
tradeAIdempotent
Open a new position (market order). Call get_symbol first to check volume_min/max/step. Confirm with user before executing.
Inputs: symbol (required), side (required), volume (required), sl, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have distinct purposes, but there is some overlap between close_all, close_symbol, and close_position, which could cause confusion about which to use for bulk operations. However, their descriptions clarify specific use cases (e.g., close_all for all positions, close_symbol for a specific symbol, close_position for a single ticket), mitigating ambiguity.
Tool names follow a highly consistent verb_noun pattern throughout, such as close_all, get_account, modify_position, and trade. All names use snake_case uniformly, making them predictable and easy to understand for agents.
With 15 tools, the server is well-scoped for a trading domain, covering essential operations like account management, position handling, and market data. Each tool serves a clear purpose, and the count aligns with typical server sizes (3-15 tools), avoiding bloat or insufficiency.
The toolset provides comprehensive coverage for trading workflows, including CRUD operations for positions (open, modify, close), account and symbol queries, order management, and historical data. No obvious gaps exist; agents can perform full lifecycle actions from market analysis to trade execution and closure.
Maintenance
Related MCP Connectors
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
OpenFinance gives any AI agent easy trading across every major market through one hosted MCP server. Trade crypto spot and perpetuals on Hyperliquid with market, limit and TWAP orders, leverage and margin control. Trade stocks, indices, commodities, forex and pre-IPO names as Hyperliquid HIP-3 perps. Trade Polymarket prediction markets with odds, order books, positions, PnL and trader leaderboards. Swap and bridge across 40+ EVM chains and Solana with Relay and Jupiter, find memecoins across 200+ chains, launch tokens on Robinhood Chain and Solana, and buy crypto with card, bank or UPI. Write actions are designed to ask for your confirmation first. Connect with OAuth (sign in to OpenFinance and approve) or an API key. Works with Claude, ChatGPT, Cursor, VS Code, Codex and any MCP client. No install. Home: https://openfinance.tech/agents · Docs: https://docs.openfinance.tech · GitHub: https://github.com/openfinance-tech/mcp
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Connect any brokerage account, including Robinhood, Charles Schwab, E*Trade, Webull, Public, Tastytrade, Moomoo, TradeStation, Coinbase, and Kraken, to ChatGPT, Claude, Gemini, Grok, Muse, or any MCP client. Look up accounts, holdings, and option chains, then place stock, multi-leg options, and crypto orders, including bracket orders with take-profit and stop-loss. Every order is shown for your approval before it’s placed unless you choose otherwise.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the MetaTrader 5 trading platform for market data analysis, placing trades, and managing trading positions. Provides comprehensive access to forex and financial market operations through the Model Context Protocol.1-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to perform forex trading operations through brokerages with risk controls and safety guardrails.MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to trade on MetaTrader 5 via REST API or MCP tools, supporting market/pending orders, position management, and account info retrieval.-
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with the PocketOption trading platform via MCP, including balance checks, candle data, asset screening, and trade placement, with support for multi-agent coordination.248MIT