Deepikatingare/crypto-mcp-server
If you are the rightful owner of crypto-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.
A lightweight FastAPI backend that provides real-time and historical cryptocurrency data using CCXT.
- Problem Statement
Cryptocurrency market data is dynamic and changes every second. The goal of this assignment was to build a lightweight Python-based MCP-style backend server that can:
Fetch real-time prices of cryptocurrencies
Fetch historical OHLCV data
Use clean Python structure, caching, and proper API endpoints
Follow MCP-like modular design
This server simulates how a Model Context Protocol source would provide structured external data.
- Dataset / APIs Used
Instead of a dataset, this project uses live API data from crypto exchanges.
Data Source: CCXT (Binance API)
Modalities (types of data):
Real-time price feed
OHLCV historical candles (Open, High, Low, Close, Volume)
Format Returned: JSON
Example symbols: "BTC/USDT", "ETH/USDT"
- Methods / System Design
- Modular Architecture
crypto_service.py → Handles exchange connection + data fetching
cache.py → Small TTL-based cache
mcp_server.py → FastAPI server with routes
- Features Implemented
Real-time price endpoint
Historical data endpoint
Error handling
In-memory caching for reducing API load
Clean routing with FastAPI
- Evaluation
Since this is a backend server, evaluation is based on:
Response correctness
API uptime
Speed before/after caching
Clean structure & readability
- Results ✔ Real-time Price Example
GET /price?symbol=BTC/USDT
Outputs:
{ "data": { "symbol": "BTC/USDT", "price": 96018.44, "timestamp": 1763144986002 }, "cached": false }
✔ Historical Data Example
GET /history?symbol=BTC/USDT&timeframe=1h&limit=50
Returns a list of OHLCV candles.
✔ Caching Performance Feature Without Cache With Cache Response Time Slow Fast API Load High Low
📊 Visualization (optional): /models/results_plot.png (if you add later)
- Conclusion
FastAPI provides a clean and reliable structure for MCP-style servers.
CCXT allows easy access to crypto prices and historical data.
Caching greatly improves performance and reduces external calls.
The project demonstrates backend development, API design, and modular Python skills — fulfilling the assignment requirements.
-
How to Run
-
Create virtual environment python -m venv venv
-
Activate
Windows PowerShell:
.\venv\Scripts\Activate.ps1
-
Install dependencies pip install -r requirements.txt
-
Run the server uvicorn mcp_server:app --reload
Server runs at:
- API Endpoints GET /price http://127.0.0.1:8000/price?symbol=BTC/USDT
GET /history http://127.0.0.1:8000/history?symbol=BTC/USDT&timeframe=1h&limit=50
- Project Structure crypto-mcp-server/ │ ├── mcp_server.py ├── crypto_service.py ├── cache.py ├── requirements.txt └── README.md