Bybit Crypto Exchange MCP server

Provides read-only access to Bybit's cryptocurrency exchange API for retrieving real-time market data, order book information, and account details.
Back to servers
Provider
Sam McLeod
Release date
Dec 26, 2024
Language
TypeScript
Stats
10 stars

This MCP server provides read-only access to Bybit's cryptocurrency exchange API through the Model Context Protocol (MCP) interface. It allows you to retrieve real-time market data, account information, and perform technical analysis on cryptocurrency trading pairs.

Installation

Prerequisites

  • Node.js (v22+)
  • pnpm (npm i -g pnpm)
  • Bybit API credentials (read-only keys recommended)

Setup

  1. Install dependencies:
pnpm i
  1. Create a configuration file by copying the example:
cp .env.example .env
  1. Edit the .env file with your Bybit API credentials:
BYBIT_API_KEY=your-api-key-here
BYBIT_API_SECRET=your-api-secret-here
BYBIT_USE_TESTNET=false
DEBUG=false

Starting the Server

Using Standard I/O (Default)

pnpm serve

Using HTTP/SSE Transport

pnpm start:http

This starts an HTTP server on port 8080 that supports both modern Streamable HTTP and legacy SSE transports.

Using with Ollama

If you want to use the server with Ollama:

  1. Install the client packages:
(cd client && pnpm i)
  1. Configure the client:
cp client/.env.example client/.env
  1. Edit the client .env file:
OLLAMA_HOST=http://localhost:11434
DEFAULT_MODEL=qwen3-30b-a3b-ud-nothink-128k:q4_k_xl
  1. Start both the client and server:
pnpm start

Integrating with MCP Clients

Claude Desktop

Add the following to ~/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"
      }
    }
  }
}

gomcp

Add the following to ~/.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

Available Tools

get_ticker

Retrieves real-time ticker information for a trading pair.

{
  "name": "get_ticker",
  "arguments": {
    "symbol": "BTCUSDT",
    "category": "spot"
  }
}

get_orderbook

Retrieves market depth data for a trading pair.

{
  "name": "get_orderbook",
  "arguments": {
    "symbol": "BTCUSDT",
    "category": "spot",
    "limit": 25
  }
}

get_kline

Retrieves candlestick data for a trading pair.

{
  "name": "get_kline",
  "arguments": {
    "symbol": "BTCUSDT",
    "category": "spot",
    "interval": "1",
    "limit": 200
  }
}

get_market_info

Retrieves detailed market information for trading pairs.

{
  "name": "get_market_info",
  "arguments": {
    "category": "spot",
    "symbol": "BTCUSDT",
    "limit": 200
  }
}

get_trades

Retrieves recent trades for a trading pair.

{
  "name": "get_trades",
  "arguments": {
    "symbol": "BTCUSDT",
    "category": "spot",
    "limit": 200
  }
}

get_instrument_info

Retrieves detailed instrument information for a specific trading pair.

{
  "name": "get_instrument_info",
  "arguments": {
    "symbol": "BTCUSDT",
    "category": "spot"
  }
}

get_wallet_balance

Retrieves wallet balance information for the authenticated user.

{
  "name": "get_wallet_balance",
  "arguments": {
    "accountType": "UNIFIED",
    "coin": "BTC"
  }
}

get_positions

Retrieves current positions information for the authenticated user.

{
  "name": "get_positions",
  "arguments": {
    "category": "linear",
    "symbol": "BTCUSDT",
    "limit": 200
  }
}

get_order_history

Retrieves order history for the authenticated user.

{
  "name": "get_order_history",
  "arguments": {
    "category": "spot",
    "symbol": "BTCUSDT",
    "limit": 200
  }
}

Supported Categories

  • spot: Spot trading
  • linear: Linear perpetual contracts
  • inverse: Inverse perpetual contracts

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later