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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。