mcp server ccxt

Local 2025-09-01 00:46:50 0

Provides real-time and historical cryptocurrency market data through integration with major exchanges. This server enables LLMs like Claude to fetch current prices, analyze market trends, and access detailed trading information.


A Model Context Protocol (MCP) server that provides real-time and historical cryptocurrency market data through integration with major exchanges. This server enables LLMs like Claude to fetch current prices, analyze market trends, and access detailed trading information.

MCP Python CCXT smithery badge

Cryptocurrency Market Data Server MCP server

Features

  • Real-time Market Data
  • Current cryptocurrency prices
  • Market summaries with bid/ask spreads
  • Top trading pairs by volume
  • Multiple exchange support

  • Historical Analysis

  • OHLCV (candlestick) data
  • Price change statistics
  • Volume history tracking
  • Customizable timeframes

  • Exchange Support

  • Binance
  • Coinbase
  • Kraken
  • KuCoin
  • HyperLiquid
  • Huobi
  • Bitfinex
  • Bybit
  • OKX
  • MEXC

Installation

Installing via Smithery

To install Cryptocurrency Market Data Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-server-ccxt --client claude

Installing Manually

# Using uv (recommended)
uv pip install mcp ccxt

# Using pip
pip install mcp ccxt

Usage

Running the Server

python crypto_server.py

Connecting with Claude Desktop

  1. Open your Claude Desktop configuration at:
  2. macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Windows: %APPDATA%Claudeclaude_desktop_config.json

  4. Add the server configuration:

{
    "mcpServers": {
        "crypto": {
            "command": "python",
            "args": ["/path/to/crypto_server.py"]
        }
    }
}
  1. Restart Claude Desktop

Available Tools

  1. get-price
  2. Get current price for any trading pair
  3. Example: "What's the current price of BTC/USDT on Binance?"

  4. get-market-summary

  5. Fetch detailed market information
  6. Example: "Show me a market summary for ETH/USDT"

  7. get-top-volumes

  8. List top trading pairs by volume
  9. Example: "What are the top 5 trading pairs on Kraken?"

  10. list-exchanges

  11. Show all supported exchanges
  12. Example: "Which exchanges are supported?"

  13. get-historical-ohlcv

  14. Get historical candlestick data
  15. Example: "Show me the last 7 days of BTC/USDT price data in 1-hour intervals"

  16. get-price-change

  17. Calculate price changes over different timeframes
  18. Example: "What's the 24-hour price change for SOL/USDT?"

  19. get-volume-history

  20. Track trading volume over time
  21. Example: "Show me the trading volume history for ETH/USDT over the last week"

Example Queries

Here are some example questions you can ask Claude once the server is connected:

- What's the current Bitcoin price on Binance?
- Show me the top 5 trading pairs by volume on Coinbase
- How has ETH/USDT performed over the last 24 hours?
- Give me a detailed market summary for SOL/USDT on Kraken
- What's the trading volume history for BNB/USDT over the last week?

Technical Details

Dependencies

  • mcp: Model Context Protocol SDK
  • ccxt: Cryptocurrency Exchange Trading Library
  • Python 3.9 or higher

Architecture

The server uses: - CCXT's async support for efficient exchange communication - MCP's tool system for LLM integration - Standardized data formatting for consistent outputs - Connection pooling for optimal performance

Error Handling

The server implements robust error handling for: - Invalid trading pairs - Exchange connectivity issues - Rate limiting - Malformed requests - Network timeouts

Development

Running Tests

# To be implemented
pytest tests/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

Local Development

# Clone the repository
git clone [repository-url]
cd crypto-mcp-server

# Install dependencies
uv pip install -e .

Troubleshooting

Common Issues

  1. Exchange Connection Errors
  2. Check your internet connection
  3. Verify the exchange is operational
  4. Ensure the trading pair exists on the selected exchange

  5. Rate Limiting

  6. Implement delays between requests
  7. Use different exchanges for high-frequency queries
  8. Check exchange-specific rate limits

  9. Data Formatting Issues

  10. Verify trading pair format (e.g., BTC/USDT, not BTCUSDT)
  11. Check timeframe specifications
  12. Ensure numerical parameters are within valid ranges

License

MIT License - See LICENSE file for details

Acknowledgments

  • CCXT for exchange integrations
  • Model Context Protocol for the MCP specification
  • The cryptocurrency exchanges for providing market data APIs
[
  {
    "description": "Get current price of a cryptocurrency pair from a specific exchange",
    "inputSchema": {
      "properties": {
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "symbol": {
          "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)",
          "type": "string"
        }
      },
      "required": [
        "symbol"
      ],
      "type": "object"
    },
    "name": "get-price"
  },
  {
    "description": "Get detailed market summary for a cryptocurrency pair from a specific exchange",
    "inputSchema": {
      "properties": {
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "symbol": {
          "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)",
          "type": "string"
        }
      },
      "required": [
        "symbol"
      ],
      "type": "object"
    },
    "name": "get-market-summary"
  },
  {
    "description": "Get top cryptocurrencies by trading volume from a specific exchange",
    "inputSchema": {
      "properties": {
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "limit": {
          "description": "Number of pairs to return (default: 5)",
          "type": "number"
        }
      },
      "type": "object"
    },
    "name": "get-top-volumes"
  },
  {
    "description": "List all supported cryptocurrency exchanges",
    "inputSchema": {
      "properties": {},
      "type": "object"
    },
    "name": "list-exchanges"
  },
  {
    "description": "Get historical OHLCV (candlestick) data for a trading pair",
    "inputSchema": {
      "properties": {
        "days_back": {
          "default": 7,
          "description": "Number of days of historical data to fetch (default: 7, max: 30)",
          "maximum": 30,
          "type": "number"
        },
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "symbol": {
          "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)",
          "type": "string"
        },
        "timeframe": {
          "default": "1h",
          "description": "Timeframe for candlesticks (e.g., 1m, 5m, 15m, 1h, 4h, 1d)",
          "enum": [
            "1m",
            "5m",
            "15m",
            "1h",
            "4h",
            "1d"
          ],
          "type": "string"
        }
      },
      "required": [
        "symbol"
      ],
      "type": "object"
    },
    "name": "get-historical-ohlcv"
  },
  {
    "description": "Get price change statistics over different time periods",
    "inputSchema": {
      "properties": {
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "symbol": {
          "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)",
          "type": "string"
        }
      },
      "required": [
        "symbol"
      ],
      "type": "object"
    },
    "name": "get-price-change"
  },
  {
    "description": "Get trading volume history over time",
    "inputSchema": {
      "properties": {
        "days": {
          "default": 7,
          "description": "Number of days of volume history (default: 7, max: 30)",
          "maximum": 30,
          "type": "number"
        },
        "exchange": {
          "default": "binance",
          "description": "Exchange to use (supported: binance, coinbase, kraken, kucoin, hyperliquid, huobi, bitfinex, bybit, okx, mexc)",
          "enum": [
            "binance",
            "coinbase",
            "kraken",
            "kucoin",
            "hyperliquid",
            "huobi",
            "bitfinex",
            "bybit",
            "okx",
            "mexc"
          ],
          "type": "string"
        },
        "symbol": {
          "description": "Trading pair symbol (e.g., BTC/USDT, ETH/USDT)",
          "type": "string"
        }
      },
      "required": [
        "symbol"
      ],
      "type": "object"
    },
    "name": "get-volume-history"
  }
]