KaayaanAi/mcp-global-intelligence
If you are the rightful owner of mcp-global-intelligence 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.
MCP Global Intelligence is an advanced cryptocurrency market analysis server that leverages the Model Context Protocol (MCP) for real-time data processing, technical analysis, and automated alerting.
MCP Global Intelligence
Advanced cryptocurrency market analysis server implementing the Model Context Protocol (MCP) with real-time data processing, technical analysis, and automated alerting capabilities.
Features
- Comprehensive Market Analysis: Technical indicators (RSI, Bollinger Bands, Moving Averages), sentiment analysis, and market predictions
- Real-time Data Processing: Live cryptocurrency price feeds with intelligent caching
- Automated Alert System: Smart notifications based on market conditions and risk thresholds
- Multi-Database Architecture: Redis caching, MongoDB analytics storage, PostgreSQL workflow logging
- WhatsApp Integration: Real-time notifications via WAHA API
- Portfolio Risk Assessment: Multi-asset risk analysis and diversification recommendations
- MCP 2025 Protocol: Latest Model Context Protocol implementation with WebSocket and SSE support
Quick Start
Prerequisites
- Python 3.11+
- Docker & Docker Compose
- Redis, MongoDB, PostgreSQL (or use Docker setup)
Installation
-
Clone and Setup Environment
git clone <your-repo-url> cd mcp-global-intelligence cp .env.example .env -
Configure Environment Variables
Edit
.envwith your actual values:# Database connections REDIS_URL=redis://:password@host:6379/0 MONGODB_URL=mongodb://user:pass@host:27017/database POSTGRES_URL=postgresql://user:pass@host:5432/database # WhatsApp alerts WHATSAPP_BASE_URL=https://your-waha-server.com WHATSAPP_SESSION=your_session_id ALERT_CHAT_ID=your_chat_id@c.us # API keys (optional but recommended) COINGECKO_API_KEY=your_coingecko_pro_key BINANCE_API_KEY=your_binance_key BINANCE_SECRET_KEY=your_binance_secret -
Deploy with Docker
# Quick start with Docker Compose docker compose up -d # Check logs docker logs -f mcp-global-intelligence -
Manual Installation
# Install dependencies pip install -r requirements.txt # Start server python main.py
MCP Tools Available
comprehensive_crypto_analysis
Complete cryptocurrency market analysis with technical indicators and predictions.
Parameters:
symbol: Cryptocurrency symbol (e.g., "bitcoin", "ethereum")workflow_id: Optional workflow identifier for tracking
Returns: Technical analysis, sentiment data, risk assessment, price predictions, and automated alerts.
market_alerts_summary
Get recent market alerts and activity summary.
Parameters:
hours: Time range for alert summary (default: 24)
Returns: Alert statistics, top active symbols, risk distribution, and market trends.
portfolio_risk_assessment
Analyze risk across multiple cryptocurrency holdings.
Parameters:
symbols: Array of cryptocurrency symbols to analyze
Returns: Portfolio diversification analysis, risk metrics, correlation data, and rebalancing recommendations.
Architecture
Core Components
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Data Sources │────│ Analysis Engine │────│ Alert System │
│ │ │ │ │ │
│ • CoinGecko API │ │ • Technical │ │ • WhatsApp │
│ • Binance API │ │ • Sentiment │ │ • Risk Alerts │
│ • Fear/Greed │ │ • Prediction │ │ • Notifications │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────┐
│ Infrastructure │
│ │
│ • Redis Cache │
│ • MongoDB Store │
│ • PostgreSQL │
└─────────────────┘
Project Structure
mcp-global-intelligence/
├── core/ # Core business logic
│ ├── crypto_engine.py # Market analysis engine
│ ├── kaayaan_integration.py # Infrastructure integration
│ └── mcp_server.py # MCP protocol implementation
├── handlers/ # Request handlers
│ ├── analysis_handler.py
│ ├── alert_handler.py
│ └── portfolio_handler.py
├── utils/ # Helper utilities
│ ├── calculations.py
│ ├── data_models.py
│ └── validators.py
├── config/ # Configuration management
│ └── settings.py
├── scripts/ # Deployment scripts
├── docs/ # Documentation
├── tests/ # Test suite
├── docker-compose.yml # Docker configuration
├── requirements.txt # Python dependencies
└── main.py # Application entry point
Configuration
Required Environment Variables
| Variable | Description | Example |
|---|---|---|
REDIS_URL | Redis connection string | redis://:pass@host:6379/0 |
MONGODB_URL | MongoDB connection | mongodb://user:pass@host:27017/db |
POSTGRES_URL | PostgreSQL connection | postgresql://user:pass@host/db |
WHATSAPP_BASE_URL | WAHA API endpoint | https://waha.example.com |
WHATSAPP_SESSION | WhatsApp session ID | your_session_id |
ALERT_CHAT_ID | WhatsApp chat for alerts | chatid@c.us |
Optional Configuration
| Variable | Description | Default |
|---|---|---|
COINGECKO_API_KEY | CoinGecko Pro API key | None |
BINANCE_API_KEY | Binance API key | None |
LOG_LEVEL | Logging level | INFO |
ANALYSIS_CACHE_TTL | Cache TTL in seconds | 300 |
HTTP_TIMEOUT | API timeout in seconds | 10 |
Usage Examples
MCP Client Integration
import json
from mcp import ClientSession
# Connect to MCP server
session = ClientSession("stdio", ["python", "main.py"])
# Analyze cryptocurrency
analysis = await session.call_tool("comprehensive_crypto_analysis", {
"symbol": "bitcoin"
})
print(json.dumps(analysis.content, indent=2))
n8n Integration
- Add MCP Client node to your workflow
- Configure stdio connection:
python main.py - Use available tools in automation workflows
See docs/n8n_integration_guide_comprehensive.md for detailed setup instructions.
Development
Local Development Setup
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
# or
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Run tests
python -m pytest tests/
# Start development server
python main.py
Running Tests
# Test infrastructure connections
python test_infrastructure.py
# Test core functionality
python test_core_infrastructure.py
# Run pytest suite
pytest tests/ -v
Deployment
Docker Deployment (Recommended)
# Build and deploy
docker compose up -d
# Scale for high availability
docker compose up -d --scale mcp-server=3
Manual Deployment
# Install system dependencies
sudo apt-get update
sudo apt-get install python3.11 python3-pip redis-server
# Deploy application
./scripts/production-startup.sh
Monitoring and Health Checks
Health Endpoints
The server includes built-in health monitoring:
# Check service health
curl http://localhost:8080/health
# Check infrastructure connections
curl http://localhost:8080/health/infrastructure
Logging
Logs are structured in JSON format for production monitoring:
# View application logs
docker logs mcp-global-intelligence
# Follow logs in real-time
docker logs -f mcp-global-intelligence
Security
Security Features
- Environment-based Configuration: No hardcoded credentials
- Input Validation: All inputs sanitized and validated
- Rate Limiting: Protection against API abuse
- Secure Defaults: Production-hardened configuration
- Container Isolation: Docker-based deployment
Security Checklist
- All credentials in environment variables
-
.envfile not committed to version control - Rate limiting configured for all APIs
- Container runs as non-root user
- Network access properly restricted
- Logs don't contain sensitive information
Troubleshooting
Common Issues
Connection Errors:
# Test database connections
python -c "from core.kaayaan_integration import KayaanIntegration; \
import asyncio; \
asyncio.run(KayaanIntegration().test_connections())"
Performance Issues:
# Check Redis memory usage
redis-cli info memory
# Monitor MongoDB operations
mongotop
# Check PostgreSQL connections
psql -h host -U user -c "SELECT * FROM pg_stat_activity;"
WhatsApp Integration Issues:
- Verify WAHA server is running and accessible
- Check session ID is valid and active
- Ensure chat ID format is correct (
number@c.us)
Support
For issues and questions:
- Check the logs:
docker logs mcp-global-intelligence - Review configuration: Ensure all required environment variables are set
- Test infrastructure: Run
python test_infrastructure.py
License
MIT License - See LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
Ensure all tests pass and follow the existing code style before submitting.