Bybit Server
This server provides a comprehensive Model Context Protocol (MCP) interface for programmatic trading and interaction with the Bybit cryptocurrency exchange API.
Market Data Retrieval: Fetch real-time order book data, K-line/candlestick charts with various time intervals (1m to monthly), current ticker prices (including volume and metrics), and detailed instrument information for trading pairs.
Trading Operations: Execute market or limit orders for spot and futures trading with support for buy/sell orders, take profit/stop loss settings, leverage configuration, and position indexing for long/short positions. Cancel existing orders by order ID or link ID.
Account Management: Check wallet balances across different account types (UNIFIED, CONTRACT, SPOT), view current open positions for spot and futures trading, and retrieve API key permissions and details.
Order Management: Monitor open orders, access historical order execution records with filtering options, and view comprehensive order details.
Risk Management: Set take profit, stop loss, and trailing stop levels for positions. Configure margin modes (isolated/cross) with custom leverage settings for futures trading.
Supported Trading Categories: Spot trading, linear futures (USDT-margined perpetual contracts), and inverse futures (coin-margined contracts).
Security: Securely access API credentials through environment variables with proper authentication.
Provides a donation option to support the developer of the MCP server through the Buy Me A Coffee platform.
Offers deployment through Docker containers, allowing users to run the Bybit API interface in an isolated environment with proper environment variable configuration.
Provides specific installation and configuration instructions for Linux environments, ensuring the Bybit API interface can run on Linux operating systems.
Includes specific setup instructions for macOS, enabling users to run the Bybit API interface on Apple's operating system.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Bybit Server show me the current BTC/USDT order book"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Bybit API Interface
Bybit MCP (Model Context Protocol) Server. Provides a convenient interface to interact with the Bybit V5 API using MCP tools. Allows fetching market data, managing account information, and placing/canceling orders via API calls wrapped as tools.
⚠️ Security & Safety
This server can place real trades with real money. Read this before configuring it:
Trading is disabled by default. Mutating tools (
place_order,cancel_order,amend_order,cancel_all_orders,set_trading_stop,set_margin_mode,set_leverage) return an error unless you explicitly setTRADING_ENABLED=true.Use the testnet first. Set
TESTNET=truewhile you experiment. Combine withTRADING_ENABLED=falsefor a fully read-only setup, or setREADONLY_MODE=trueto hard-block every mutating tool regardless of other settings.Order size is capped.
MAX_ORDER_SIZE_USDT(default100) limits the estimated notional value of an order to guard against accidental large trades.API keys are never logged or exposed. No tool returns your keys; logs only report whether a key is present.
Never commit your API keys. Provide them through environment variables only.
Related MCP server: Bybit MCP Server
Installation
Requires Python 3.12+. This project uses uv.
git clone https://github.com/dlwjdtn535/mcp-bybit-server.git
cd mcp-bybit-server
uv sync
uv run mcp-bybit-server # runs the MCP server over stdioAfter install, the mcp-bybit-server command is the entry point used by the MCP client configs below.
Installing via Smithery
To install this Bybit API Interface server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @dlwjdtn535/mcp-bybit-server --client claudeConfiguration (Claude Desktop, Cline, Roo Code, etc.)
Add one of the following to your MCP settings file (e.g. claude_desktop_config.json / mcp_settings.json).
Using uv (run from a cloned repo):
{
"mcpServers": {
"bybit": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/mcp-bybit-server",
"mcp-bybit-server"
],
"env": {
"ACCESS_KEY": "YOUR_BYBIT_API_KEY",
"SECRET_KEY": "YOUR_BYBIT_SECRET_KEY",
"TESTNET": "true",
"TRADING_ENABLED": "false"
}
}
}
}On Windows, use an absolute path with double backslashes (e.g. C:\\Users\\YOUR_USERNAME\\mcp-bybit-server).
Using Docker:
First pull the image: docker pull dlwjdtn535/mcp-bybit-server:latest
{
"mcpServers": {
"bybit-server-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--init",
"-e", "ACCESS_KEY=YOUR_BYBIT_API_KEY",
"-e", "SECRET_KEY=YOUR_BYBIT_SECRET_KEY",
"-e", "TESTNET=true",
"-e", "TRADING_ENABLED=false",
"-e", "MAX_ORDER_SIZE_USDT=100",
"dlwjdtn535/mcp-bybit-server:latest"
]
}
}
}Note: Always use
@latestor a specific version tag for both NPX and Docker to ensure you are using the intended version.
Environment Variables
Variable | Required | Default | Description |
| Yes | – | Bybit API key. |
| Yes | – | Bybit API secret. |
| No | – | Bybit member ID (optional). |
| No |
| Use the Bybit testnet when |
| No |
| Must be |
| No |
| When |
| No |
| Caps the estimated notional value (USDT) of a single order. |
| No |
|
|
Tools 🛠️
Market data
get_orderbook— order book (category,symbol,limit?).get_kline— candlesticks (category,symbol,interval,start?,end?,limit?).get_tickers— ticker info (category,symbol).get_public_trade_history— recent public trades (category,symbol,limit?).get_instruments_info— instrument metadata / limits (category,symbol,status?,baseCoin?).get_funding_rate_history— funding rate history for perps (category,symbol,startTime?,endTime?,limit?).get_open_interest— open interest over time (category,symbol,intervalTime?, ...).get_fee_rate— maker/taker fee rates (category,symbol?,baseCoin?).get_server_time— Bybit server time.market_snapshot— composite market view (orderbook + ticker + kline + instrument + recent trades, plus funding rate & open interest for futures) in a single call.
Account
get_wallet_balance— balances (accountType,coin?).get_positions— open positions (category,symbol?).get_order_history— historical orders.get_open_orders— current open orders.get_api_key_information— API key details.
Trading (mutating — requires TRADING_ENABLED=true)
validate_order— pre-flight validation; never places an order. Not blocked by trading flags.place_order— place an order; supportsdry_run=trueto validate without placing.amend_order— modify an existing order in place.cancel_order— cancel a single order.cancel_all_orders— cancel all open orders (optionally scoped).set_trading_stop— set take profit / stop loss / trailing stop.set_margin_mode— set isolated/cross margin.set_leverage— set leverage for a futures symbol.
(Refer to the function docstrings in the code for detailed parameter descriptions and examples.)
API Key Setup
To use this Bybit API interface, create an API key from Bybit:
Log into your Bybit account.
Navigate to API Management.
Create a new API key.
Important security settings:
Enable IP restriction if possible, and add ONLY the IP address(es) the server runs from.
Never share your API keys or expose them in public repositories.
Recommended permissions:
Read (required)
Trade (required only if you enable order execution)
Wallet (required for balance checking)
Development
uv sync --group dev # install dev dependencies (pytest, ruff)
uv run ruff check . # lint
uv run pytest -q # run the unit test suite (no live API calls)CI (GitHub Actions) runs lint + tests on every push/PR; Docker images are built and published automatically on pushes to main.
Sponsorship & Donations
If you find this project helpful and would like to support its development:
Buy Me a Coffee

Referral Program
You can also support this project by signing up for Bybit using our referral link:
Referral Code: J1O4JK
Your support helps maintain and improve this project. Thank you! 🙏
Contact & Support
For additional inquiries or support, please contact:
Email: dlwjdtn5624@naver.com
We welcome your questions and feedback!
License
Available Tools
15 toolscancel_orderC
Cancel order
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
Returns:
Dict: Cancel result
Example:
cancel_order("spot", "BTCUSDT", "123456789")
Reference:
https://bybit-exchange.github.io/docs/v5/order/cancel-order
Inputs: category (required), symbol (required), orderFilter, orderId, +1 more.
get_access_keyB
Get access key from environment variables
:return: Access key
Inputs: no named parameters.
get_api_key_informationC
Get API key information
Returns:
Dict: API key information
Example:
get_api_key_information()
Reference:
https://bybit-exchange.github.io/docs/v5/user/apikey-info
Inputs: no named parameters.
get_instruments_infoC
Get exchange information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
status (Optional[str]): Status
baseCoin (Optional[str]): Base coin
Returns:
Dict: Exchange information
Example:
get_instruments_info("spot", "BTCUSDT", "Trading", "BTC")
Reference:
https://bybit-exchange.github.io/docs/v5/market/instrument
Inputs: category (required), symbol (required), baseCoin, status.
get_klineB
Get K-line (candlestick) data
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
interval (str): Time interval (1, 3, 5, 15, 30, 60, 120, 240, 360, 720, D, W, M)
start (Optional[int]): Start time in milliseconds
end (Optional[int]): End time in milliseconds
limit (int): Number of records to retrieve
Returns:
Dict: K-line data
Example:
get_kline("spot", "BTCUSDT", "1h", 1625097600000, 1625184000000, 100)
Reference:
https://bybit-exchange.github.io/docs/v5/market/kline
Inputs: category (required), interval (required), symbol (required), end, +2 more.
get_open_ordersC
Get open orders
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
limit (int): Number of orders to retrieve
Returns:
Dict: Open orders
Example:
get_open_orders("spot", "BTCUSDT", "123456789", "link123", "Order", 10)
Reference:
https://bybit-exchange.github.io/docs/v5/order/open-order
Inputs: category (required), limit, orderFilter, orderId, +2 more.
get_orderbookC
Get orderbook data
:parameter
symbol: Symbol (e.g., BTCUSDT)
limit: Number of orderbook entries to retrieve
category: Category (spot, linear, inverse, etc.)
Args:
category: Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
limit (int): Number of orderbook entries to retrieve
Returns:
Dict: Orderbook data
Example:
get_orderbook("spot", "BTCUSDT", 10)
Reference:
https://bybit-exchange.github.io/docs/v5/market/orderbook
Inputs: category (required), symbol (required), limit.
get_order_historyC
Get order history
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
orderStatus (Optional[str]): Order status
startTime (Optional[int]): Start time in milliseconds
endTime (Optional[int]): End time in milliseconds
limit (int): Number of orders to retrieve
Returns:
Dict: Order history
Example:
get_order_history("spot", "BTCUSDT", "123456789", "link123", "Order", "Created", 1625097600000, 1625184000000, 10)
Reference:
https://bybit-exchange.github.io/docs/v5/order/order-list
Inputs: category (required), endTime, limit, orderFilter, +5 more.
get_positionsC
Get position information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
Returns:
Dict: Position information
Example:
get_positions("spot", "BTCUSDT")
Reference:
https://bybit-exchange.github.io/docs/v5/position
Inputs: category (required), symbol.
get_secret_keyB
Get secret key from environment variables
:return: Secret key
Inputs: no named parameters.
get_tickersC
Get ticker information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
Returns:
Dict: Ticker information
Example:
get_tickers("spot", "BTCUSDT")
Reference:
https://bybit-exchange.github.io/docs/v5/market/tickers
Inputs: category (required), symbol (required).
get_wallet_balanceC
Get wallet balance
Args:
accountType (str): Account type (UNIFIED, CONTRACT, SPOT)
coin (Optional[str]): Coin symbol
Returns:
Dict: Wallet balance information
Example:
get_wallet_balance("UNIFIED", "BTC")
Reference:
https://bybit-exchange.github.io/docs/v5/account/wallet-balance
Inputs: accountType (required), coin.
place_orderA
Execute order
Args:
category (str): Category
- spot: Spot trading
* Minimum order quantity: 0.000011 BTC (up to 6 decimal places)
* Minimum order amount: 5 USDT
* If buying at market price, qty should be input in USDT units (e.g., "10" = 10 USDT)
* If selling at market price, qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC)
* If placing a limit order, qty should be input in BTC units
* positionIdx is not used
- linear: Futures trading (USDT margin)
* positionIdx is required (1: Long, 2: Short)
- inverse: Futures trading (coin margin)
* positionIdx is required (1: Long, 2: Short)
symbol (str): Symbol (e.g., BTCUSDT)
side (str): Order direction (Buy, Sell)
orderType (str): Order type (Market, Limit)
qty (str): Order quantity
- Market Buy: qty should be input in USDT units (e.g., "10" = 10 USDT)
- Market Sell: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC, up to 6 decimal places)
- Limit: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC, up to 6 decimal places)
price (Optional[str]): Order price (for limit orders)
positionIdx (Optional[str]): Position index
- Required for futures (linear/inverse) trading
- "1": Long position
- "2": Short position
- Not used for spot trading
timeInForce (Optional[str]): Order validity period
- GTC: Good Till Cancel (default, for limit orders)
- IOC: Immediate or Cancel (market order)
- FOK: Fill or Kill
- PostOnly: Post Only
orderLinkId (Optional[str]): Order link ID (unique value)
isLeverage (Optional[int]): Use leverage (0: No, 1: Yes)
orderFilter (Optional[str]): Order filter
- Order: Regular order (default)
- tpslOrder: TP/SL order
- StopOrder: Stop order
triggerPrice (Optional[str]): Trigger price
triggerBy (Optional[str]): Trigger basis
orderIv (Optional[str]): Order volatility
takeProfit (Optional[str]): Take profit price
stopLoss (Optional[str]): Stop loss price
tpTriggerBy (Optional[str]): Take profit trigger basis
slTriggerBy (Optional[str]): Stop loss trigger basis
tpLimitPrice (Optional[str]): Take profit limit price
slLimitPrice (Optional[str]): Stop loss limit price
tpOrderType (Optional[str]): Take profit order type (Market, Limit)
slOrderType (Optional[str]): Stop loss order type (Market, Limit)
Returns:
Dict: Order result
Example:
# Spot trading (SPOT account balance required)
place_order("spot", "BTCUSDT", "Buy", "Market", "10") # Buy market price for 10 USDT
place_order("spot", "BTCUSDT", "Sell", "Market", "0.000100") # Sell market price for 0.0001 BTC
place_order("spot", "BTCUSDT", "Buy", "Limit", "0.000100", price="50000") # Buy limit order for 0.0001 BTC
# Spot trading - limit order + TP/SL
place_order("spot", "BTCUSDT", "Buy", "Limit", "0.000100", price="50000",
takeProfit="55000", stopLoss="45000", # TP/SL setting
tpOrderType="Market", slOrderType="Market") # Execute TP/SL as market order
# Futures trading
place_order("linear", "BTCUSDT", "Buy", "Market", "0.001", positionIdx="1") # Buy market price for long position
place_order("linear", "BTCUSDT", "Sell", "Market", "0.001", positionIdx="2") # Sell market price for short position
Notes:
1. Spot trading order quantity restrictions:
- Minimum order quantity: 0.000011 BTC
- Minimum order amount: 5 USDT
- BTC quantity is only allowed up to 6 decimal places (e.g., 0.000100 O, 0.0001234 X)
2. Pay attention to unit when buying/selling at market price:
- Buying: qty should be input in USDT units (e.g., "10" = 10 USDT)
- Selling: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC)
3. Futures trading requires positionIdx:
- Long position: positionIdx="1"
- Short position: positionIdx="2"
4. positionIdx is not used for spot trading
Reference:
https://bybit-exchange.github.io/docs/v5/order/create-order
Inputs: category (required), orderType (required), qty (required), side (required), +18 more.
set_margin_modeC
Set margin mode
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
tradeMode (int): Trading mode (0: Isolated, 1: Cross)
buyLeverage (str): Buying leverage
sellLeverage (str): Selling leverage
Returns:
Dict: Setting result
Example:
set_margin_mode("spot", "BTCUSDT", 0, "10", "10")
Reference:
https://bybit-exchange.github.io/docs/v5/account/set-margin-mode
Inputs: buyLeverage (required), category (required), sellLeverage (required), symbol (required), +1 more.
set_trading_stopC
Set trading stop
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
takeProfit (Optional[str]): Take profit price
stopLoss (Optional[str]): Stop loss price
trailingStop (Optional[str]): Trailing stop
positionIdx (Optional[int]): Position index
Returns:
Dict: Setting result
Example:
set_trading_stop("spot", "BTCUSDT", "55000", "45000", "1000", 0)
Reference:
https://bybit-exchange.github.io/docs/v5/position/trading-stop
Inputs: category (required), symbol (required), positionIdx, stopLoss, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have distinct purposes targeting specific resources like orders, market data, positions, and account management, with clear boundaries. However, get_access_key and get_secret_key are very similar in purpose (retrieving credentials from environment variables) and could cause confusion, though they target different keys.
All tools follow a consistent verb_noun naming pattern (e.g., cancel_order, get_instruments_info, place_order, set_margin_mode). The pattern is uniform across all 15 tools, with no mixing of conventions like camelCase or other styles.
With 15 tools, the count is well-scoped for a cryptocurrency exchange server, covering essential operations like trading, market data, account management, and positions. Each tool appears to serve a specific, necessary function without obvious bloat or redundancy.
The tool set provides comprehensive coverage for trading, market data, and account operations, including CRUD-like actions for orders (place, cancel, get history) and positions. Minor gaps exist, such as no tool for modifying orders (e.g., update_order) or handling more advanced account settings, but core workflows are well-supported.
Maintenance
Related MCP Connectors
Real-time crypto market data: candles, tickers, orderbooks across 13+ exchanges via MCP.
CoinGlass MCP — wraps the CoinGlass Derivatives API v4 (coinglass.com)
Market Data App MCP — wraps the Market Data App API (marketdata.app)
Create and manage trading strategies, bots, webhooks and signals from any MCP client.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables cryptocurrency trading on Bybit exchange through comprehensive market data access, account management, and automated trading operations. Features smart position validation, trailing stop losses, and risk management tools with demo mode support for safe testing.21MIT
- FlicenseBqualityDmaintenanceA comprehensive MCP server providing full access to Bybit's v5 API for real-time market data, trading operations, and account management. It enables AI assistants to execute trades, manage positions, and monitor wallet balances with built-in safety controls for both testnet and production environments.226-
- AlicenseCqualityDmaintenanceMCP server for Bybit exchange enabling 246 tools for trading, market data, account management, and more via natural language.1002MIT

Bybit MCP Serverofficial
AlicenseBqualityBmaintenanceA production-ready MCP server for Bybit — 206 tools covering market data, trading, positions, account management, assets, and real-time WebSocket streams. Enables AI assistants to interact directly with the Bybit cryptocurrency exchange through natural language.3981,294 npm43MIT