home / mcp / bybit mcp server

Bybit MCP Server

Provides full Bybit v5 data, trading, positions, and account management via MCP.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bcusack-bybit-py-mcp": {
      "command": "uvx",
      "args": [
        "bybit-mcp"
      ],
      "env": {
        "BYBIT_API_KEY": "abcd1234efgh5678",
        "BYBIT_TESTNET": "true",
        "BYBIT_API_SECRET": "secret1234abcd5678",
        "BYBIT_TRADING_ENABLED": "true"
      }
    }
  }
}

You can use this MCP server to access Bybit v5 data and trading capabilities through a single, consistent interface. It exposes market data, trading operations, positions, and account management so your AI assistants or clients can query information or place trades safely and with validation.

How to use

Connect to the Bybit MCP Server from any MCP-compatible client. You will be able to request real-time market data, fetch instrument details, and, when trading is enabled, place and manage orders, view positions, and monitor account information. Start with market data to explore what the server can return, then enable trading only after you’ve tested thoroughly in a safe environment.

How to install

Prerequisites: ensure Python 3.13+ and uv (or uvx) are available on your system.

Install and run using uvx (no local installation required) to try the MCP server quickly.

Additional configuration and usage notes

Safety: trading operations are disabled by default. You must explicitly enable trading by setting BYBIT_TRADING_ENABLED to true in your environment. Test on the Bybit testnet first (BYBIT_TESTNET=true) to avoid real funds.

Environment variables you may configure include BYBIT_API_KEY, BYBIT_API_SECRET, BYBIT_TESTNET, and BYBIT_TRADING_ENABLED. Use BYBIT_TESTNET=true for safe testing, and BYBIT_TRADING_ENABLED=false until you are ready to enable live trading.

Install and run options (examples)

You can run the MCP server through several approaches. Choose the one that matches your workflow.

# Easiest: run directly from PyPI without cloning
uvx bybit-mcp

# Local development: clone, install, then run
git clone <repository-url>
cd bybit-mcp
uv sync

# Copy and customize environment variables as needed
# BYBIT_API_KEY, BYBIT_API_SECRET, BYBIT_TESTNET, BYBIT_TRADING_ENABLED

Configuration and safety considerations

Trading-enabled tools are shown only when BYBIT_TRADING_ENABLED=true. Market data tools remain available regardless of this setting.

Testnet support is recommended for development. Use BYBIT_TESTNET=true to point requests at Bybit's test environment.

Ensure your Bybit API key has the appropriate permissions: Read-only for market data; Trade for orders; Position for position management.

Troubleshooting

If you encounter issues, verify environment variables are passed correctly to the runtime. For Docker usage, use the -e flags to set BYBIT_API_KEY, BYBIT_API_SECRET, BYBIT_TESTNET, and BYBIT_TRADING_ENABLED.

If you see validation or type errors, the server automatically normalizes common API inconsistencies and provides detailed error messages to guide fixes.

Tools and endpoints overview

The server provides an extensive set of endpoints to access market data, execute trades, manage positions, and obtain account information. Each tool includes parameter schemas to help you construct valid requests and receive predictable responses.

Available tools

get_server_time

Retrieve the current Bybit server time.

get_tickers

Fetch ticker information for specified symbols.

get_order_book

Obtain the order book depth for a symbol.

get_recent_trades

Show recent trade history.

get_kline

Get standard OHLCV candlestick data.

get_mark_price_kline

Retrieve mark price historical data.

get_instruments_info

Get trading instrument details.

get_funding_rate_history

Access historical funding rates.

get_open_interest

Get open interest statistics.

get_insurance

Get insurance fund data.

get_risk_limit

Obtain risk limit information.

get_long_short_ratio

Fetch long/short ratio data.

place_order

Place standard market or limit orders.

place_trigger_order

Place conditional/trigger orders with stop/trigger logic.

amend_order

Amend an existing pending order.

cancel_order

Cancel a specific pending order.

cancel_all_orders

Cancel all open orders.

batch_place_order

Place multiple orders in a single request.

batch_amend_order

Amend multiple orders at once.

batch_cancel_order

Cancel multiple orders at once.

get_open_closed_orders

Retrieve open and closed orders.

get_order_history

Fetch order history.

get_trade_history

Get trade execution history.

get_wallet_balance

Get comprehensive wallet balance information.

get_single_coin_balance

Get balance for a specific coin.

get_account_info

Get detailed account information and settings.

get_position_info

Query real-time position data.

get_closed_pnl

Get closed profit and loss records.

set_leverage

Set position leverage.

switch_cross_isolated_margin

Switch between cross and isolated margin.

switch_position_mode

Switch between one-way and hedge position modes.

set_auto_add_margin

Configure automatic margin addition.

set_trading_stop

Set take profit, stop loss, and trailing stops.