Skip to main content
Glama
Bybit MCP Server

Bybit MCP Server

by sammcj

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 : 認証されたユーザーの注文履歴を取得する

Related MCP server: Binance MCP Server

要件とインストール

  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 :逆永久契約

ライセンス

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

Available Tools

12 tools
get_instrument_infoC

Get detailed instrument information for a specific trading pair

Inputs: symbol (required), category.

get_klineC

Get kline/candlestick data for a trading pair. Supports optional reference ID for data verification.

Inputs: symbol (required), category, includeReferenceId, interval, +1 more.

get_market_infoC

Get detailed market information for trading pairs

Inputs: category, limit, symbol.

get_market_structureC

Advanced market structure analysis combining ML-RSI, order blocks, and liquidity zones. Provides comprehensive market regime detection and trading recommendations.

Inputs: category (required), interval (required), symbol (required), analysisDepth, +3 more.

get_ml_rsiB

Get ML-enhanced RSI using K-Nearest Neighbors algorithm for pattern recognition. Provides adaptive overbought/oversold levels and enhanced RSI values based on historical pattern similarity.

Inputs: category (required), interval (required), symbol (required), featureCount, +6 more.

get_order_blocksC

Detect institutional order accumulation zones based on volume analysis. Identifies bullish and bearish order blocks using volume peaks and tracks their mitigation status.

Inputs: category (required), interval (required), symbol (required), bearishBlocks, +4 more.

get_orderbookC

Get orderbook (market depth) data for a trading pair

Inputs: symbol (required), category, limit.

get_order_historyC

Get order history for the authenticated user

Inputs: category (required), baseCoin, limit, orderFilter, +4 more.

get_positionsC

Get positions information for the authenticated user

Inputs: category (required), baseCoin, limit, settleCoin, +1 more.

get_tickerC

Get real-time ticker information for a trading pair. Supports optional reference ID for data verification.

Inputs: symbol (required), category, includeReferenceId.

get_tradesC

Get recent trades for a trading pair

Inputs: symbol (required), category, limit.

get_wallet_balanceC

Get wallet balance information for the authenticated user

Inputs: accountType (required), coin.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 12 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between get_market_info, get_instrument_info, and get_ticker, which all provide market-related data for trading pairs. The descriptions help differentiate them, but an agent might need to carefully choose between these for specific needs.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case, starting with 'get_' followed by a descriptive noun phrase. This uniformity makes the tool set predictable and easy to navigate for an agent.

    Tool Count5/5

    With 12 tools, the count is well-scoped for a trading server, covering market data, analysis, and user account operations. Each tool appears to serve a specific function without redundancy, fitting the domain appropriately.

    Completeness4/5

    The tool set covers key areas like market data retrieval, advanced analysis, and user account management, but lacks tools for executing trades or managing orders, which are core actions in a trading domain. This gap might limit agent workflows for full trading automation.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      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.
      21
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI coding tools like Claude Code and Cursor to interact with Bybit's trading platform for market data retrieval, account management, and trading operations.
      11
      34 npm
      13
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides real-time cryptocurrency price fetching capabilities using the CoinGecko API. It enables LLMs to retrieve and process the latest price for any coin by its name or symbol.
      2
      -