MCP Server — Python/FastAPI (starter)
Overview
This project implements a small Market-Data Control Plane (MCP) server:
- Fetches crypto market tickers using CCXT (default exchange: Binance)
- Polls tickers in background and caches them
- Exposes REST endpoints:
- GET /ping
- GET /tickers (cached tickers)
- GET /ticker/{symbol}
- GET /historical/{symbol}?timeframe=1m&limit=200
- Realtime updates via WebSocket /ws (server pushes polled tickers)
Setup
- Create virtualenv:
- Copy .env.example => .env and set COINMARKETCAP_API_KEY if you want CMC calls.
- Run server:
- API docs: http://127.0.0.1:8000/docs
Notes & assumptions
- CCXT is used for exchange data. Symbols should be in CCXT format (e.g. BTC/USDT).
- Real-time updates are polling-based (configurable via POLL_INTERVAL). For production, integrate exchange websockets if available.
- In-memory TTL cache is used for simplicity; replace with Redis for multi-process deployment.
- Add more test coverage for edge cases and historical queries.
Submission
- Upload code to GitHub with README describing architecture, dependencies, assumptions, and test instructions.
-
Include requirements.txt and sample .env.
