Skip to main content
Glama
Bybit MCP Server

Bybit MCP Server

by sammcj

Servidor MCP de Bybit

Un servidor de Protocolo de Contexto de Modelo (MCP) que proporciona acceso de solo lectura a la API de intercambio de criptomonedas de Bybit.

ESTE ES UN SOFTWARE DE CALIDAD ALPHA. ¡ÚSELO BAJO SU PROPIA RESPONSABILIDAD!

Use solo una clave API de solo lectura con este servidor. No confiaría mi código a su "dinero" y usted tampoco debería hacerlo.

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.

Características

Este servidor MCP proporciona las siguientes herramientas para interactuar con la API de Bybit:

  • get_ticker : Obtenga información del ticker en tiempo real para un par comercial

  • get_orderbook : Obtener datos del libro de órdenes (profundidad del mercado) para un par comercial

  • get_kline : obtiene datos de líneas k/velas para un par comercial

  • get_market_info : Obtenga información detallada del mercado para los pares comerciales

  • get_trades : Obtener transacciones recientes para un par comercial

  • get_instrument_info : Obtenga información detallada del instrumento para un par comercial específico

  • get_wallet_balance : Obtener información del saldo de la billetera del usuario autenticado

  • get_positions : Obtener información de las posiciones actuales del usuario autenticado

  • get_order_history : Obtener el historial de pedidos del usuario autenticado

Related MCP server: Binance MCP Server

Requisitos e instalación

  1. Node.js (versión 20+)

  2. pnpm ( npm i -g pnpm )

  3. Si desea ejecutar el cliente Ollama como se muestra en el inicio rápido a continuación, necesitará tener Ollama instalado y en ejecución, así como también el modelo de su elección.

pnpm i

Inicio rápido

Para instalar paquetes, compile todo e inicie el cliente interactivo:

pnpm i

Copie el archivo .env.example a .env y complete sus datos.

cp .env.example .env
code .env

Servidor MCP (solamente)

pnpm serve

Servidor MCP y cliente Ollama

Instalar los paquetes de cliente necesarios:

(cd client && pnpm i)

Copie el archivo .env.example del cliente a .env y complete sus datos.

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

Luego, para iniciar el cliente y el servidor con un solo comando:

pnpm start

Configuración

Variables de entorno

El servidor requiere que las credenciales de la API de Bybit se configuren como variables de entorno:

  • BYBIT_API_KEY : Su clave API de Bybit (obligatoria)

  • BYBIT_API_SECRET : Su secreto de API de Bybit (obligatorio) - IMPORTANTE: ¡Cree solo una clave API de solo lectura!

  • BYBIT_USE_TESTNET : Establézcalo en "verdadero" para usar la red de prueba en lugar de la red principal (opcional, el valor predeterminado es falso)

  • DEBUG : Establezca en "verdadero" para habilitar el registro de depuración (opcional, el valor predeterminado es falso)

Variables de entorno del cliente (./client/.env):

  • OLLAMA_HOST : El host del servidor Ollama (predeterminado en http://localhost:11434 )

  • DEFAULT_MODEL : El modelo predeterminado que se utilizará para el chat (el valor predeterminado es llama-3.2-11b-instruct:Q8_0)

Configuración de ajustes de MCP

Para usar este servidor con clientes MCP, debe agregarlo a su archivo de configuración de MCP. La ubicación del archivo depende del cliente:

Ejemplo de MCP - Claude Desktop

Ubicación: ~/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"
      }
    }
  }
}

Ejemplo de MCP - gomcp

Ubicación: ~/.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

Integración de clientes

Este paquete incluye un cliente TypeScript que proporciona una interfaz de línea de comandos para interactuar con los LLM de Ollama y el servidor bybit-mcp. El cliente admite:

  • Chat interactivo con modelos de Ollama

  • Acceso directo a todas las herramientas de trading de bybit-mcp

  • Gestión automática de servidores

  • Configuración basada en el entorno

  • Registro de depuración

Para obtener documentación detallada del cliente, consulte el archivo README del cliente .

Ejecución del servidor

Producción

  1. Construir el servidor:

pnpm build
  1. Ejecutar el servidor:

node build/index.js

Desarrollo

Para el desarrollo con recompilación automática de TypeScript:

pnpm watch

Para inspeccionar el servidor MCP durante el desarrollo:

pnpm inspector

Documentación de herramientas

Obtener información del ticker

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

Obtener datos de la cartera de pedidos

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

Obtener datos de Kline/Candlestick

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

Obtenga información del mercado

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

Obtener operaciones recientes

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

Obtener información del instrumento

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

Devuelve información detallada sobre un instrumento comercial, incluyendo:

  • Monedas base y de cotización

  • Estado comercial

  • Filtros de tamaño de lote (cantidades de pedido mínimas y máximas)

  • Filtros de precios (tamaño del tick)

  • Configuración de apalancamiento (para futuros)

  • Detalles del contrato (para futuros)

Obtener saldo de billetera

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

Obtener posiciones

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

Obtener historial de pedidos

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

Categorías admitidas

  • spot : Comercio al contado

  • linear : Contratos perpetuos lineales

  • inverse : Contratos perpetuos inversos

Licencia

Instituto Tecnológico de Massachusetts (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
      -