CCXT MCP Server
CCXT MCP 服务器
使用 MCP(模型上下文协议)和 CCXT 实现高性能加密货币交换集成。
特征
🚀交易所支持:连接 20 多个加密货币交易所
🔃市场类型:支持现货、期货、掉期市场等
🔧代理配置:通过代理访问交易所的选项
📊快速可靠:优化缓存和速率限制
🌐 MCP 标准:通过 MCP 与 Claude 和 GPT 等 LLM 兼容
Related MCP server: binance-futures-mcp
CCXT MCP 服务器集成架构
CCXT MCP 服务器通过模型上下文协议 (MCP) 将语言模型连接到加密货币交易所。它充当桥梁,允许 LLM 通过统一的 API 访问实时市场数据并跨多个交易所执行交易操作。
该架构包括:
发送请求的 LLM 客户端(Claude 和其他 MCP 兼容模型)
标准化通信的模型上下文协议 (MCP)
处理请求和管理交换交互的 CCXT MCP 服务器
CCXT 库提供对交易所 API 的统一访问
连接到多个加密货币交易所
CCXT MCP 服务器代码架构
为了更好的可维护性和可扩展性,服务器分为三个主要模块:
Exchange :管理交换实例、凭证和符号验证
Utils :提供缓存、速率限制和日志记录功能
工具:实现MCP工具和资源的交流互动
快速入门
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 mcp-server-ccxt:
npx -y @smithery/cli install @doggybee/mcp-server-ccxt --client claudeNPM 包(推荐)
您可以从 npm 安装 CCXT MCP 服务器:
# Install globally
npm install -g @mcpfun/mcp-server-ccxt
# Start the server
mcp-server-ccxt或者直接运行:
npx @mcpfun/mcp-server-ccxt手动安装
或者,您可以克隆并构建存储库:
# Clone the repository
git clone https://github.com/doggybee/mcp-server-ccxt.git
cd mcp-server-ccxt
# Install dependencies
npm install
# Build the server
npm run build
# Start the server
npm start配置
创建环境文件
cp .env.example .env编辑
.env文件以添加您的交换 API 密钥# Default exchange (optional) DEFAULT_EXCHANGE=binance # Default market type (optional) DEFAULT_MARKET_TYPE=spot # API credentials (optional) BINANCE_API_KEY=your_api_key BINANCE_SECRET=your_api_secret # Proxy configuration (optional) USE_PROXY=false PROXY_URL=http://username:password@your-proxy-server:port # Legacy format (still supported but recommended to use the integrated URL format above) # PROXY_USERNAME= # PROXY_PASSWORD=
用法
注意:如果您遇到任何 MCP 通信问题,请参阅故障排除指南以寻求解决方案。
运行服务器
启动服务器:
# If installed globally via npm
mcp-server-ccxt
# If installed manually
npm start与 Claude for Desktop 一起使用
将服务器添加到您的
claude_desktop_config.json:
如果通过 npm 安装(全局):
{
"mcpServers": {
"ccxt": {
"command": "mcp-server-ccxt"
}
}
}如果手动安装:
{
"mcpServers": {
"ccxt": {
"command": "node",
"args": [
"/path/to/mcp-server-ccxt/build/index.js"
]
}
}
}重启 Claude 桌面版
在另一个项目中用作模块
您还可以将此包用作您自己的 Node.js 项目中的模块:
// Import the CCXT MCP Server
import '@mcpfun/mcp-server-ccxt';
// The server starts automatically when imported
// You can configure it through environment variables示例查询
以下是一些可用于 MCP 服务器的示例查询:
“币安上比特币的当前价格是多少?”
“向我展示 Coinbase 上 ETH/USDT 的订单簿”
获取币安平台 BTC/USDT 过去 24 根 K 线图的 1 小时 OHLCV 数据
“比较不同交易所的 SOL/USDT 价格”
“我目前在币安的余额是多少?”(需要 API 密钥)
“在 Kraken 上下达 0.1 ETH 的市场买入订单”(需要 API 密钥)
可用工具
公共 API 工具
list-exchanges:列出所有可用的加密货币交易所get-ticker:获取交易对的当前股票代码信息batch-get-tickers:一次获取多个交易对的股票代码信息get-orderbook/get-order-book:获取交易对的市场订单簿get-ohlcv:获取交易对的 OHLCV 烛台数据get-trades:获取交易对的近期交易get-markets:获取交易所所有可用的市场get-exchange-info:获取交易所信息和状态get-leverage-tiers:获取期货杠杆等级get-funding-rates:获取当前融资利率get-positions:获取未平仓头寸信息get-open-orders:获取所有未结订单get-order-history:获取订单历史记录
私有 API 工具(需要 API 密钥)
account-balance:从加密货币交易所获取您的账户余额place-market-order:在交易所下达市价订单place-limit-order:在交易所下限价订单cancel-order:取消现有订单cancel-all-orders:取消所有未结订单set-leverage:设置期货杠杆set-margin-mode:设置期货的保证金模式place-futures-market-order:下达期货市场订单place-futures-limit-order:下达期货限价订单transfer-funds:账户之间转移资金(例如,现货到期货)
配置和实用工具
cache-stats:获取 CCXT 缓存统计信息clear-cache:清除 CCXT 缓存set-log-level:设置日志级别get-proxy-config:获取代理设置set-proxy-config:配置代理设置set-market-type:设置默认市场类型set-default-exchange:更改默认交换system-info:获取系统和环境信息
性能优化
MCP-CCXT 包含多项优化以确保高性能:
LRU缓存系统:
不同类型的数据有不同的TTL
股票行情数据:10秒
订单簿数据:5秒
市场数据:1小时
自适应速率限制:
根据交易所响应自动调整请求率
实现错误指数退避
管理每个交易所的并发请求
Exchange 连接管理:
高效初始化交易所实例
正确的错误处理和重试
安全最佳实践
API 密钥安全
创建专用 API 密钥:
为不同的应用程序/目的创建单独的 API 密钥
切勿在不同的服务或应用程序之间重复使用 API 密钥
限制 API 密钥权限:
仅启用您需要的权限(例如,市场数据只读)
如果只需要交易功能,请禁用提款权限
使用 IP 白名单(如果可用)来限制对已知 IP 的访问
安全存储:
切勿将 API 密钥提交到版本控制系统
将 API 密钥存储在环境变量或安全保险库中
使用通过
.gitignore从 git 中排除的.env文件
风险免责声明
本软件仅供参考。使用此软件与加密货币交易所进行交互存在重大风险:
财务风险:加密货币交易存在损失风险
API 安全:确保您的 API 密钥具有适当的权限限制
无投资建议:此工具不提供投资建议
无担保:该软件按“原样”提供,不提供任何形式的担保
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE.txt文件。
版权和归属
该项目使用 CCXT 库( https://github.com/ccxt/ccxt ),它是:
Copyright (c) 2016-2024 CCXT developersCCXT 根据 MIT 许可证发布,其中包括:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.如有问题、功能请求或贡献,请访问GitHub 存储库。
Available Tools
24 toolsaccount-balanceC
Get your account balance from a crypto exchange
Inputs: apiKey (required), exchange (required), secret (required), marketType, +1 more.
batch-get-tickersC
Get ticker information for multiple trading pairs at once
Inputs: exchange (required), symbols (required), marketType.
cache-statsB
Get CCXT cache statistics
Inputs: no named parameters.
clear-cacheB
Clear CCXT cache
Inputs: no named parameters.
clear-exchange-cacheB
Clear exchange instance cache to apply configuration changes
Inputs: no named parameters.
get-exchange-infoC
Get exchange information and status
Inputs: exchange (required), marketType.
get-funding-ratesC
Get current funding rates for perpetual contracts
Inputs: exchange (required), marketType, symbols.
get-leverage-tiersC
Get futures leverage tiers for trading pairs
Inputs: exchange (required), marketType, symbol.
get-marketsC
Get all available markets for an exchange
Inputs: exchange (required), page, pageSize.
get-market-typesB
Get market types supported by an exchange
Inputs: exchange (required).
get-ohlcvC
Get OHLCV candlestick data for a trading pair
Inputs: exchange (required), symbol (required), limit, timeframe.
get-orderbookC
Get market order book for a trading pair
Inputs: exchange (required), symbol (required), limit.
get-proxy-configB
Get the current proxy configuration
Inputs: no named parameters.
get-tickerC
Get current ticker information for a trading pair
Inputs: exchange (required), symbol (required), marketType.
get-tradesC
Get recent trades for a trading pair
Inputs: exchange (required), symbol (required), limit.
list-exchangesB
List all available cryptocurrency exchanges
Inputs: no named parameters.
place-futures-market-orderC
Place a futures market order
Inputs: amount (required), apiKey (required), exchange (required), secret (required), +5 more.
place-market-orderC
Place a market order on an exchange
Inputs: amount (required), apiKey (required), exchange (required), secret (required), +4 more.
set-leverageC
Set leverage for futures trading
Inputs: apiKey (required), exchange (required), leverage (required), secret (required), +3 more.
set-log-levelC
Set logging level
Inputs: level (required).
set-margin-modeC
Set margin mode for futures trading
Inputs: apiKey (required), exchange (required), marginMode (required), secret (required), +3 more.
set-market-typeC
Set default market type for all exchanges
Inputs: marketType (required), clearCache.
set-proxy-configC
Configure proxy settings for all exchanges
Inputs: enabled (required), url (required), clearCache, password, +1 more.
test-proxy-connectionC
Test the proxy connection with a specified exchange
Inputs: exchange (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools have distinct purposes, but there is some overlap between 'place-market-order' and 'place-futures-market-order', which could cause confusion if the agent doesn't understand the futures context. Additionally, 'clear-cache' and 'clear-exchange-cache' are similar, though the latter is more specific. Overall, descriptions help differentiate, but minor ambiguities exist.
Tool names follow a consistent verb_noun pattern with hyphens, such as 'get-ticker' and 'set-leverage', making them predictable and readable. However, there are minor deviations like 'batch-get-tickers' (which mixes verb order) and 'cache-stats' (which uses a noun-verb style), slightly breaking the pattern.
With 24 tools, the count is on the higher side but reasonable for a comprehensive crypto exchange server covering data retrieval, trading, configuration, and cache management. It might feel slightly heavy, but each tool appears to serve a specific function in the domain without obvious redundancy.
The tool set provides complete coverage for interacting with crypto exchanges, including market data (e.g., 'get-ohlcv', 'get-orderbook'), trading operations (e.g., 'place-market-order', 'set-leverage'), configuration (e.g., 'set-proxy-config'), and utility functions (e.g., 'cache-stats'). No significant gaps are apparent for the stated purpose.
Maintenance
Related MCP Connectors
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
MCP server with quote and live cryptocurrency price tools, local and cloud-deployed transports.
Real-time crypto market data: candles, tickers, orderbooks across 13+ exchanges via MCP.
Hosted MCP server for MT4 and MT5: read accounts, prices and candles, and place or close orders.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs to interact with cryptocurrency exchanges through CCXT, allowing for tasks like fetching balances, market data, creating orders, and trading operations in a standardized way.8MIT
- AlicenseNot gradedqualityCmaintenanceComprehensive Binance Futures trading MCP server with 41 professional trading tools across account management, order execution, market data, and risk management. Features smart ticker caching, secure authentication, and Docker support for seamless integration with MCP clients.4PythonMIT

cdcxofficial
AlicenseNot gradedqualityCmaintenanceMCP server for the Crypto.com Exchange API, providing 86 dynamically generated tools for market data, trading, account management, and more with real-time WebSocket streaming and safety enforcement.52 npm28Apache 2.0- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP service for cryptocurrency data acquisition with advanced technical analysis capabilities, supporting 100+ exchanges, 158 TA-Lib indicators, and dual transport protocols (stdio and HTTP/SSE).5MIT