⚠️ TRADING WARNING ⚠️
This MCP server can execute REAL TRADING OPERATIONS on Bybit whenBYBIT_TRADING_ENABLED=true.
Trading operations use REAL MONEY and can result in FINANCIAL LOSSES.
Always test on testnet first (BYBIT_TESTNET=true) and understand the risks before enabling trading.
Trading is DISABLED by default for safety.
A Model Context Protocol (MCP) server that provides access to Bybit's v5 Market API endpoints. This server enables AI assistants to fetch real-time market data, instrument information, and trading statistics from the Bybit cryptocurrency exchange.
BYBIT_TRADING_ENABLED=true)BYBIT_TRADING_ENABLED=true)# Build the Docker image
docker build -t bybit-mcp .
# Run with environment variables
docker run -i --rm \
-e BYBIT_API_KEY=your_api_key \
-e BYBIT_API_SECRET=your_api_secret \
-e BYBIT_TESTNET=false \ # Set to true for testnet
-e BYBIT_TRADING_ENABLED=false \ # Set to true to enable trading
bybit-mcp
# Set environment variables in .env file first
docker-compose up
BYBIT_API_KEY: Your Bybit API keyBYBIT_API_SECRET: Your Bybit API secretBYBIT_TESTNET: Set to true to use the Bybit testnet (default is false)BYBIT_TRADING_ENABLED: Set to true to enable trading operations (default is false)The server implements several safety controls for trading operations:
BYBIT_TRADING_ENABLED=true to enable tradingBYBIT_TESTNET=true to use Bybit's testnet environmentBYBIT_TRADING_ENABLED=trueEnsure your Bybit API key has the appropriate permissions:
Add to your VS Code settings.json:
{
"mcp": {
"servers": {
"bybit-mcp": {
"type": "stdio",
"command": "uv",
"args": ["run","-i", "bybit-mcp"],
"env": {
"BYBIT_API_KEY": "${input:bybit_api_key}",
"BYBIT_API_SECRET": "${input:bybit_api_secret}",
"BYBIT_TESTNET": "false",
"BYBIT_TRADING_ENABLED": "false"
}
}
},
"inputs": [
{
"type": "promptString",
"id": "bybit_api_key",
"description": "Bybit API Key",
"password": true
},
{
"type": "promptString",
"id": "bybit_api_secret",
"description": "Bybit API Secret",
"password": true
},
{
"type": "promptString",
"id": "bybit_testnet",
"description": "Use Bybit Testnet (true/false)",
"default": "false"
},
{
"type": "promptString",
"id": "bybit_trading_enabled",
"description": "Enable Trading Operations (true/false)",
"default": "false"
}
]
}
}
Test the server using the MCP inspector:
npx @modelcontextprotocol/inspector uv run bybit-mcp
uv run pytest tests/
All market data tools are always available and do not require special permissions.
get_server_time: Get current Bybit server timeget_tickers: Get ticker information for symbolsget_order_book: Get order book depthget_recent_trades: Get recent trade historyget_kline: Get standard OHLCV kline dataget_mark_price_kline: Get mark price historical dataget_index_price_kline: Get index price historical dataget_premium_index_price_kline: Get premium index kline dataget_instruments_info: Get trading instrument detailsget_funding_rate_history: Get funding rate historyget_open_interest: Get open interest statisticsget_insurance: Get insurance fund dataget_risk_limit: Get risk limit informationget_long_short_ratio: Get long/short ratio dataBYBIT_TRADING_ENABLED=true)These tools are only available when trading is enabled via the BYBIT_TRADING_ENABLED environment variable.
place_order: Place a new order (Market, Limit, etc.)amend_order: Modify an existing ordercancel_order: Cancel a specific ordercancel_all_orders: Cancel all open ordersbatch_place_order: Place multiple orders in one requestbatch_amend_order: Amend multiple orders in one requestbatch_cancel_order: Cancel multiple orders in one requestget_open_closed_orders: Get open and closed ordersget_order_history: Get order historyget_trade_history: Get trade execution historyBYBIT_TRADING_ENABLED=true)Position management tools require trading to be enabled.
get_position_info: Query real-time position dataget_closed_pnl: Get closed profit and loss recordsset_leverage: Set position leverageswitch_cross_isolated_margin: Switch margin modeswitch_position_mode: Switch between one-way/hedge modeset_auto_add_margin: Configure automatic margin additionset_trading_stop: Set take profit, stop loss, trailing stopsmodify_position_margin: Add or reduce position marginAll tools support the following common parameters where applicable:
category: Product type (linear, inverse, option, spot)symbol: Trading symbol (e.g., BTCUSDT)limit: Data size limit per pagestart/end: Time range for historical dataContent type
Image
Digest
sha256:7e80916e0…
Size
103.2 MB
Last updated
over 1 year ago
docker pull falconiun/bybit-mcp