Project-1
MCP server
MCP Crypto Data Server - Deployment Guide
Local Development
Prerequisites
Python 3.11+
Git
Docker & Docker Compose (optional)
Setup
Clone and setup
git clone <repository> cd mcp-crypto-data-server python3.11 -m venv venv source venv/bin/activate pip install -e ".[dev]"Configure environment
cp .env.example .env # Edit .env with your settingsRun server
python -m uvicorn app.main:app --reloadRun tests
pytest pytest --cov=app --cov-report=html
Docker Deployment
Using Docker Compose (Recommended for Development)
This starts:
Redis cache on port 6379
FastAPI server on port 8000
Using Docker Directly
Production Deployment
Environment Variables
See .env.example for all available settings. Key production settings:
APP_ENV=productionLOG_LEVEL=INFOREDIS_ENABLED=trueREDIS_URL=redis://redis-host:6379/0CMC_API_KEY=your_api_key
Kubernetes Deployment
Example deployment manifest:
Monitoring
Health Check
Response:
Logs
View logs:
Performance Tuning
Redis Configuration
Use Redis cluster for high availability
Configure maxmemory policy:
allkeys-lruEnable persistence:
appendonly yes
Rate Limiting
Adjust
RATE_LIMIT_REQUESTSbased on API key limitsMonitor rate limit errors in logs
Increase
INITIAL_BACKOFFif hitting limits frequently
Caching
Increase TTLs for stable data (OHLCV)
Decrease TTLs for volatile data (ticker)
Monitor cache hit rates
Server
Use multiple worker processes with Gunicorn:
Worker count formula: workers = 2 * cpu_count + 1
Troubleshooting
Redis Connection Issues
Rate Limit Errors
Check exchange API key limits
Verify
RATE_LIMIT_REQUESTSconfigurationReview logs for rate limit patterns
High Memory Usage
Check Redis memory:
redis-cli INFO memoryReduce cache TTLs
Monitor active connections
Slow Responses
Check exchange API latency
Monitor Redis performance
Review application logs for errors
Backup & Recovery
Redis Backup
Application Backup
Scaling
Horizontal Scaling
Deploy multiple server instances behind load balancer
Use shared Redis for cache
Configure sticky sessions if needed
Vertical Scaling
Increase server resources (CPU, memory)
Optimize database queries
Tune connection pools
Security
API Security
Use HTTPS in production
Implement rate limiting per IP
Add authentication if needed
Secrets Management
Never commit
.envfilesUse environment variables
Rotate API keys regularly
Network Security
Use VPC/private networks
Restrict Redis access
Enable firewall rules
CI/CD Integration
GitHub Actions workflow included (.github/workflows/ci.yml):
Runs linting (ruff)
Runs tests (pytest)
Builds Docker image
Reports coverage
Trigger deployment on successful CI: