mcp-global-intelligence

KaayaanAi/mcp-global-intelligence

3.2

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 henry@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.

Tools
3
Resources
0
Prompts
0

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

  1. Clone and Setup Environment

    git clone <your-repo-url>
    cd mcp-global-intelligence
    cp .env.example .env
    
  2. Configure Environment Variables

    Edit .env with 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
    
  3. Deploy with Docker

    # Quick start with Docker Compose
    docker compose up -d
    
    # Check logs
    docker logs -f mcp-global-intelligence
    
  4. 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

VariableDescriptionExample
REDIS_URLRedis connection stringredis://:pass@host:6379/0
MONGODB_URLMongoDB connectionmongodb://user:pass@host:27017/db
POSTGRES_URLPostgreSQL connectionpostgresql://user:pass@host/db
WHATSAPP_BASE_URLWAHA API endpointhttps://waha.example.com
WHATSAPP_SESSIONWhatsApp session IDyour_session_id
ALERT_CHAT_IDWhatsApp chat for alertschatid@c.us

Optional Configuration

VariableDescriptionDefault
COINGECKO_API_KEYCoinGecko Pro API keyNone
BINANCE_API_KEYBinance API keyNone
LOG_LEVELLogging levelINFO
ANALYSIS_CACHE_TTLCache TTL in seconds300
HTTP_TIMEOUTAPI timeout in seconds10

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

  1. Add MCP Client node to your workflow
  2. Configure stdio connection: python main.py
  3. 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
  • .env file 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request

Ensure all tests pass and follow the existing code style before submitting.