Skip to main content
Glama
Bybit MCP Server

Bybit MCP Server

by sammcj

Bybit MCP Server

Ein Model Context Protocol (MCP) -Server, der schreibgeschützten Zugriff auf die Kryptowährungsaustausch-API von Bybit bietet.

DIES IST SOFTWARE IN ALPHA-QUALITÄT – DIE VERWENDUNG ERFOLGT AUF EIGENES RISIKO!

Verwenden Sie für diesen Server ausschließlich einen schreibgeschützten API-Schlüssel. Ich würde meinem Code Ihr „Geld“ nicht anvertrauen, und Sie sollten das auch nicht tun!

Merkmale

Dieser MCP-Server bietet die folgenden Tools für die Interaktion mit der API von Bybit:

  • get_ticker : Holen Sie sich Echtzeit-Tickerinformationen für ein Handelspaar

  • get_orderbook : Orderbuchdaten (Markttiefe) für ein Handelspaar abrufen

  • get_kline : Holen Sie sich Kline-/Candlestick-Daten für ein Handelspaar

  • get_market_info : Erhalten Sie detaillierte Marktinformationen für Handelspaare

  • get_trades : Aktuelle Trades für ein Handelspaar abrufen

  • get_instrument_info : Erhalten Sie detaillierte Instrumenteninformationen für ein bestimmtes Handelspaar

  • get_wallet_balance : Ruft Informationen zum Wallet-Guthaben des authentifizierten Benutzers ab

  • get_positions : Aktuelle Positionsinformationen für den authentifizierten Benutzer abrufen

  • get_order_history : Bestellverlauf für den authentifizierten Benutzer abrufen

  • get_ml_rsi : Holen Sie sich den auf maschinellem Lernen basierenden RSI (Relative Strength Index) für ein Handelspaar

  • get_market_structure : Marktstrukturinformationen für ein Handelspaar abrufen

  • get_order_blocks : Erkennen institutioneller Auftragsakkumulationszonen

  • get_order_history : Bestellverlauf für den authentifizierten Benutzer abrufen

  • get_orderbook : Orderbuchdaten (Markttiefe) für ein Handelspaar abrufen

  • get_ticker : Holen Sie sich Echtzeit-Tickerinformationen für ein Handelspaar

Es gibt auch eine hochgradig experimentelle WebUI. Weitere Informationen finden Sie in der README-Datei zur WebUI .

WebUI-Screenshot

Während ich dieses Projekt weiterentwickle, kann es am gesamten Code zu gravierenden Änderungen und der Hinzufügung bzw. Entfernung von Funktionen kommen.

Related MCP server: Binance MCP Server

Voraussetzungen & Installation

  1. Node.js (v22+)

  2. pnpm ( npm i -g pnpm )

  3. Wenn Sie den Ollama-Client wie in der Schnellstartanleitung unten gezeigt ausführen möchten, müssen Sie Ollama sowie das Modell Ihrer Wahl installiert und ausgeführt haben.

pnpm i

Schnellstart

Um Pakete zu installieren, erstellen Sie alles und starten Sie den interaktiven Client:

pnpm i

Kopieren Sie die Datei .env.example nach .env und geben Sie Ihre Daten ein.

cp .env.example .env
code .env

MCP-Server (nur)

Stdio-Transport (Standard)

pnpm serve

HTTP/SSE-Transport

pnpm start:http

Der HTTP-Server läuft standardmäßig auf Port 8080 und bietet sowohl modernes streambares HTTP als auch ältere SSE-Transporte. Dadurch ist er mit Webanwendungen und verschiedenen MCP-Clients kompatibel. Detaillierte Informationen finden Sie in der HTTP-Serverdokumentation .

MCP-Server und Ollama-Client

Installieren Sie die erforderlichen Clientpakete:

(cd client && pnpm i)

Kopieren Sie die Client-Datei .env.example nach .env und geben Sie Ihre Daten ein.

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

So starten Sie Client und Server mit einem Befehl:

pnpm start

Konfiguration

Umgebungsvariablen

Der Server erfordert, dass die Bybit-API-Anmeldeinformationen als Umgebungsvariablen festgelegt werden:

  • BYBIT_API_KEY : Ihr Bybit-API-Schlüssel (erforderlich)

  • BYBIT_API_SECRET : Ihr Bybit-API-Geheimnis (erforderlich) – WICHTIG – Erstellen Sie immer nur einen schreibgeschützten API-Schlüssel!

  • BYBIT_USE_TESTNET : Auf „true“ setzen, um Testnet statt Mainnet zu verwenden (optional, standardmäßig auf „false“ gesetzt)

  • DEBUG : Auf „true“ setzen, um die Debug-Protokollierung zu aktivieren (optional, standardmäßig „false“)

Client-Umgebungsvariablen (./client/.env):

  • OLLAMA_HOST : Der Host des Ollama-Servers (standardmäßig http://localhost:11434 )

  • DEFAULT_MODEL : Das für den Chat zu verwendende Standardmodell (standardmäßig qwen3-30b-a3b-ud-nothink-128k:q4_k_xl)

MCP-Einstellungskonfiguration

Um diesen Server mit MCP-Clients zu verwenden, müssen Sie ihn zu Ihrer MCP-Konfigurationsdatei hinzufügen. Der Speicherort der Datei hängt von Ihrem Client ab:

MCP-Beispiel - Claude Desktop

Speicherort: ~/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-Beispiel – gomcp

Speicherort: ~/.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

Client-Integration

Dieses Paket enthält einen TypeScript-Client, der eine Kommandozeilenschnittstelle für die Interaktion mit Ollama-LLMs und dem bybit-mcp-Server bereitstellt. Der Client unterstützt:

  • Interaktiver Chat mit Ollama-Modellen

  • Direkter Zugriff auf alle bybit-mcp-Handelstools

  • Automatische Serververwaltung

  • Umgebungsbasierte Konfiguration

  • Debug-Protokollierung

Eine ausführliche Client-Dokumentation finden Sie in der README-Datei des Clients .

Ausführen des Servers

Produktion

  1. Erstellen Sie den Server:

pnpm build
  1. Führen Sie den Server aus:

node build/index.js

Entwicklung

Für die Entwicklung mit automatischer TypeScript-Neukompilierung:

pnpm watch

So überprüfen Sie den MCP-Server während der Entwicklung:

pnpm inspector

Tool-Dokumentation

Tickerinformationen abrufen

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

Orderbuchdaten abrufen

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

Kline/Candlestick-Daten abrufen

{
  "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)
  }
}

Marktinformationen erhalten

{
  "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)
  }
}

Aktuelle Trades abrufen

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

Instrumenteninformationen abrufen

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

Gibt detaillierte Informationen zu einem Handelsinstrument zurück, darunter:

  • Basis- und Notierungswährungen

  • Handelsstatus

  • Losgrößenfilter (Mindest-/Maximalbestellmengen)

  • Preisfilter (Tickgröße)

  • Hebeleinstellungen (für Futures)

  • Vertragsdetails (für Futures)

Wallet-Guthaben abrufen

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

Positionen abrufen

{
  "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
  }
}

Bestellverlauf abrufen

{
  "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
  }
}

Unterstützte Kategorien

  • spot : Spothandel

  • linear : Lineare unbefristete Verträge

  • inverse : Inverse unbefristete Verträge

Lizenz

MIT

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
    ResponsivenessOutdated data

    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
      25 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
      -