808JACK/CryptoMCPServer
3.2
If you are the rightful owner of CryptoMCPServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Python MCP server for retrieving real-time and historical cryptocurrency market data from multiple exchanges using CCXT.
Tools
6
Resources
0
Prompts
0
Cryptocurrency Market Data MCP Server
A Python MCP server for retrieving real-time and historical cryptocurrency market data from multiple exchanges using CCXT.
Features
- 6 MCP Tools: Real-time prices, historical data, order books, trades, price comparison, and market summaries
- Multi-Exchange Support: Binance, Coinbase, Kraken, Bitfinex
- Caching: 60-second TTL cache to reduce API calls
- Error Handling: Automatic retry logic with exponential backoff
- Comprehensive Testing: 33 tests with 66% coverage
Installation
git clone https://github.com/808JACK/Crypto-Mcp-Server.git
cd Crypto-Mcp-Server
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Usage
Start the Server
python -m src.server
Example
from src.server import CryptoMCPServer
import asyncio
async def main():
server = CryptoMCPServer()
# Get BTC price
ticker = await server._get_ticker('binance', 'BTC/USDT')
print(f"BTC: ${ticker['last']:,.2f}")
# Get historical data
ohlcv = await server._get_ohlcv('binance', 'BTC/USDT', '1d', 7)
print(f"Retrieved {ohlcv['count']} candles")
asyncio.run(main())
Testing
# Run all tests
pytest tests/ -v
# Run specific tests
pytest tests/test_cache.py -v
pytest tests/test_utils.py -v
pytest tests/test_server_comprehensive.py -v
# Test with real data
pytest tests/test_live_data.py -v -s
# Coverage report
pytest tests/ --cov=src --cov-report=html
MCP Tools
- get_ticker - Real-time price, bid, ask, volume
- get_ohlcv - Historical OHLCV data with multiple timeframes
- get_order_book - Live order book
- get_trades - Recent trade history
- compare_prices - Compare prices across exchanges
- get_market_summary - Complete market overview
Project Structure
crypto-mcp-server/
├── src/
│ ├── server.py # MCP server
│ ├── cache.py # Caching
│ └── utils.py # Utilities
├── tests/
│ ├── test_server_comprehensive.py
│ ├── test_cache.py
│ ├── test_utils.py
│ └── test_live_data.py
├── examples/
│ └── example_usage.py
└── requirements.txt
Dependencies
- mcp - Model Context Protocol SDK
- ccxt - Cryptocurrency exchange library
- cachetools - Caching utilities
- pytest - Testing framework
License
MIT