Bybit Trading Interface
STDIOConvenient interface to interact with Bybit API using MCP tools.
Convenient interface to interact with Bybit API using MCP tools.
Bybit MCP (Model Context Protocol) Server. Provides a convenient interface to interact with the Bybit API using MCP tools. Allows fetching market data, managing account information, and placing/canceling orders via API calls wrapped as tools.
To install this Bybit API Interface server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @dlwjdtn535/mcp-bybit-server --client claude
Add the following configuration to your MCP settings file (e.g., mcp_settings.json
):
Using uv With Windows:
{ "mcpServers": { "mcp-server-demo": { "command": "uv", "args": [ "run", "--directory", "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\mcp-server-demo\\src", "server.py" ], "env": { "ACCESS_KEY": "{ACCESS_KEY}", "SECRET_KEY": "{ACCESS_KEY}" } } // ... other servers might be here ... } }
(Remember to replace YOUR_USERNAME and use double backslashes \)
Using uv With macOS:
{ "mcpServers": { "mcp-server-demo": { "command": "uv", "args": [ "run", "--directory", "/usr/local/bin/mcp-server-demo/src", "server.py" ], "env": { "ACCESS_KEY": "{ACCESS_KEY}", "SECRET_KEY": "{ACCESS_KEY}" } } // ... other servers might be here ... } }
(Replace YOUR_USERNAME if using ~/bin)
Using uv With Linux:
{ "mcpServers": { "mcp-server-demo": { "command": "uv", "args": [ "run", "--directory", "/home/YOUR_USERNAME/bin/mcp-server-demo/src", "server.py" ], "env": { "ACCESS_KEY": "{ACCESS_KEY}", "SECRET_KEY": "{ACCESS_KEY}" } } // ... other servers might be here ... } }
Using Docker (Requires Docker)
Make sure you have pulled the image first: docker pull dlwjdtn535/mcp-bybit-server:latest
{ "mcpServers": { "bybit-server-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "--init", "-e", "ACCESS_KEY={ACCESS_KEY}", "-e", "SECRET_KEY={SECRET_KEY}", "dlwjdtn535/mcp-bybit-server:latest" ] } } }
Note: Always use
@latest
or a specific version tag for both NPX and Docker to ensure you are using the intended version.
This MCP server provides the following tools for interacting with the Bybit API:
get_orderbook
: Fetches order book information.
category
, symbol
, limit
(optional)get_kline
: Fetches K-line (candlestick) data.
category
, symbol
, interval
, start
(optional), end
(optional), limit
(optional)get_tickers
: Fetches cryptocurrency ticker information.
category
, symbol
get_wallet_balance
: Fetches account balance.
accountType
, coin
(optional)get_positions
: Fetches position information.
category
, symbol
(optional)place_order
: Places a limit or market order.
category
, symbol
, side
, orderType
, qty
, price
(optional for limit), positionIdx
(optional for futures), and other optional parameters (e.g., timeInForce
, takeProfit
, stopLoss
).cancel_order
: Cancels an existing order.
category
, symbol
, orderId
(optional), orderLinkId
(optional)get_order_history
: Fetches historical order details.
category
, symbol
(optional), orderId
(optional), limit
(optional), etc.get_open_orders
: Fetches current open orders.
category
, symbol
(optional), limit
(optional), etc.set_trading_stop
: Sets take profit, stop loss, or trailing stop for a position.
category
, symbol
, takeProfit
(optional), stopLoss
(optional), trailingStop
(optional), positionIdx
(optional)set_margin_mode
: Sets the margin mode (isolated or cross).
category
, symbol
, tradeMode
, buyLeverage
, sellLeverage
get_api_key_information
: Fetches information about the current API key.
get_instruments_info
: Fetches details about trading instruments (symbols).
category
, symbol
, status
(optional), baseCoin
(optional)(Refer to the function docstrings in the code for detailed parameter descriptions and examples.)
Before running the server, you must set the following environment variables:
ACCESS_KEY=YOUR_BYBIT_API_KEY SECRET_KEY=YOUR_BYBIT_SECRET_KEY TESTNET=false # Optional: set to true for testnet
To use this Bybit API interface, you need to create an API key from Bybit. Follow these important steps:
If you find this project helpful and would like to support its development, you can contribute in the following ways:
You can also support this project by signing up for Bybit using our referral link:
Your support helps maintain and improve this project. Thank you! 🙏
For additional inquiries or support, please contact:
We welcome your questions and feedback!
MIT License