XBTFX MCP Trading Server
Enables AI agents to trade forex, metals, indices, and cryptocurrencies via the Model Context Protocol using the XBTFX Trading API. It provides comprehensive tools for managing account balances, retrieving market data, and executing trade operations like opening, modifying, or closing positions.
README
XBTFX MCP Trading Server
MCP server for the XBTFX Trading API — trade forex, metals, indices, and crypto 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.
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-trading
Claude 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-trading
Then 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 |
|---|---|
get_auth_status |
Check API key status, login, margin mode, permissions |
get_account |
Balance, equity, margin, P&L, leverage |
get_positions |
All open positions with P&L |
get_orders |
Pending limit/stop orders |
get_history |
Deal history by period or date range |
get_symbols |
All 400+ tradeable instruments |
get_symbol |
Detailed spec for one symbol (digits, volume limits, spread) |
Trading
| Tool | Description |
|---|---|
trade |
Open a position (buy/sell) with optional SL/TP |
close_position |
Close a position (full or partial) |
modify_position |
Change SL/TP on an existing position |
close_by |
Close against an opposite position (hedging mode) |
reverse_position |
Reverse a position direction |
close_all |
Close all open positions |
close_symbol |
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.