CCXT MCP Server
CCXT MCPサーバー
CCXT MCPサーバーは、Model Context Protocol (MCP) を通じてAIモデルが暗号資産取引所のAPIと対話できるようにするサーバーです。このサーバーは CCXTライブラリ を使用して、100以上の暗号資産取引所とその取引機能へのアクセスを提供します。
🚀 クイックスタート
# Install the package globally
npm install -g @lazydino/ccxt-mcp
# Run with default settings
ccxt-mcp
# or run without installation
npx @lazydino/ccxt-mcpRelated MCP server: EVM MCP Server
インストールと使用方法
グローバルインストール
# Install the package globally
npm install -g @lazydino/ccxt-mcpnpxでの実行
インストールせずに直接実行することも可能です:
# Using default settings
npx @lazydino/ccxt-mcp
# Using custom configuration file
npx @lazydino/ccxt-mcp --config /path/to/config.jsonヘルプを表示:
npx @lazydino/ccxt-mcp --help設定
Claude DesktopへのMCPサーバーの登録
Claude Desktopの設定を開く:
Claude Desktopアプリの設定メニューに移動します
「MCP Servers」セクションを探します
新しいMCPサーバーを追加する:
「Add Server」ボタンをクリックします
サーバー名:
ccxt-mcpコマンド:
npx @lazydino/ccxt-mcp追加の引数(オプション):
--config /path/to/config.json
サーバーを保存してテストする:
設定を保存します
「Test Connection」ボタンで接続をテストします
設定方法 - 2つのオプション
オプション1: Claude Desktopの設定にアカウント情報を直接含める(基本方法)
この方法は、CCXTのアカウント情報をClaude Desktopの設定ファイル(claude_desktop_config.json)に直接含めます:
{
"mcpServers": {
"ccxt-mcp": {
"command": "npx",
"args": ["-y", "@lazydino/ccxt-mcp"],
"mcpBearerToken": "YOUR_MCP_TOKEN",
"accounts": [
{
"name": "bybit_main",
"exchangeId": "bybit",
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET_KEY",
"defaultType": "spot"
},
{
"name": "bybit_futures",
"exchangeId": "bybit",
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET_KEY",
"defaultType": "swap"
}
]
}
}
}この方法を使用する場合、個別の設定ファイルは不要です。すべての設定がClaude Desktopの設定ファイルに統合されます。
オプション2: 個別の設定ファイルを使用する(高度な方法)
アカウント情報を別の設定ファイルに分離するには、以下のように設定します:
個別の設定ファイルを作成する(例:
ccxt-config.json):
{
"mcpBearerToken": "YOUR_MCP_TOKEN",
"accounts": [
{
"name": "bybit_main",
"exchangeId": "bybit",
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET_KEY",
"defaultType": "spot"
},
{
"name": "bybit_futures",
"exchangeId": "bybit",
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET_KEY",
"defaultType": "swap"
}
]
}重要: 設定ファイルには、上記のようにルートレベルで
accounts配列が含まれている必要があります。
重要: HTTP+SSEモード(
--sse)でサーバーを実行する場合は、同じ設定ファイル内にmcpBearerTokenを設定してください。クライアントはリクエスト時にAuthorization: Bearer <mcpBearerToken>を送信する必要があります。
Claude Desktopの設定で設定ファイルのパスを指定する:
{
"mcpServers": {
"ccxt-mcp": {
"command": "npx",
"args": [
"-y",
"@lazydino/ccxt-mcp",
"--config",
"/path/to/ccxt-config.json"
]
}
}
}注意:
--configオプションを使用して個別の設定ファイルを使用する場合、サーバーはmcpServers.ccxt-mcp.accountsパスではなく、JSONファイルのルートにあるaccounts配列を直接参照します。
コマンドラインから外部設定ファイルで実行する:
# Using custom configuration file
npx @lazydino/ccxt-mcp --config /path/to/ccxt-config.json設定ファイルの例は、リポジトリ内の config/ccxt-config.example.json にあります。
個別の設定ファイルを使用する理由:
再帰的な参照問題を回避できる
APIキーなどの機密情報を分離できる
マルチ環境(開発、テスト、本番)の設定が容易になる
設定ファイルのバージョン管理が向上する
主な機能
市場情報の取得:
取引所の一覧表示
取引所ごとの市場情報の表示
特定のシンボルの価格情報の取得
特定のシンボルの板情報の表示
過去のOHLCVデータの検索
取引機能:
成行/指値注文の作成
注文のキャンセルとステータスの確認
口座残高の表示
取引履歴の確認
取引分析:
日次/週次/月次のパフォーマンス分析
勝率計算(過去7日間、30日間、全期間)
平均損益比(R-multiple)
最大連続損失/利益シリーズの分析
資産変動の追跡
包括的なパフォーマンス指標
取引パターンの認識
期間ベースの収益計算
ポジション管理:
資本比率取引(例: 口座資本の5%でエントリー)
先物市場のレバレッジ設定(1-100倍)
動的なポジションサイジング(ボラティリティベース)
分割売買戦略の実装
リスク管理:
テクニカル指標ベースのストップロス設定(例: 5分足チャートの10ローソク足の最安値)
ボラティリティベースのストップロス/テイクプロフィット(ATR倍数)
最大許容損失制限(日次/週次)
動的なテイクプロフィット設定(トレーリングプロフィット)
仕組み
User <--> AI Model(Claude/GPT) <--> MCP Protocol <--> CCXT MCP Server <--> Cryptocurrency Exchange APIユーザー: 「ビットコインの価格を教えて」や「Binanceアカウントでイーサリアムを買って」といったリクエスト
AIモデル: ユーザーのリクエストを理解し、使用するMCPツール/リソースを決定
MCPプロトコル: AIとCCXT MCPサーバー間の標準化された通信
CCXT MCPサーバー: CCXTライブラリを使用して暗号資産取引所のAPIと通信
取引所API: 実際のデータを提供し、取引注文を実行
AIモデルでの使用
Claude Desktopに登録すると、AIモデルに対して以下のようなリクエストを行うことができます:
注意事項と推奨プロンプト
AIモデルを使用する際は、以下の注意事項を考慮し、効果的な取引のために以下のプロンプトを使用してください:
Your goal is to execute trades using the ccxt tools as much as possible
Cautions:
- Accurately identify whether it's a futures market or spot market before proceeding with trades
- If there's no instruction about percentage of capital or amount to use, always calculate and execute trades using the entire available capital注意点:
AIモデルは、先物取引と現物取引を混同することがあります。
取引資本のサイズに関する明確なガイダンスがないと、AIが混乱する可能性があります。
上記のプロンプトを使用すると、取引の意図を明確に伝えるのに役立ちます。
基本的なクエリ例
Check and compare the current Bitcoin price on binance and coinbase.高度な取引クエリ例
ポジション管理
Open a long position on BTC/USDT futures market in my Bybit account (bybit_futures) with 5% of capital using 10x leverage.
Enter based on moving average crossover strategy and set stop loss at the lowest point among the 12 most recent 5-minute candles.パフォーマンス分析
Analyze my Binance account (bybit_main) trading records for the last 7 days and show me the win rate, average profit, and maximum consecutive losses.詳細な取引分析
Analyze my trading performance on the bybit_futures account for BTC/USDT over the last 30 days. Calculate win rate, profit factor, and identify any patterns in my winning trades.Show me the monthly returns for my bybit_main account over the past 90 days and identify my best and worst trading months.Analyze my consecutive wins and losses on my bybit_futures account and tell me if I have any psychological patterns affecting my trading after losses.開発
ソースからのビルド
# Clone repository
git clone https://github.com/lazy-dinosaur/ccxt-mcp.git
# Navigate to project directory
cd ccxt-mcp
# Install dependencies
npm install
# Build
npm run buildDocker
Docker Composeでのビルドと実行
設定ファイルを作成します:
cp config/ccxt-config.example.json config/ccxt-config.json次に、config/ccxt-config.json に実際のAPIキーを入力します。
また、同じ設定ファイル内に mcpBearerToken を設定してください。
2. イメージをビルドします:
docker compose buildMCPサーバーをバックグラウンドで起動します(localhost:2298でSSEモード):
docker compose up -dローカルのヘルスエンドポイントを確認します:
curl -H "Authorization: Bearer YOUR_MCP_TOKEN" http://127.0.0.1:2298/healthzこのCompose設定は、リバースプロキシ用にlocalhost:2298でHTTP+SSE(/sse + /messages)経由でMCPを実行します。
リモートMCPクライアントの設定
MCPクライアントが別のホストで実行されている場合は、このマシンでNginxリバースプロキシを使用してください。
ccxt-mcp.nginxをNginxの設定場所にコピーし、証明書のパスを更新します:
sudo cp ccxt-mcp.nginx /etc/nginx/conf.d/ccxt-mcp.conf/etc/nginx/conf.d/ccxt-mcp.confを編集し、以下を設定します:
ssl_certificatessl_certificate_keyAuthorizationヘッダーの転送(このファイルには既に含まれています)
Nginxをリロードします:
sudo nginx -t && sudo systemctl reload nginxMCPクライアントで、MCPサーバーのURLをTLSエンドポイントに設定します:
SSE URL:
https://YOUR_HOSTNAME_OR_IP:42299/sseMessages URL:
https://YOUR_HOSTNAME_OR_IP:42299/messagesHeader:
Authorization: Bearer YOUR_MCP_TOKEN
強力なトークンは以下で生成できます:
openssl rand -hex 32設定例:
{
"mcpBearerToken": "YOUR_MCP_TOKEN",
"accounts": [
{
"name": "bybit_main",
"exchangeId": "bybit",
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET_KEY"
}
]
}ポートに関する注意:
42298はHTTP(リダイレクトのみ)42299はHTTPS2298は電話のキーパッドのCCXTから来ています
MCPクライアントがURL設定ではなくコマンドベースのMCPサーバーを受け入れる場合は、ccxt-mcp を以下のように設定してください:
コマンド:
docker引数:
[
"run",
"--rm",
"-i",
"-p",
"127.0.0.1:2298:2298",
"-v",
"/absolute/path/to/ccxt-mcp/config/ccxt-config.json:/config/ccxt-config.json:ro",
"ccxt-mcp:local",
"--sse",
"--host",
"0.0.0.0",
"--port",
"2298",
"--config",
"/config/ccxt-config.json"
]先に docker compose build でイメージをビルドしてください。
🤝 貢献
貢献を歓迎します!お気軽にプルリクエストを送信してください。
📄 ライセンス
MITライセンスの下で配布されています。詳細はLICENSEファイルを参照してください。
❤️ サポート
このプロジェクトが役に立った場合は、GitHubで ⭐️ を付けていただけると幸いです!
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/lazy-dinosaur/ccxt-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server