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 Server
A Model Context Protocol (MCP) server that provides read-only access to Bybit's cryptocurrency exchange API.
THIS IS ALPHA QUALITY SOFTWARE - USE AT YOUR OWN RISK!
Only ever use a read-only API key with this server. I wouldn't trust my code with your "money" and neither should you!
Features
This MCP server provides the following tools for interacting with Bybit's API:
get_ticker
: Get real-time ticker information for a trading pairget_orderbook
: Get orderbook (market depth) data for a trading pairget_kline
: Get kline/candlestick data for a trading pairget_market_info
: Get detailed market information for trading pairsget_trades
: Get recent trades for a trading pairget_instrument_info
: Get detailed instrument information for a specific trading pairget_wallet_balance
: Get wallet balance information for the authenticated userget_positions
: Get current positions information for the authenticated userget_order_history
: Get order history for the authenticated user
Requirements & Installation
- Node.js (v20+)
- pnpm (
npm i -g pnpm
) - If you want to run the Ollama client as shown in the quick start below, you'll need Ollama installed and running, as well as your model of choice.
Quick Start
To install packages build everything and start the interactive client:
Copy the .env.example file to .env and fill in your details.
MCP-Server (Only)
MCP-Server and Ollama client
Install required client packages:
Copy the client .env.example file to .env and fill in your details.
Then to start the client and server in one command:
Configuration
Environment Variables
The server requires Bybit API credentials to be set as environment variables:
BYBIT_API_KEY
: Your Bybit API key (required)BYBIT_API_SECRET
: Your Bybit API secret (required) - IMPORTANT - Only ever create a read-only API key!BYBIT_USE_TESTNET
: Set to "true" to use testnet instead of mainnet (optional, defaults to false)DEBUG
: Set to "true" to enable debug logging (optional, defaults to false)
Client environment variables (./client/.env):
OLLAMA_HOST
: The host of the Ollama server (defaults to http://localhost:11434)DEFAULT_MODEL
: The default model to use for chat (defaults to llama-3.2-11b-instruct:Q8_0)
MCP Settings Configuration
To use this server with MCP clients, you need to add it to your MCP settings configuration file. The file location depends on your client:
MCP Example - Claude Desktop
Location: ~/Library/Application\ Support/Claude/claude_desktop_config.json
MCP Example - gomcp
Location: ~/.config/gomcp/config.yaml
Client Integration
This package includes a TypeScript client that provides a command-line interface for interacting with both Ollama LLMs and the bybit-mcp server. The client supports:
- Interactive chat with Ollama models
- Direct access to all bybit-mcp trading tools
- Automatic server management
- Environment-based configuration
- Debug logging
For detailed client documentation, see the client README.
Running the Server
Production
- Build the server:
- Run the server:
Development
For development with automatic TypeScript recompilation:
To inspect the MCP server during development:
Tool Documentation
Get Ticker Information
Get Orderbook Data
Get Kline/Candlestick Data
Get Market Information
Get Recent Trades
Get Instrument Information
Returns detailed information about a trading instrument including:
- Base and quote currencies
- Trading status
- Lot size filters (min/max order quantities)
- Price filters (tick size)
- Leverage settings (for futures)
- Contract details (for futures)
Get Wallet Balance
Get Positions
Get Order History
Supported Categories
spot
: Spot tradinglinear
: Linear perpetual contractsinverse
: Inverse perpetual contracts
License
MIT
You must be authenticated.
A Model Context Protocol server that provides read-only access to Bybit's cryptocurrency exchange API, allowing users to query real-time cryptocurrency data using natural language.
- Features
- Requirements & Installation
- Quick Start
- Configuration
- Client Integration
- Running the Server
- Tool Documentation
- Supported Categories
- License