loading…
Search for a command to run...
loading…
A standalone Model Context Protocol (MCP) server that enables AI assistants to interact with the cTrader trading platform.
A standalone Model Context Protocol (MCP) server that enables AI assistants to interact with the cTrader trading platform.
A standalone Model Context Protocol (MCP) server that enables AI assistants to interact with the cTrader trading platform.
This MCP server allows AI assistants like Claude to execute trades, analyze markets, and manage positions on cTrader through natural language conversations.
Example conversations:
| Tool | Description |
|---|---|
get_account_status |
View balance, equity, margin, and P&L |
get_positions |
List all open positions with details |
get_pending_orders |
Show all pending limit/stop orders |
get_position_pnl |
Get detailed P&L breakdown |
create_market_order |
Execute trade at current market price |
create_limit_order |
Place order at specific price |
create_stop_order |
Place stop-loss or stop-entry order |
close_position |
Close position fully or partially |
cancel_order |
Cancel a pending order |
list_symbols |
Browse available trading instruments |
get_historical_data |
Get OHLCV candlestick data |
get_indicator |
Calculate technical indicators |
subscribe_to_ticks |
Subscribe to real-time price updates |
unsubscribe_from_ticks |
Unsubscribe from price updates |
CLIENT_IDCLIENT_SECRETACCESS_TOKENACCOUNT_ID# Clone or download this repository
cd ctrader-mcp-server
# Run installation script
./install.sh
Create a .env file in the project root:
CLIENT_ID=your_client_id_here
CLIENT_SECRET=your_client_secret_here
ACCESS_TOKEN=your_access_token_here
ACCOUNT_ID=your_account_id_here
HOST=demo
Important: Use HOST=demo for testing!
# Activate virtual environment
source venv/bin/activate
# Run tests
python test_server.py
You should see:
✓ Bot initialized and authenticated
✓ Account status retrieved
✓ Found X EUR symbols
...
All Tests Completed Successfully! ✓
Find your config file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonAdd this configuration:
{
"mcpServers": {
"ctrader": {
"command": "/absolute/path/to/ctrader-mcp-server/venv/bin/python",
"args": [
"/absolute/path/to/ctrader-mcp-server/server.py"
],
"cwd": "/absolute/path/to/ctrader-mcp-server"
}
}
}
This server implements the standard MCP protocol and should work with any MCP-compatible client.
Once configured, you can interact naturally:
Check Account:
You: "How much money do I have in my cTrader account?"
AI: "Your account has a balance of $10,000, equity of $10,250, with 3 open positions generating a total P&L of +$250."
Place Trade:
You: "Buy 0.01 lots of EURUSD with stop loss at 1.08 and take profit at 1.10"
AI: "Order executed! Bought 0.01 lots of EURUSD at 1.09245 with stop loss at 1.08000 and take profit at 1.10000."
Analyze Market:
You: "Calculate the RSI for GBPUSD on the 15-minute chart"
AI: "GBPUSD RSI(14) on M15 is currently at 65.3, indicating the pair is approaching overbought territory."
Manage Risk:
You: "Close all positions that are losing more than $50"
AI: "Found 1 position losing more than $50. Closed GBPUSD position (loss: -$62.50)."
HOST=live in .env for live trading.env file (never committed)⚠️ Trading involves significant risk. You can lose money.
⚠️ Always test on demo accounts first
⚠️ Start with small positions when going live
⚠️ Use stop losses to limit risk
⚠️ Never share your credentials or access tokens
ctrader-mcp-server/
├── server.py # Main MCP server
├── ctrader_bot.py # cTrader API wrapper
├── test_server.py # Testing tool
├── install.sh # Installation script
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── README.md # This file
└── docs/ # Documentation
├── QUICKSTART.md
├── GUIDE.md
├── ARCHITECTURE.md
├── CONFIGURATION.md
└── API.md
# Basic functionality test
python test_server.py
# Run with specific account
ACCOUNT_ID=12345 python test_server.py
# Test with live account (careful!)
HOST=live python test_server.py
To add new tools:
server.py handle_list_tools()_execute_tool()ctrader_bot.py if neededcTrader API enforces:
The server automatically respects these limits.
.env file credentialslist_symbols tool to see available symbolsMIT License - See LICENSE file for details
This software is provided "as is" without warranty of any kind. Trading involves significant risk and you can lose money. Use at your own risk. Always test on demo accounts before live trading.
Contributions are welcome! Please:
Made with ❤️ for algorithmic traders
Ready to start? Run ./install.sh and follow the instructions above!
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"ctrader-mcp-server": {
"command": "npx",
"args": []
}
}
}