MCP Crypto Data Server
Provides real-time and historical cryptocurrency market data from multiple exchanges (Binance, Kraken, Coinbase Pro) with Redis caching and rate limiting support.
README
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 settings -
Run server
python -m uvicorn app.main:app --reload -
Run tests
pytest pytest --cov=app --cov-report=html
Docker Deployment
Using Docker Compose (Recommended for Development)
cd docker
docker-compose up --build
This starts:
- Redis cache on port 6379
- FastAPI server on port 8000
Using Docker Directly
# Build image
docker build -f docker/Dockerfile -t mcp-server:latest .
# Run container
docker run -p 8000:8000 \
-e REDIS_URL=redis://host.docker.internal:6379/0 \
-e ENABLED_EXCHANGES=binance,kraken,coinbasepro \
mcp-server:latest
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:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mcp-server
spec:
replicas: 3
selector:
matchLabels:
app: mcp-server
template:
metadata:
labels:
app: mcp-server
spec:
containers:
- name: mcp-server
image: mcp-server:latest
ports:
- containerPort: 8000
env:
- name: APP_ENV
value: "production"
- name: REDIS_URL
value: "redis://redis-service:6379/0"
livenessProbe:
httpGet:
path: /v1/health
port: 8000
initialDelaySeconds: 10
periodSeconds: 30
readinessProbe:
httpGet:
path: /v1/health
port: 8000
initialDelaySeconds: 5
periodSeconds: 10
Monitoring
Health Check
curl http://localhost:8000/v1/health
Response:
{
"status": "ok",
"uptime": 123.45,
"version": "0.1.0"
}
Logs
View logs:
# Docker Compose
docker-compose logs -f app
# Docker
docker logs -f <container-id>
# Kubernetes
kubectl logs -f deployment/mcp-server
Performance Tuning
Redis Configuration
- Use Redis cluster for high availability
- Configure maxmemory policy:
allkeys-lru - Enable persistence:
appendonly yes
Rate Limiting
- Adjust
RATE_LIMIT_REQUESTSbased on API key limits - Monitor 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:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app.main:app
Worker count formula: workers = 2 * cpu_count + 1
Troubleshooting
Redis Connection Issues
# Check Redis connectivity
redis-cli -h redis-host ping
# Monitor Redis
redis-cli MONITOR
Rate Limit Errors
- Check exchange API key limits
- Verify
RATE_LIMIT_REQUESTSconfiguration - Review logs for rate limit patterns
High Memory Usage
- Check Redis memory:
redis-cli INFO memory - Reduce cache TTLs
- Monitor active connections
Slow Responses
- Check exchange API latency
- Monitor Redis performance
- Review application logs for errors
Backup & Recovery
Redis Backup
# Create snapshot
redis-cli BGSAVE
# Copy dump.rdb to backup location
cp /var/lib/redis/dump.rdb /backup/redis-$(date +%Y%m%d).rdb
Application Backup
# Backup configuration
cp .env /backup/.env.$(date +%Y%m%d)
# Backup logs
tar -czf /backup/logs-$(date +%Y%m%d).tar.gz logs/
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
.envfiles - Use 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:
- name: Deploy to Production
if: github.ref == 'refs/heads/main' && success()
run: |
# Deploy commands here
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.