CCXT MCP Server

by jcwleo
MIT License
2
  • Linux
  • Apple

Integrations

  • Allows interaction with cryptocurrency exchanges like Binance, providing tools for fetching balances, market data, creating and canceling orders, managing positions, setting leverage, and handling withdrawals.

CCXT MCP サーバー

このプロジェクトは、 CCXTライブラリのさまざまな関数を大規模言語モデル (LLM) のツールとして公開するモデル コンテキスト プロトコル (MCP) サーバーを提供します。

これにより、LLM は、残高や市場データの取得、注文の作成などのタスクについて、標準化された非同期方式で暗号通貨取引所と対話できるようになります。

このサーバーはFastMCPを使用して構築されており、Python で MCP サーバーを作成するプロセスが簡素化されます。

特徴

  • CCXT 統合: 交換相互作用のために共通の CCXT 関数をラップします。
  • 非同期: 効率的な非ブロッキング操作のためにasyncioccxt.async_supportを使用して構築されています。
  • 明確なツール定義: 明確なパラメータの説明と制約のためにtyping.Annotatedpydantic.Fieldを使用し、LLM (および開発者) がツールを理解して使用しやすくなります。
  • 認証処理: プライベート エンドポイントの API キー、シークレット、およびパスフレーズ認証をサポートします。
  • パブリックおよびプライベート ツール: パブリック マーケット データとプライベート アカウント アクションに個別のツールを提供します。

インストール

  1. リポジトリのクローンを作成します (まだ作成していない場合)。
    git clone <your-repo-url> # Replace with your repository URL cd ccxt-mcp-server
  2. 仮想環境を作成してアクティブ化します (推奨):
    python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
  3. **依存関係をインストールします。**必要なライブラリはrequirements.txtに記載されています。pip またはuv``pip使用してインストールできます。
    • pipを使用する:
      pip install -r requirements.txt
    • uvを使用する (インストールされている場合):
      uv pip install -r requirements.txt # Or, if you prefer uv's environment management: # uv sync

サーバーの実行

依存関係がインストールされると、MCP サーバーを直接実行できます。

python mcp_server.py

次のような、サーバーが起動したことを示す出力が表示されます。

Starting CCXT MCP Server (Async with Annotated Params and Tool Metadata)... # ... (FastMCP server startup logs)

その後、MCP クライアントはサーバーに接続できるようになります (通常は、別途設定されていない限り、FastMCP によって管理されるデフォルトのポートで接続されます)。

利用可能なMCPツール

このサーバーは、API 認証が必要かどうかによって分類された次のツールを公開します。

API認証を必要とするツール(非公開)

  • fetch_account_balance : 現在の口座残高を取得します。
  • fetch_deposit_address : 通貨の入金アドレスを取得します。
  • withdraw_cryptocurrency : 指定されたアドレスに暗号通貨を引き出します。
  • fetch_open_positions : オープンポジションを取得します(主に先物/デリバティブ)。
  • set_trading_leverage : 取引シンボルのレバレッジを設定します (主に先物)。
  • create_spot_limit_order : 新しいスポット指値注文を配置します。
  • create_spot_market_order : 新しいスポット市場注文を配置します。
  • create_futures_limit_order : 新しい先物指値注文を配置します。
  • create_futures_market_order : 新しい先物市場注文を配置します。
  • cancel_order : 既存のオープン注文をキャンセルします。
  • fetch_order_history : 注文の履歴(オープン/クローズ)を取得します。
  • fetch_my_trade_history : ユーザーが実行した取引の履歴を取得します。

公開データ用ツール(認証不要)

  • fetch_ohlcv : 過去の OHLCV (ローソク足) データを取得します。
  • fetch_funding_rate : 永久先物契約の資金調達率を取得します。
  • fetch_long_short_ratio : ロング/ショート比率を取得します (取引所固有のparamsが必要です)。
  • fetch_option_contract_data : オプション契約の市場データを取得します。
  • fetch_market_ticker : シンボルの最新の価格ティッカーデータを取得します。
  • fetch_public_market_trades : シンボルの最近の公開取引を取得します。

各ツールには、 Annotatedpydantic.Fieldの使用により、MCP プロトコル自体を介して利用できる詳細なパラメータの説明があります。

使用上の注意

  • 先物/オプション: 先物またはオプションに関連するツール (例: fetch_open_positionscreate_futures_limit_orderfetch_funding_rate ) を使用する場合は、 params引数を介して CCXT クライアントを正しく構成し、取引所で必要な場合、または目的の市場タイプがデフォルトで設定されていない場合は、具体的には{'options': {'defaultType': 'future'}} (または必要に応じて'swap''option' ) を渡します。
  • fetch_long_short_ratio : これはCCXT標準の統合メソッドではありません。params引数内に特定の取引所メソッド名とそのparamsを指定する必要があります(例:Binance先物の場合、 params={'method_name': 'fapiPublicGetGlobalLongShortAccountRatio', 'method_params': {'symbol': 'BTCUSDT', 'period': '5m'}} )。
  • エラー処理: CCXT 呼び出し中に問題が発生した場合、ツールは"error"キーを含む辞書を返します。
-
security - not tested
A
license - permissive license
-
quality - not tested

LLM が CCXT を介して暗号通貨取引所と対話できるようにし、残高や市場データの取得、注文の作成、取引操作などのタスクを標準化された方法で実行できるようにするモデル コンテキスト プロトコル サーバー。

  1. 特徴
    1. インストール
      1. サーバーの実行
        1. 利用可能なMCPツール
          1. API認証を必要とするツール(非公開)
          2. 公開データ用ツール(認証不要)
        2. 使用上の注意

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.
            Last updated -
            31
            323
            2
            TypeScript
            MIT License
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that enables LLMs to access Binance Smart Chain data, perform blockchain queries, and create Four.meme tokens.
            Last updated -
            TypeScript
            • Linux
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.
            Last updated -
            Python
            MIT License
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that exposes Binance cryptocurrency exchange data to LLMs, allowing agents to access real-time prices, order books, and historical market data without requiring API keys.
            Last updated -
            4
            Python
            MIT License

          View all related MCP servers

          ID: tnuvm84aij