Lewati ke konten utama

MCP Server

MCP server — tool AI untuk client AI eksternal (Claude, dll.) mengakses data dan kontrol trading.

Apa itu MCP?​

Model Context Protocol (MCP) adalah protokol untuk menghubungkan AI dengan tools dan data. cMind menyediakan MCP server yang mengekspos data dan kontrol trading ke AI client.

Endpoint​

/mcp (HTTP + SSE)

Server berjalan sebagai service terpisah di belakang ALB/Nginx.

Authentication​

Bearer Token​

curl -H "Authorization: Bearer <token>" http://localhost:5000/mcp

API Key​

curl -H "x-api-key: <api-key>" http://localhost:5000/mcp

Tools​

Trading​

ToolDeskripsi
get_accountsDaftar semua akun trading
get_positionsPosisi terbuka
place_orderTempatkan order
close_positionTutup posisi
modify_orderUbah stop loss / take profit

Market Data​

ToolDeskripsi
get_quotesQuote real-time
get_ohlcvOHLCV data
get_symbolsDaftar simbol yang tersedia
search_symbolsCari simbol

cBot​

ToolDeskripsi
list_cbotsDaftar cBot
start_cbotMulai cBot
stop_cbotStop cBot
get_cbot_statusStatus cBot

Copy Trading​

ToolDeskripsi
list_copy_profilesDaftar profil copy
create_copy_profileBuat profil baru
recommend_copy_profileAI rekomendasikan pengaturan

Backtest​

ToolDeskripsi
list_backtestsDaftar backtest
run_backtestJalankan backtest
get_backtest_resultHasil backtest

Contoh​

Claude Desktop​

// claude_desktop_config.json
{
"mcpServers": {
"cmind": {
"command": "curl",
"args": ["-s", "http://localhost:5000/mcp"]
}
}
}

Penggunaan​

You: What are my current positions?

Claude: Let me check that for you.
→ get_positions()

Result: [
{ "symbol": "EURUSD", "direction": "buy", "lots": 0.5, "pnl": 125.50 },
{ "symbol": "XAUUSD", "direction": "sell", "lots": 0.1, "pnl": -45.00 }
]

Streaming​

MCP mendukung SSE (Server-Sent Events) untuk streaming real-time:

const eventSource = new EventSource('/mcp/stream?token=<token>');

eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
// Handle streaming data
};

Error Handling​

Error CodeArti
401Unauthorized
403Forbidden
404Resource not found
429Rate limited
500Internal error

Rate Limits​

TierRequests/minute
Free10
Pro60
Enterprise600