Gergy AI MCP
An intelligent assistant built on Model Context Protocol architecture that provides cross-domain intelligence across financial, family, lifestyle, professional, and home management domains.
README
Gergy AI - MCP Architecture Foundation
Gergy AI is an intelligent assistant powered by Model Context Protocol (MCP) architecture, designed to provide cross-domain intelligence across five key life areas: Financial, Family, Lifestyle, Professional, and Home management.
🏗️ Architecture Overview
This foundational implementation provides the shared infrastructure that all five MCP servers will build upon:
Shared Infrastructure
- Database Layer: PostgreSQL with JSONB for flexible schema and cross-domain knowledge storage
- Caching Layer: Redis for high-performance caching with cross-domain relevance
- Pattern Recognition: Intelligent cross-domain pattern detection and suggestions
- Cost Management: Distributed API budget tracking and optimization
- Base MCP Framework: Foundation class for all domain servers
Domain Servers
- Financial Server - Budget management, expense tracking, investment insights
- Family Server - Event planning, relationship management, family coordination
- Lifestyle Server - Health, fitness, personal development, leisure activities
- Professional Server - Career development, skill tracking, professional networking
- Home Server - Home maintenance, improvement projects, household management
🚀 Quick Start
Prerequisites
- Python 3.10+ (tested with 3.10.12)
- Docker and Docker Compose
- PostgreSQL client tools (optional for manual access)
- Redis client tools (optional for manual access)
Note: PostgreSQL and Redis will run in Docker containers, so you don't need them installed locally.
Installation
- Clone and setup:
git clone <repository-url> gergy-mcp
cd gergy-mcp
- Environment configuration:
cp .env.example .env
# Edit .env with your specific configuration
- Start the infrastructure:
docker-compose up -d postgres redis
- Install dependencies:
pip install -r requirements.txt
- Initialize database:
python -c "
from shared.models.database import DatabaseConfig
config = DatabaseConfig('postgresql://gergy_user:gergy_password@localhost:5432/gergy_knowledge')
config.create_tables()
print('Database initialized successfully')
"
📁 Project Structure
gergy-mcp/
├── shared/ # Shared infrastructure
│ ├── models/ # Database models
│ │ ├── __init__.py
│ │ └── database.py # PostgreSQL models with JSONB
│ ├── services/ # Core services
│ │ ├── __init__.py
│ │ ├── database_service.py # Unified knowledge access
│ │ ├── pattern_recognition_service.py # Cross-domain intelligence
│ │ ├── cost_tracking_service.py # API budget management
│ │ └── cache_service.py # Redis caching with relevance
│ ├── utils/ # Utilities
│ │ ├── __init__.py
│ │ └── config.py # Configuration management
│ ├── __init__.py
│ └── base_mcp_server.py # Base server framework
├── servers/ # Domain-specific servers
│ ├── financial/ # Financial management server
│ ├── family/ # Family coordination server
│ ├── lifestyle/ # Lifestyle management server
│ ├── professional/ # Professional development server
│ └── home/ # Home management server
├── docker-compose.yml # Infrastructure orchestration
├── requirements.txt # Python dependencies
├── .env.example # Environment configuration template
└── README.md # This file
🛠️ Key Features
Cross-Domain Intelligence
- Pattern Recognition: Automatically detects patterns across domains (e.g., financial decisions affecting family plans)
- Knowledge Sharing: Unified knowledge base accessible across all servers
- Context Awareness: Maintains conversation context and suggests relevant cross-domain insights
Performance & Cost Optimization
- Smart Caching: Redis-based caching with cross-domain relevance scoring
- Cost Tracking: Real-time API usage monitoring with budget alerts
- Pattern-Based Suggestions: Reduces API calls through intelligent pattern matching
Scalable Architecture
- Modular Design: Each domain server inherits from
BaseMCPServer - Database Flexibility: JSONB fields allow schema evolution without migrations
- Containerized Deployment: Docker Compose for easy scaling and deployment
📊 Database Schema
Core Tables
- knowledge_items: Cross-domain knowledge with flexible JSONB metadata
- user_sessions: Conversation tracking and context accumulation
- temporal_cache: Expiration management and cross-module relevance
- cross_domain_patterns: Pattern recognition system
- api_usage_analytics: Cost tracking per server
Example Usage
from shared.services.database_service import DatabaseService
from shared.services.pattern_recognition_service import PatternRecognitionService
# Initialize services
db_service = DatabaseService("postgresql://...")
pattern_service = PatternRecognitionService(db_service)
# Store knowledge across domains
await db_service.store_knowledge(
domain="financial",
title="Budget Planning",
content="Monthly budget analysis...",
metadata={"category": "planning", "priority": "high"},
keywords=["budget", "planning", "monthly"]
)
# Detect cross-domain patterns
patterns = await pattern_service.analyze_conversation(
content="Planning a family vacation",
domain="family",
session_id="user_123"
)
🔧 Configuration
Environment Variables
Key configuration options in .env:
# Database
DATABASE_URL=postgresql://gergy_user:gergy_password@localhost:5432/gergy_knowledge
# Redis
REDIS_URL=redis://localhost:6379
# Budget limits per server (USD/day)
FINANCIAL_BUDGET_LIMIT=15.0
FAMILY_BUDGET_LIMIT=10.0
LIFESTYLE_BUDGET_LIMIT=8.0
PROFESSIONAL_BUDGET_LIMIT=12.0
HOME_BUDGET_LIMIT=8.0
Server Configuration
Each domain server can be configured independently:
from shared.utils.config import load_config
config = load_config("config.yml") # Optional config file
financial_config = config.servers["financial"]
🔍 Monitoring & Analytics
Built-in Metrics
- Request/response tracking per server
- Cost analysis and budget alerts
- Pattern detection effectiveness
- Cache hit/miss ratios
- Cross-domain suggestion accuracy
Optional Monitoring Stack
- Grafana: Dashboards for visual monitoring
- Prometheus: Metrics collection and alerting
- Database Analytics: Cross-domain usage patterns
🧪 Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=shared
# Run specific test modules
pytest tests/test_database_service.py
pytest tests/test_pattern_recognition.py
📈 Next Steps
This foundation enables:
- Domain Server Implementation: Each server will inherit from
BaseMCPServer - Tool Registration: Domain-specific tools for Claude.ai integration
- Pattern Learning: Machine learning models for better pattern recognition
- API Integration: External service connections with cost tracking
- Advanced Analytics: Cross-domain insights and optimization
🤝 Contributing
- Follow the established patterns in
BaseMCPServer - Ensure all new features include tests
- Update documentation for new configurations
- Maintain cross-domain compatibility
📝 License
[Your chosen license]
Status: Foundation Complete ✅ Next Phase: Domain Server Implementation Target: Full MCP integration with Claude.ai
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。