cTrader MCP 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., "@cTrader MCP Servershow my open positions and unrealized 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.
cTrader MCP Server
This project builds an MCP server for cTrader using the Alpaca reference architecture, adapted to the cTrader API and the bundled OpenApiPy library.
Features
16 cTrader tools across account, market, positions, and trading categories
OpenAPI-first generation using FastMCP from spec-driven sources
Custom overrides for complex operations (create_order, amend_order, close_position)
Trust boundary security with parameter validation and account isolation
Backdoor authentication (no OAuth) using pre-provisioned credentials
Azure Key Vault integration for credential management
Comprehensive documentation generation from tool registry
Related MCP server: MetaTrader5 MCP Server
Project Structure
ctrader-mcp-server/
├── src/ctrader_mcp_server/
│ ├── config.py # Runtime config & Azure Key Vault loading
│ ├── ctrader_session.py # Backdoor session bootstrap (ProtoOA auth)
│ ├── server.py # FastMCP server construction with overrides
│ ├── tool_registry.py # 16 tool definitions with metadata
│ ├── toolsets.py # Tool organization by category
│ ├── overrides.py # Custom handlers for complex operations
│ ├── security.py # Trust boundary & parameter validation
│ ├── readme_docs.py # Documentation generation
│ └── specs/
│ └── ctrader-api.json # OpenAPI spec (all 16 endpoints)
├── tests/
│ ├── test_config.py # Config & Key Vault loading
│ ├── test_ctrader_session.py # Session bootstrap
│ ├── test_overrides.py # Override validation logic
│ ├── test_security.py # Security & trust boundary
│ ├── test_readme_docs.py # Documentation generation
│ └── test_server_construction.py # Server build & tools
└── OpenApiPy/ # cTrader client library (submodule)Available Tools
The server exposes 16 tools organized into 4 categories:
Account (3 tools)
get_account_status- Current account status and sessionget_trader- Trader profile and account metadataget_account_list_by_access_token- Accounts for access token
Market (4 tools)
list_symbols- Available instruments with metadataget_symbol- Detailed symbol informationlist_symbol_categories- Symbol category organizationget_market_data- Recent market data and quotes
Positions (4 tools)
list_positions- Open positions and statusget_position_unrealized_pnl- Position unrealized P&Lclose_position- Close position (with override validation)list_deals_by_position_id- Deal history for position
Trading (5 tools)
list_orders- Open orders with filteringget_order_details- Specific order informationcreate_order- Create new order (with override validation)amend_order- Update order parameters (with override validation)cancel_order- Cancel open order
Authentication
The server uses a backdoor authentication model (no OAuth required):
Application Auth:
ProtoOAApplicationAuthReqwith app credentialsAccount Auth:
ProtoOAAccountAuthReqwith access token and account IDSession Ready: All subsequent tool requests use authenticated session
from ctrader_mcp_server.config import CTraderRuntimeConfig
from ctrader_mcp_server.ctrader_session import CTraderBackdoorSession
# Load credentials from env or Azure Key Vault
config = CTraderRuntimeConfig.from_env()
# Initialize session with backdoor auth
session = CTraderBackdoorSession(config)
# Session sends auth requests automatically
session.authenticate(client)Configuration
Environment Variables
export ctrader-app-client-id="your-app-id"
export ctrader-app-client-secret="your-app-secret"
export ctrader-access-token-icmarkets="your-token"
export ctrader-account-id-icmarkets="your-account-id"Azure Key Vault
Alternatively, set the vault URL:
export AZURE_KEY_VAULT_URL="https://ctrader.vault.azure.net"The app automatically retrieves:
ctrader-app-client-idctrader-app-client-secretctrader-access-token-icmarketsctrader-account-id-icmarkets
Security
The server implements trust boundary protection via security.py:
Account Isolation: Requests always bound to authenticated account
Parameter Validation: Trading volumes, prices, sides validated
Output Wrapping: Structured responses wrapped in security envelopes
Override Validation: Custom functions validate complex requests
Custom Overrides
overrides.py provides targeted handling for complex operations:
# Create order with volume validation
await override_create_order(
account_id="123",
symbol="EURUSD",
side="BUY",
order_type="MARKET",
volume=100
)
# Close position with optional partial close
await override_close_position(
account_id="123",
position_id="pos-456",
volume=50 # Optional: partial close
)
# Amend order with price/volume updates
await override_amend_order(
account_id="123",
order_id="order-789",
price=1.2500 # Optional
)Architecture
OpenAPI-first MCP generation - Tools derived from spec-driven sources
FastMCP integration - Mounts spec-generated tools on startup
Override pattern - Narrow custom handlers for non-trivial endpoints
Security wrappers - Trust boundary enforcement at request/response boundary
Aligned with Alpaca reference - Follows established MCP server patterns
Reference Implementation
The Alpaca MCP server provides the architectural blueprint:
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Remote MCP for KOYN FX: account, markets, and TradeLocker tools over OAuth.
Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI applications to interact with MetaTrader 5 terminals via WebSocket MCP protocol for trading operations and account management.4
- FlicenseNot gradedqualityCmaintenanceEnables trading on MetaTrader5 platform via MCP, including account management, order placement, market data, technical indicators, and signal tools.4
- FlicenseNot gradedqualityCmaintenanceEnables LLMs to trade on MetaTrader 5 via REST API or MCP tools, supporting market/pending orders, position management, and account info retrieval.
- FlicenseBqualityBmaintenanceEnables unified access to portfolio management, market data, risk analysis, trade records, compliance checks, and Slack notifications through a single MCP server.18
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/quin345/cTrader-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server