Harsharma2026/Python-MCP-Server
If you are the rightful owner of Python-MCP-Server 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.
The MCP Crypto Server is a Python-based server designed to fetch real-time and historical cryptocurrency market data from major exchanges using the ccxt library. It includes tools for data fetching, error handling, caching, and testing.
MCP Crypto Server
Python-based MCP server to fetch real-time and historical cryptocurrency market data from major exchanges (via ccxt). Includes MCP tools for data fetching, utilities for error handling and caching, and tests for validation.
Features
- MCP tools for ticker, order book, and historical OHLCV.
- Real-time updates via polling subscription tool.
- Robust error handling and input validation.
- In-memory TTL caching to reduce API load.
- Tests with mocking for deterministic behavior.
Setup
Using pip:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Or with Poetry:
poetry install
poetry shell
Running the MCP server
The server registers tools that can be discovered by MCP-compatible clients.
python -m mcp_crypto_server.mcp_server
Tools
fetch_ticker(symbol: str, exchange: str = "binance")fetch_order_book(symbol: str, exchange: str = "binance", limit: int = 50)fetch_historical(symbol: str, exchange: str = "binance", timeframe: str = "1h", since: int | None = None, until: int | None = None, limit: int = 1000)subscribe_ticker(symbol: str, exchange: str = "binance", interval_seconds: int = 1, duration_seconds: int = 30)
Tests
Run tests:
pytest -q
Notes
- Historical time window uses milliseconds epoch. If
untilis provided, results are filtered client-side. - Caching TTLs can be configured in
config.py.