XBTFX MCP Trading Server
Click on "Install 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 ServerShow 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 at my.xbtfx.com 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"
}
}
}
}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
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/XBTFX/xbtfx-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server