Bybit MCP Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides integration with Ollama's LLM server, allowing interactive chat with Ollama models while using the Bybit tools to access cryptocurrency data.

Bybit MCP サーバー

Bybit の暗号通貨取引 API への読み取り専用アクセスを提供するモデル コンテキスト プロトコル (MCP)サーバー。

これはアルファ品質のソフトウェアです - 自己責任で使用してください。

このサーバーでは読み取り専用のAPIキーのみを使用してください。私のコードをあなたの「お金」に預けることは絶対にありませんし、あなたもそうすべきではありません!

Started integrated server Chatting with llama-3.2-11b-instruct:Q8_0 (Ctrl+C to exit) Tools are available - ask about cryptocurrency data! You: Whats the current spot price for USDT/BTC? Assistant: <tool>get_ticker</tool> <arguments> { "category": "spot", "symbol": "BTCUSDT" } </arguments> Tool result: { "timestamp": "2024-12-14T12:32:30.628Z", "meta": { "requestId": "ad5177bc-93d1-49ed-80a1-dd95b3ec970b" }, "symbol": "BTCUSDT", "category": "spot", "lastPrice": "101368.71", "price24hPcnt": "0.0107", "highPrice24h": "102661.3", "lowPrice24h": "99683.96", "prevPrice24h": "100292.67", "volume24h": "22543.911683", "turnover24h": "2285318788.68303381", "bid1Price": "101366.07", "bid1Size": "0.136049", "ask1Price": "101366.08", "ask1Size": "0.648039", "usdIndexPrice": "101365.707576" } Processing result... The current spot price for USDT/BTC is $101,368.71.

特徴

この MCP サーバーは、Bybit の API と対話するための次のツールを提供します。

  • get_ticker : 取引ペアのリアルタイムのティッカー情報を取得する
  • get_orderbook : 取引ペアの注文簿(市場の深さ)データを取得する
  • get_kline : 取引ペアのkline/ローソク足データを取得する
  • get_market_info : 取引ペアの詳細な市場情報を取得する
  • get_trades : 取引ペアの最近の取引を取得する
  • get_instrument_info : 特定の取引ペアの詳細な商品情報を取得する
  • get_wallet_balance : 認証されたユーザーのウォレット残高情報を取得する
  • get_positions : 認証されたユーザーの現在の位置情報を取得する
  • get_order_history : 認証されたユーザーの注文履歴を取得する

要件とインストール

  1. Node.js (v20+)
  2. pnpm ( npm i -g pnpm )
  3. 以下のクイック スタートに示すように Ollama クライアントを実行する場合は、選択したモデルに加えて、Ollama がインストールされ、実行されている必要があります。
pnpm i

クイックスタート

パッケージをインストールするには、すべてをビルドし、対話型クライアントを起動します。

pnpm i

.env.example ファイルを .env にコピーし、詳細を入力します。

cp .env.example .env code .env

MCP サーバー (のみ)

pnpm serve

MCPサーバーとOllamaクライアント

必要なクライアント パッケージをインストールします。

(cd client && pnpm i)

クライアントの .env.example ファイルを .env にコピーし、詳細を入力します。

cp client/.env.example client/.env code client/.env

次に、1 つのコマンドでクライアントとサーバーを起動します。

pnpm start

構成

環境変数

サーバーでは、Bybit API 資格情報を環境変数として設定する必要があります。

  • BYBIT_API_KEY : Bybit APIキー(必須)
  • BYBIT_API_SECRET : Bybit API シークレット (必須) -重要 - 読み取り専用の API キーのみを作成してください。
  • BYBIT_USE_TESTNET : メインネットの代わりにテストネットを使用するには「true」に設定します(オプション、デフォルトは false)
  • DEBUG : デバッグログを有効にするには「true」に設定します(オプション、デフォルトは false)

クライアント環境変数 (./client/.env):

  • OLLAMA_HOST : Ollamaサーバーのホスト(デフォルトはhttp://localhost:11434
  • DEFAULT_MODEL : チャットに使用するデフォルトのモデル(デフォルトはllama-3.2-11b-instruct:Q8_0)

MCP設定の構成

このサーバーをMCPクライアントで使用するには、MCP設定ファイルにサーバーを追加する必要があります。ファイルの場所はクライアントによって異なります。

MCPの例 - クロードデスクトップ

場所: ~/Library/Application\ Support/Claude/claude_desktop_config.json

{ "mcpServers": { "bybit": { "command": "node", "args": ["/path/to/bybit-mcp/build/index.js"], "env": { "BYBIT_API_KEY": "your-api-key", "BYBIT_API_SECRET": "your-api-secret", "BYBIT_USE_TESTNET": "false" } } } }

MCPの例 - gomcp

場所: ~/.config/gomcp/config.yaml

mcp_servers: - name: "bybit" command: "cd /path/to/bybit-mcp && pnpm run serve" arguments: [] env: BYBIT_API_KEY: "" # Add your Bybit API **READ ONLY** key here BYBIT_API_SECRET: "" # Add your Bybit API **READ ONLY** secret here BYBIT_USE_TESTNET: "true" # Set to false for production DEBUG: "false" # Optional: Set to true for debug logging

クライアント統合

このパッケージには、Ollama LLMとbybit-mcpサーバーの両方とやり取りするためのコマンドラインインターフェースを提供するTypeScriptクライアントが含まれています。クライアントは以下の機能をサポートしています。

  • Ollamaモデルとのインタラクティブチャット
  • すべてのbybit-mcp取引ツールへの直接アクセス
  • 自動サーバー管理
  • 環境ベースの構成
  • デバッグログ

詳細なクライアントドキュメントについては、クライアントの README を参照してください。

サーバーの実行

生産

  1. サーバーを構築します。
pnpm build
  1. サーバーを実行します。
node build/index.js

発達

TypeScript の自動再コンパイルを使用した開発の場合:

pnpm watch

開発中に MCP サーバーを検査するには:

pnpm inspector

ツールドキュメント

ティッカー情報を取得する

{ "name": "get_ticker", "arguments": { "symbol": "BTCUSDT", "category": "spot" // optional, defaults to "spot" } }

注文簿データを取得する

{ "name": "get_orderbook", "arguments": { "symbol": "BTCUSDT", "category": "spot", // optional, defaults to "spot" "limit": 25 // optional, defaults to 25 (available: 1, 25, 50, 100, 200) } }

クライン/ローソク足データを取得する

{ "name": "get_kline", "arguments": { "symbol": "BTCUSDT", "category": "spot", // optional, defaults to "spot" "interval": "1", // optional, defaults to "1" (available: "1", "3", "5", "15", "30", "60", "120", "240", "360", "720", "D", "M", "W") "limit": 200 // optional, defaults to 200 (max 1000) } }

市場情報を入手する

{ "name": "get_market_info", "arguments": { "category": "spot", // optional, defaults to "spot" "symbol": "BTCUSDT", // optional, if not provided returns info for all symbols in the category "limit": 200 // optional, defaults to 200 (max 1000) } }

最近の取引を取得

{ "name": "get_trades", "arguments": { "symbol": "BTCUSDT", "category": "spot", // optional, defaults to "spot" "limit": 200 // optional, defaults to 200 (max 1000) } }

機器情報を取得する

{ "name": "get_instrument_info", "arguments": { "symbol": "BTCUSDT", // required "category": "spot" // optional, defaults to "spot" } }

次のような取引商品に関する詳細情報を返します:

  • 基準通貨と引用通貨
  • 取引状況
  • ロットサイズフィルター(最小/最大注文数量)
  • 価格フィルター(目盛りサイズ)
  • レバレッジ設定(先物)
  • 契約詳細(先物)

ウォレット残高を取得

{ "name": "get_wallet_balance", "arguments": { "accountType": "UNIFIED", // required (available: "UNIFIED", "CONTRACT", "SPOT") "coin": "BTC" // optional, if not provided returns all coins } }

ポジションを取得

{ "name": "get_positions", "arguments": { "category": "linear", // required (available: "linear", "inverse") "symbol": "BTCUSDT", // optional "baseCoin": "BTC", // optional "settleCoin": "USDT", // optional "limit": 200 // optional, defaults to 200 } }

注文履歴を取得する

{ "name": "get_order_history", "arguments": { "category": "spot", // required (available: "spot", "linear", "inverse") "symbol": "BTCUSDT", // optional "baseCoin": "BTC", // optional "orderId": "1234567890", // optional "orderLinkId": "myCustomId", // optional "orderStatus": "Filled", // optional (available: "Created", "New", "Rejected", "PartiallyFilled", "PartiallyFilledCanceled", "Filled", "Cancelled", "Untriggered", "Triggered", "Deactivated") "orderFilter": "Order", // optional (available: "Order", "StopOrder") "limit": 200 // optional, defaults to 200 } }

サポートされているカテゴリ

  • spot :スポット取引
  • linear :線形永久契約
  • inverse :逆永久契約

ライセンス

マサチューセッツ工科大学

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Bybit の暗号通貨取引 API への読み取り専用アクセスを提供するモデル コンテキスト プロトコル サーバー。これにより、ユーザーは自然言語を使用してリアルタイムの暗号通貨データを照会できます。

  1. Features
    1. Requirements & Installation
      1. Quick Start
        1. MCP-Server (Only)
        2. MCP-Server and Ollama client
      2. Configuration
        1. Environment Variables
        2. MCP Settings Configuration
      3. Client Integration
        1. Running the Server
          1. Production
          2. Development
        2. Tool Documentation
          1. Get Ticker Information
          2. Get Orderbook Data
          3. Get Kline/Candlestick Data
          4. Get Market Information
          5. Get Recent Trades
          6. Get Instrument Information
          7. Get Wallet Balance
          8. Get Positions
          9. Get Order History
        3. Supported Categories
          1. License
            ID: ydqbfrwdg4