bybit-trading-mcp
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-trading-mcpWhat's the current price of BTCUSDT?"
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.
Bybit V5 Trading Bot + Multi-Exchange MCP Server
π Unified Trading Bot dengan dual interface: Telegram Bot + MCP Server untuk integration dengan AI tools seperti Claude.
π― Overview
Sistem ini menggabungkan:
MCP Server (Model Context Protocol) dengan FastAPI framework
Telegram Bot untuk mobile trading interface
Multi-Exchange Support untuk 6 major exchanges
Natural Language Processing untuk trading commands
Machine Learning integration untuk market analysis
Related MCP server: All-in-One Crypto Trading MCP Server
β¨ Key Features
π€ Dual Interface
Telegram Bot: Mobile-first interface dengan natural language support
MCP Server: HTTP API untuk integration dengan Claude/AI tools
Unified Backend: Same trading engine untuk kedua interface
π Multi-Exchange Support
Bybit (Primary): Full V5 API - public + private endpoints
Binance: Public market data API
KuCoin: Public market data API
OKX: Public market data API
Huobi: Public market data API
MEXC: Public market data API
π§ Intelligent Features
Natural Language: "What's Bitcoin price?" β API calls
Price Comparison: Real-time comparison across exchanges
API Documentation: Contextual help dalam setiap response
Error Handling: User-friendly error messages
π Quick Start
1. Requirements
Python 3.11+
Create
.envfile (see configuration below)
2. Installation
git clone https://github.com/yourusername/bybit-trading-bot.git
cd bybit-trading-bot
pip install -r requirements.txt3. Configuration
Create .env file:
# Required
TELEGRAM_BOT_TOKEN=your_telegram_token
# Optional for private endpoints
BYBIT_API_KEY=your_bybit_key
BYBIT_API_SECRET=your_bybit_secret
BYBIT_PUBLIC_ONLY=true # Set false for trading
# LLM Integration
ZAI_API_KEY=your_llm_api_key
ZAI_BASE_URL=https://api.novita.ai/openai # Default Novita GPT-OSS
# Optional
BOT_AUTH_REQUIRED=false
LLM_ROUTER_MODEL=your_router_model4. Run the System
Option 1: Telegram Bot Only
python -m src.mainOption 2: MCP Server Only
python tools/mcp_server.py
# Server: http://localhost:8001Option 3: Both (Recommended)
# Terminal 1: Start MCP Server
python tools/mcp_server.py
# Terminal 2: Start Telegram Bot
python -m src.mainπ± Telegram Bot Usage
Commands:
/start # Initialize bot
/help # Full command guide
/status # System status
# Market Data
/price BTCUSDT bybit # Get BTC price from Bybit
/price ETHUSDT binance # Get ETH price from Binance
/compare BTCUSDT # Compare BTC across exchanges
/exchanges # List available exchanges
# Account (requires API key)
/balance # Wallet balance
/positions # Open positionsNatural Language:
"Harga Bitcoin sekarang?" # β Bybit BTC price
"Compare ETH prices" # β Multi-exchange comparison
"Show me SOL on KuCoin" # β KuCoin SOL price
"What's my balance?" # β Wallet balanceπ MCP Server Integration
For Claude Desktop:
Add to your claude_desktop_config.json:
{
"mcpServers": {
"bybit-trading": {
"command": "python",
"args": ["/path/to/bybit-trading-bot/tools/mcp_server.py"],
"env": {
"BYBIT_PUBLIC_ONLY": "true"
}
}
}
}Direct HTTP Usage:
# Get Bybit ticker
curl "http://localhost:8001/bybit/tickers?category=spot&symbol=BTCUSDT"
# Compare prices across exchanges
curl "http://localhost:8001/exchanges/compare-prices?symbol=BTCUSDT&exchanges=bybit,binance,kucoin"
# Get API documentation
curl "http://localhost:8001/api-docs?section=market"ποΈ Project Structure
src/
βββ main.py # Unified Telegram bot dengan MCP integration
βββ bybit_client.py # Bybit V5 API implementation
βββ mcp_telegram_client.py # MCP client untuk Telegram integration
βββ llm.py # Natural language processing
βββ telegram_bot.py # Telegram bot core
βββ exchange_client.py # Multi-exchange API client
βββ strategy.py # Trading strategies
βββ model.py # Machine learning models
βββ config.py # Configuration management
tools/
βββ mcp_server.py # FastAPI-MCP server
scripts/
βββ debug_llm.py # LLM debugging
βββ debug_tool_calls.py # Tool call debugging
βββ debug_specific_query.py # Query testing
βββ simple_llm_test.py # LLM sanity test
docs/
βββ MCP_TELEGRAM_INTEGRATION.md # Detailed system documentation
βββ natural_language_implementation.md
βββ multi_exchange.md
data/
βββ auth.json # Local runtime dataπ§ͺ Testing & Debugging
Test Individual Components:
# Test LLM integration
python scripts/debug_llm.py
python scripts/simple_llm_test.py
# Test tool calls
python scripts/debug_tool_calls.py
# Test specific queries
python scripts/debug_specific_query.py
# Test natural language
python test_true_natural.pyTest MCP Server:
# Start server
python tools/mcp_server.py
# Test endpoints
curl http://localhost:8001/
curl "http://localhost:8001/bybit/tickers?category=spot"
curl "http://localhost:8001/exchanges/compare-prices?symbol=BTCUSDT"π― What's New in This Version
β
Complete MCP Rewrite: Migrated dari custom implementation ke FastAPI-MCP framework
β
Multi-Exchange Integration: 6 major exchanges dengan unified interface
β
Dual Interface: Telegram Bot + MCP Server dalam satu system
β
API Documentation Context: Contextual help dalam setiap response
β
Enhanced Error Handling: User-friendly error messages
β
Natural Language: Advanced LLM integration untuk command parsing
π Security & Best Practices
API Key Management:
Use environment variables untuk API keys
Never commit keys to repository
Use testnet untuk development
BYBIT_PUBLIC_ONLY=trueuntuk safe testing
Rate Limiting:
Built-in rate limiting untuk semua exchanges
Auto-retry dengan exponential backoff
Request queueing untuk high-volume usage
π Architecture
βββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββ
β Telegram Bot βββββΊβ MCP Client βββββΊβ MCP Server β
β β β β β β
β β’ Commands β β β’ HTTP Client β β β’ FastAPI β
β β’ Natural Lang β β β’ Response Formatβ β β’ Multi-CEX β
β β’ LLM Chat β β β’ Error Handling β β β’ API Docs β
βββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββ
β Exchange APIs β
β β’ Bybit (V5) β’ Binance β
β β’ KuCoin β’ OKX β
β β’ Huobi β’ MEXC β
ββββββββββββββββββββββββββββββββββββββπ€ Contributing
Fork the repository
Create feature branch
Implement changes dengan proper tests
Update documentation
Submit pull request
π License
MIT License - see LICENSE file for details.
β οΈ Disclaimer
This software is for educational purposes. Trading cryptocurrencies involves substantial risk. Always do your own research and never invest more than you can afford to lose.
π Happy Trading with Multi-Exchange MCP Integration!
To enable trading and other private endpoints, set
BYBIT_PUBLIC_ONLY=falseand provide valid API keys.For faster small-talk replies, consider a lighter
LLM_ROUTER_MODELand smallerLLM_MAX_TOKENS(e.g., 512β2048).
Run MCP Server (optional)
Install deps:
pip install -r requirements.txtStart server:
python -m tools.mcp_serverThe server exposes two example tools:
health_checkandecho. Extend to callZaiClientor Bybit.
Telegram Commands
/startand/help: Info bantuan./time: Server time Bybit (public, production)./ticker <category> [symbol]: Ticker market V5, kategorispot|linear|inverse|option./balance [COIN]: Wallet balance V5 (private, defaultaccountType=UNIFIED)./signal <category> <symbol> <interval> <mode>: Prediksi XGBoost (scalping/swing) dari kline terkini./ask <pertanyaan>: Natural language router β LLM memilih aksi (tickers, kline, orderbook, trades, balance, positions, orders, create/cancel order) dan bot mengeksekusi.
docs: polish README + add examples
Added badges (License, Issues)
Added Quickstart and examples/get_price.py
Added CHANGELOG and CONTRIBUTING
Quickstart
python examples/get_price.py
This server cannot be deployed
Maintenance
Related MCP Connectors
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Trade across 22+ exchanges and brokers from any MCP-capable AI agent, no install required.
Crypto trading intelligence MCP β 34+ endpoints, x402 pay-per-use, AI agent strategy & execution
No-KYC managed MCP for AI agents: sandboxed TypeScript trading SDK, isolated sub-accounts, futures.
Related MCP Servers
AlicenseNot gradedqualityBmaintenanceMCP server connecting AI assistants to OKX exchange, enabling trading, market data, account management, and more via 150+ tools across 11 modules.423MIT- AlicenseNot gradedqualityDmaintenanceEnables AI-powered cryptocurrency trading and analytics across multiple exchanges and blockchains, with integrated Telegram bot and live trading capabilities.3MIT
- FlicenseNot gradedqualityCmaintenanceEnables MCP-compatible AI clients to access live crypto market data and AI-driven quantitative analysis, with structured outputs and full observability.-

TradeStaq MCPofficial
AlicenseBqualityBmaintenanceProvides 31 AI-powered crypto trading tools for Claude, Cursor, and any MCP client, enabling strategy creation, backtesting, bot deployment, copy trading, and portfolio management across multiple exchanges.3423 npmMIT