- Home
- MCP servers
- Bybit
Bybit
- python
7
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"dlwjdtn535-mcp-bybit-server": {
"command": "uv",
"args": [
"run",
"--directory",
"C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\mcp-server-demo\\src",
"server.py"
],
"env": {
"TESTNET": "true",
"ACCESS_KEY": "{ACCESS_KEY}",
"SECRET_KEY": "{ACCESS_KEY}"
}
}
}
}You can interact with the Bybit API through an MCP server that exposes common trading and market data actions as tools. This interface lets you fetch market data, check balances, view positions, and place or cancel orders via simple tool calls, all routed through MCP clients.
How to use
Connect your MCP client to the Bybit MCP server using the stdio (local) setup or run the server via Docker. Once connected, you can call each tool to fetch data or perform trading actions. The available tools include getting the order book, retrieving price data, checking balances and positions, placing or canceling orders, and configuring trading settings. Use the tools to automate trading workflows, fetch live market information, and manage risk with take-profit and stop-loss settings.
How to install
Prerequisites: you need Node.js installed if you plan to run via a local MCP runtime, or Docker if you prefer containerized execution.
Install the MCP server via the local runtime path or container as shown below.
Option A: Run with uv (stdio) on Windows
How to install
{
"mcpServers": {
"mcp-server-demo-windows": {
"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}"
}
}
}
}
How to install
Option B: Run with uv (stdio) on macOS
How to install
{
"mcpServers": {
"mcp-server-demo-mac": {
"command": "uv",
"args": [
"run",
"--directory",
"/usr/local/bin/mcp-server-demo/src",
"server.py"
],
"env": {
"ACCESS_KEY": "{ACCESS_KEY}",
"SECRET_KEY": "{ACCESS_KEY}"
}
}
}
}
How to install
Option C: Run with uv (stdio) on Linux
How to install
{
"mcpServers": {
"mcp-server-demo-linux": {
"command": "uv",
"args": [
"run",
"--directory",
"/home/YOUR_USERNAME/bin/mcp-server-demo/src",
"server.py"
],
"env": {
"ACCESS_KEY": "{ACCESS_KEY}",
"SECRET_KEY": "{ACCESS_KEY}"
}
}
}
}
How to install
Option D: Run with Docker (requires Docker)
How to install
{
"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"
]
}
}
}
How to install
Option E: Run with Docker using an environment file (requires Docker)
How to install
{
"mcpServers": {
"bybit-server-docker-env": {
"command": "/bin/sh",
"args": [
"-c",
"source .env && docker run -i --rm --init -e ACCESS_KEY=$BYBIT_API_KEY -e SECRET_KEY=$BYBIT_API_SECRET -e TESTNET=true dlwjdtn535/mcp-bybit-server:latest"
]
}
}
}
Additional notes
Environment variables you must set before running the server are ACCESS_KEY, SECRET_KEY, and optionally TESTNET. Use your Bybit API key and secret, and enable IP restrictions where possible. The server supports testnet mode by setting TESTNET to true.
Security considerations
Keep API keys secret and do not expose them in public code or logs. Restrict the API key to only the IPs that will run the MCP server, and grant only the necessary permissions (Read, Trade, Wallet).
Troubleshooting
If a server configuration does not start, verify that the environment variables are set correctly and that the specified directory paths exist. Check that the selected MCP runtime (uv or Docker) can access the host network and the Bybit API keys are valid.
Examples and notes
Two common setup patterns are using uv for a local runtime and Docker for a containerized setup. You can adapt the directory paths to match your system and keep the same command structure. When you see a snippet with -e KEY=VALUE, replace KEY and VALUE with your actual credentials.
Available tools
get_orderbook
Fetches order book information for a given category and symbol with an optional limit.
get_kline
Retrieves candlestick data (K-line) for a symbol and interval with optional start, end, and limit.
get_tickers
Fetches ticker information for a given category and symbol.
get_wallet_balance
Fetches account balance for a given account type and optional coin.
get_positions
Fetches current position information for a symbol and category.
place_order
Places a limit or market order with various optional parameters like timeInForce, takeProfit, and stopLoss.
cancel_order
Cancels an existing order identified by orderId or orderLinkId.
get_order_history
Fetches historical order details with optional filters.
get_open_orders
Fetches current open orders with optional filters.
set_trading_stop
Sets take profit, stop loss, or trailing stop for a position.
set_margin_mode
Sets the margin mode (isolated or cross) for a symbol.
get_api_key_information
Fetches information about the current API key.
get_instruments_info
Fetches details about trading instruments (symbols).