Python-based Model Context Protocol (MCP) server for real-time and historical cryptocurrency market data using ccxt.
- MCP tools for:
get_ticker(symbol)– latest ticker for a trading pairget_ohlcv(symbol, timeframe, limit)– historical OHLCV candlesget_order_book(symbol, limit)– order book snapshotstream_ticker(symbol, interval_seconds)– streaming-style ticker updates via polling
- Pluggable exchange backend (default: Binance via
ccxt) - Redis cache support for distributed caching across multiple server instances
- Redis Pub/Sub for delegating requests to worker pools
- Simple TTL cache fallback (in-memory)
- Structured error handling
- Small CLI chatbot client to exercise the MCP server.
python -m venv .venv
.venv\Scripts\activate
pip install -e .[dev]Or with uv:
uv syncThe server is installed as a console script named crypto-market-mcp.
crypto-market-mcpIt speaks MCP over stdio, so it can be wired into any MCP-compatible host.
Start one or more workers to process requests via Redis:
crypto-market-workerConfigure via environment variables:
$env:REDIS_HOST="localhost"
$env:USE_REDIS_CACHE="true"
crypto-market-workerSee REDIS_INTEGRATION.md for detailed Redis setup and usage.
A small chatbot is provided to exercise the MCP server locally.
crypto-market-chatbotExample conversation:
you> price BTC/USDT
mcp> {"symbol": "BTC/USDT", "price": 50000.0, ...}
you> ohlcv BTC/USDT
mcp> [ {"timestamp": ..., "open": ...}, ... ]
pytestThis runs unit tests for the cache, exchange client wrapper, and MCP tools.