Bybit MCP Server
Bybit MCP 服务器
模型上下文协议 (MCP)服务器提供对 Bybit 加密货币交换 API 的只读访问。
这是 Alpha 质量软件 - 使用风险自负!
请务必在此服务器上使用只读 API 密钥。我不会将您的“钱”托付给我的代码,您也一样!
Started integrated server
Chatting with llama-3.2-11b-instruct:Q8_0 (Ctrl+C to exit)
Tools are available - ask about cryptocurrency data!
You: Whats the current spot price for USDT/BTC?
Assistant: <tool>get_ticker</tool>
<arguments>
{
"category": "spot",
"symbol": "BTCUSDT"
}
</arguments>
Tool result: {
"timestamp": "2024-12-14T12:32:30.628Z",
"meta": {
"requestId": "ad5177bc-93d1-49ed-80a1-dd95b3ec970b"
},
"symbol": "BTCUSDT",
"category": "spot",
"lastPrice": "101368.71",
"price24hPcnt": "0.0107",
"highPrice24h": "102661.3",
"lowPrice24h": "99683.96",
"prevPrice24h": "100292.67",
"volume24h": "22543.911683",
"turnover24h": "2285318788.68303381",
"bid1Price": "101366.07",
"bid1Size": "0.136049",
"ask1Price": "101366.08",
"ask1Size": "0.648039",
"usdIndexPrice": "101365.707576"
}
Processing result...
The current spot price for USDT/BTC is $101,368.71.特征
该 MCP 服务器提供以下工具用于与 Bybit 的 API 交互:
get_ticker:获取交易对的实时股票行情信息get_orderbook:获取交易对的订单簿(市场深度)数据get_kline:获取交易对的 K 线/K 线数据get_market_info:获取交易对的详细市场信息get_trades:获取交易对的近期交易get_instrument_info:获取特定交易对的详细工具信息get_wallet_balance:获取已验证用户的钱包余额信息get_positions:获取已验证用户的当前位置信息get_order_history:获取经过身份验证的用户的订单历史记录
Related MCP server: Binance MCP Server
要求和安装
Node.js(v20+)
pnpm(
npm i -g pnpm)如果您想运行 Ollama 客户端(如下面的快速入门所示),您需要安装并运行 Ollama,以及您选择的模型。
pnpm i快速入门
要安装软件包,请构建所有内容并启动交互式客户端:
pnpm i将 .env.example 文件复制到 .env 并填写您的详细信息。
cp .env.example .env
code .envMCP 服务器(仅限)
pnpm serveMCP-Server 和 Ollama 客户端
安装所需的客户端包:
(cd client && pnpm i)将客户端 .env.example 文件复制到 .env 并填写您的详细信息。
cp client/.env.example client/.env
code client/.env然后通过一个命令启动客户端和服务器:
pnpm start配置
环境变量
服务器需要将 Bybit API 凭证设置为环境变量:
BYBIT_API_KEY:您的 Bybit API 密钥(必需)BYBIT_API_SECRET:您的 Bybit API 密钥(必需) -重要 - 仅创建只读 API 密钥!BYBIT_USE_TESTNET:设置为“true”以使用测试网而不是主网(可选,默认为 false)DEBUG:设置为“true”以启用调试日志记录(可选,默认为 false)
客户端环境变量(./client/.env):
OLLAMA_HOST:Ollama 服务器的主机(默认为http://localhost:11434 )DEFAULT_MODEL:用于聊天的默认模型(默认为 llama-3.2-11b-instruct:Q8_0)
MCP 设置配置
要将此服务器与 MCP 客户端一起使用,您需要将其添加到 MCP 设置配置文件中。文件位置取决于您的客户端:
MCP 示例 - Claude 桌面
位置: ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"bybit": {
"command": "node",
"args": ["/path/to/bybit-mcp/build/index.js"],
"env": {
"BYBIT_API_KEY": "your-api-key",
"BYBIT_API_SECRET": "your-api-secret",
"BYBIT_USE_TESTNET": "false"
}
}
}
}MCP 示例 - gomcp
位置: ~/.config/gomcp/config.yaml
mcp_servers:
- name: "bybit"
command: "cd /path/to/bybit-mcp && pnpm run serve"
arguments: []
env:
BYBIT_API_KEY: "" # Add your Bybit API **READ ONLY** key here
BYBIT_API_SECRET: "" # Add your Bybit API **READ ONLY** secret here
BYBIT_USE_TESTNET: "true" # Set to false for production
DEBUG: "false" # Optional: Set to true for debug logging客户端集成
此软件包包含一个 TypeScript 客户端,该客户端提供命令行界面,用于与 Ollama LLM 和 bybit-mcp 服务器交互。该客户端支持:
与 Ollama 模特互动聊天
直接访问所有 bybit-mcp 交易工具
自动服务器管理
基于环境的配置
调试日志记录
有关详细的客户端文档,请参阅客户端 README 。
运行服务器
生产
构建服务器:
pnpm build运行服务器:
node build/index.js发展
对于使用自动 TypeScript 重新编译进行开发:
pnpm watch在开发过程中检查 MCP 服务器:
pnpm inspector工具文档
获取股票信息
{
"name": "get_ticker",
"arguments": {
"symbol": "BTCUSDT",
"category": "spot" // optional, defaults to "spot"
}
}获取订单簿数据
{
"name": "get_orderbook",
"arguments": {
"symbol": "BTCUSDT",
"category": "spot", // optional, defaults to "spot"
"limit": 25 // optional, defaults to 25 (available: 1, 25, 50, 100, 200)
}
}获取K线/K线数据
{
"name": "get_kline",
"arguments": {
"symbol": "BTCUSDT",
"category": "spot", // optional, defaults to "spot"
"interval": "1", // optional, defaults to "1" (available: "1", "3", "5", "15", "30", "60", "120", "240", "360", "720", "D", "M", "W")
"limit": 200 // optional, defaults to 200 (max 1000)
}
}获取市场信息
{
"name": "get_market_info",
"arguments": {
"category": "spot", // optional, defaults to "spot"
"symbol": "BTCUSDT", // optional, if not provided returns info for all symbols in the category
"limit": 200 // optional, defaults to 200 (max 1000)
}
}获取最近交易
{
"name": "get_trades",
"arguments": {
"symbol": "BTCUSDT",
"category": "spot", // optional, defaults to "spot"
"limit": 200 // optional, defaults to 200 (max 1000)
}
}获取仪器信息
{
"name": "get_instrument_info",
"arguments": {
"symbol": "BTCUSDT", // required
"category": "spot" // optional, defaults to "spot"
}
}返回有关交易工具的详细信息,包括:
基础货币和报价货币
交易状态
批量过滤器(最小/最大订单数量)
价格过滤器(刻度大小)
杠杆设置(针对期货)
合约详情(针对期货)
获取钱包余额
{
"name": "get_wallet_balance",
"arguments": {
"accountType": "UNIFIED", // required (available: "UNIFIED", "CONTRACT", "SPOT")
"coin": "BTC" // optional, if not provided returns all coins
}
}获取职位
{
"name": "get_positions",
"arguments": {
"category": "linear", // required (available: "linear", "inverse")
"symbol": "BTCUSDT", // optional
"baseCoin": "BTC", // optional
"settleCoin": "USDT", // optional
"limit": 200 // optional, defaults to 200
}
}获取订单历史记录
{
"name": "get_order_history",
"arguments": {
"category": "spot", // required (available: "spot", "linear", "inverse")
"symbol": "BTCUSDT", // optional
"baseCoin": "BTC", // optional
"orderId": "1234567890", // optional
"orderLinkId": "myCustomId", // optional
"orderStatus": "Filled", // optional (available: "Created", "New", "Rejected", "PartiallyFilled", "PartiallyFilledCanceled", "Filled", "Cancelled", "Untriggered", "Triggered", "Deactivated")
"orderFilter": "Order", // optional (available: "Order", "StopOrder")
"limit": 200 // optional, defaults to 200
}
}支持的类别
spot:现货交易linear:线性永续合约inverse:逆向永续合约
执照
麻省理工学院
Available Tools
12 toolsget_instrument_infoC
Get detailed instrument information for a specific trading pair
Inputs: symbol (required), category.
get_klineC
Get kline/candlestick data for a trading pair. Supports optional reference ID for data verification.
Inputs: symbol (required), category, includeReferenceId, interval, +1 more.
get_market_infoC
Get detailed market information for trading pairs
Inputs: category, limit, symbol.
get_market_structureC
Advanced market structure analysis combining ML-RSI, order blocks, and liquidity zones. Provides comprehensive market regime detection and trading recommendations.
Inputs: category (required), interval (required), symbol (required), analysisDepth, +3 more.
get_ml_rsiB
Get ML-enhanced RSI using K-Nearest Neighbors algorithm for pattern recognition. Provides adaptive overbought/oversold levels and enhanced RSI values based on historical pattern similarity.
Inputs: category (required), interval (required), symbol (required), featureCount, +6 more.
get_order_blocksC
Detect institutional order accumulation zones based on volume analysis. Identifies bullish and bearish order blocks using volume peaks and tracks their mitigation status.
Inputs: category (required), interval (required), symbol (required), bearishBlocks, +4 more.
get_orderbookC
Get orderbook (market depth) data for a trading pair
Inputs: symbol (required), category, limit.
get_order_historyC
Get order history for the authenticated user
Inputs: category (required), baseCoin, limit, orderFilter, +4 more.
get_positionsC
Get positions information for the authenticated user
Inputs: category (required), baseCoin, limit, settleCoin, +1 more.
get_tickerC
Get real-time ticker information for a trading pair. Supports optional reference ID for data verification.
Inputs: symbol (required), category, includeReferenceId.
get_tradesC
Get recent trades for a trading pair
Inputs: symbol (required), category, limit.
get_wallet_balanceC
Get wallet balance information for the authenticated user
Inputs: accountType (required), coin.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have distinct purposes, but there is some overlap between get_market_info, get_instrument_info, and get_ticker, which all provide market-related data for trading pairs. The descriptions help differentiate them, but an agent might need to carefully choose between these for specific needs.
All tool names follow a consistent verb_noun pattern using snake_case, starting with 'get_' followed by a descriptive noun phrase. This uniformity makes the tool set predictable and easy to navigate for an agent.
With 12 tools, the count is well-scoped for a trading server, covering market data, analysis, and user account operations. Each tool appears to serve a specific function without redundancy, fitting the domain appropriately.
The tool set covers key areas like market data retrieval, advanced analysis, and user account management, but lacks tools for executing trades or managing orders, which are core actions in a trading domain. This gap might limit agent workflows for full trading automation.
Maintenance
Related MCP Connectors
Unlock the power of real-time cryptocurrency data with our Crypto Price Insights MCP server.
Pay-per-call crypto data over x402 (USDC on Base). Hosted, no wallet or key held by the server.
A Model Context Protocol server exposing real-time and historical Colombo Stock Exchange (CSE) data to AI agents and LLM applications. Provides quotes and OHLCV price history, full financial statements (income, balance sheet, cash flow), pre-computed technicals (moving averages, RS ratings, volume signals), macroeconomic indicators, corporate actions, and rule-based screening across CSE stocks and sector indices, everything needed to build CSE-aware trading assistants, research tools, and market-analysis agents. This is the official MCP server of www.ceyloncharts.com
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides access to CoinMarketCap's cryptocurrency data, enabling AI applications to retrieve cryptocurrency listings, quotes, and detailed information.37-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that exposes Binance cryptocurrency exchange data to LLMs, allowing agents to access real-time prices, order books, and historical market data without requiring API keys.21MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI coding tools like Claude Code and Cursor to interact with Bybit's trading platform for market data retrieval, account management, and trading operations.1125 npm13MIT
- FlicenseBqualityDmaintenanceA Model Context Protocol server that provides real-time cryptocurrency price fetching capabilities using the CoinGecko API. It enables LLMs to retrieve and process the latest price for any coin by its name or symbol.2-