Sponsored by Deepsite.site

Bybit MCP Server

Created By
andrefigueira938 months ago
Content

Bybit MCP Server

A powerful server that connects Bybit's trading API with Machine Cognition Protocol (MCP) to enable AI-assisted cryptocurrency trading.

Bybit MCP Server Python License

Overview

Bybit MCP Server is a bridge between Bybit's trading platform and AI systems using the Machine Cognition Protocol (MCP). It provides a set of powerful tools for market analysis, technical indicators calculation, and automated trading operations.

Features

  • Real-time Market Data: Access current prices, market depth, and historical data
  • Advanced Technical Analysis: Calculate indicators like RSI, MACD, ATR, and more
  • Multi-timeframe Analysis: Analyze market trends across multiple timeframes
  • Automated Trading: Place, modify, and cancel orders programmatically
  • Risk Management: Position sizing recommendations based on volatility
  • Support/Resistance Detection: Identify key price levels for better entry/exit points
  • Docker Support: Easy deployment with Docker and docker-compose

Requirements

  • Python 3.12+
  • Bybit API credentials
  • Valid internet connection

Installation

Local Installation with Virtualenv

  1. Clone the repository:

    git clone https://github.com/andrefigueira93/bybit-mcp-server.git
    cd bybit-mcp-server
    
  2. Create and activate a virtual environment:

    uv venv
    source .venv/bin/activate
    
  3. Install dependencies:

    uv pip install -e .
    
  4. Create a .env file with your API credentials:

    BYBIT_API_KEY=your_api_key
    BYBIT_API_SECRET=your_api_secret
    BYBIT_TESTNET=True  # Set to False for production
    

Using Docker

  1. Clone the repository:

    git clone https://github.com/andrefigueira93/bybit-mcp-server.git
    cd bybit-mcp-server
    
  2. Create a .env file with your API credentials (as above)

  3. Build and run with Docker Compose:

    docker-compose build
    docker-compose up -d
    

Usage

Starting the Server

To run the server locally:

mcp run main.py -t sse

The server will start on port 8000 by default. When using Docker, the service is exposed on port 80.

Available Tools

The server provides the following tools:

Tool NameDescription
get_balanceGets the current wallet balance
get_tickerRetrieves current price, volume and other data for a symbol
get_klinesGets historical candlestick data for analysis
analyze_marketPerforms comprehensive technical analysis on a symbol
analyze_multi_timeframePerforms analysis across multiple timeframes
place_orderPlaces buy/sell orders with optional take profit/stop loss
cancel_orderCancels an active order
get_active_ordersLists all active orders
get_active_positionsLists all open positions

Example Usage with MCP

When connected to an MCP-compatible client:

# Example of using the MCP client to get a market analysis
analysis = mcp_client.call("analyze_market", symbol="BTCUSDT", intervalo="60")
print(analysis)

# Example of placing a market order
order = mcp_client.call("place_order",
                       symbol="BTCUSDT",
                       side="Buy",
                       order_type="Market",
                       qty=0.001,
                       stop_loss=25000)
print(order)

Project Structure

bybit-mcp-server/
├── main.py            # Main server file with MCP tools
├── pyproject.toml     # Project dependencies and metadata
├── Dockerfile         # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── .env               # Environment variables (create this yourself)
└── README.md          # This file

Environmental Variables

VariableDescriptionDefault
BYBIT_API_KEYAPI key for BybitNone (Required)
BYBIT_API_SECRETAPI secret for BybitNone (Required)
BYBIT_TESTNETWhether to use testnet (True) or mainnet (False)True

Contributing

Contributions are welcome! If you'd like to improve the Bybit MCP Server, please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This software is for educational purposes only. Use at your own risk. Trading cryptocurrencies involves significant risk and you can lose money. Past performance is not indicative of future results.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server