UNPKG

yoda-mcp

Version:

Intelligent Planning MCP with Optional Dependencies and Graceful Fallbacks - wise planning through the Force of lean excellence

415 lines (323 loc) 11.5 kB
# Planner MCP API Documentation Welcome to the comprehensive API documentation for the Planner MCP system. This documentation provides detailed information about all public APIs, interfaces, and modules. ## Quick Navigation ### 🚀 Getting Started - [Installation Guide](../guides/installation.md) - [Quick Start Tutorial](../guides/quick-start.md) - [Configuration Guide](../guides/configuration.md) ### 📚 API Reference - [Core Modules](#core-modules) - [Security Framework](#security-framework) - [Infrastructure Components](#infrastructure-components) - [Integration APIs](#integration-apis) ### 💡 Examples - [Basic Usage](../examples/basic-usage.md) - [Advanced Patterns](../examples/advanced-usage.md) - [Integration Examples](../examples/integrations.md) ### 🏗️ Architecture - [System Overview](../architecture/overview.md) - [Design Decisions](../architecture/decisions.md) - [Performance Guidelines](../architecture/performance.md) ## Core Modules ### Orchestration Engine The central coordination system for the Planner MCP. ```typescript import { PlannerOrchestrator, PlanningRequest } from 'planner-mcp'; const orchestrator = new PlannerOrchestrator({ mcpServers: { serena: { url: 'http://serena:3001' }, sequential: { url: 'http://sequential:3002' }, context7: { url: 'http://context7:3003' }, todolist: { url: 'http://todolist:3004' } } }); ``` **Key Features:** - Multi-MCP server coordination - Hybrid fallback strategies (5-tier system) - Real-time performance monitoring - Quality validation gates - Automatic recovery mechanisms ### Validation Engine Ensures all plans meet world-class quality standards. ```typescript import { ValidationEngine, QualityTier } from 'planner-mcp/validation'; const validator = new ValidationEngine({ targetQuality: QualityTier.WORLD_CLASS, strictMode: true, customRules: [] }); const result = await validator.validatePlan(plan); ``` **Validation Criteria:** - **Completeness** - All requirements addressed - **Technical Accuracy** - Implementation feasibility - **Best Practices** - Industry standard compliance - **Quality Scoring** - 0-100 point assessment - **Enhancement Suggestions** - Automatic improvement recommendations ### Quality Certification 5-tier quality assessment and certification system. | Tier | Score Range | Description | Characteristics | |------|-------------|-------------|-----------------| | **WORLD_CLASS** | 81-100 | Exceptional quality | Comprehensive, innovative, best practices | | **ENTERPRISE** | 61-80 | Excellent quality | Scalable, secure, well-architected | | **PROFESSIONAL** | 41-60 | High quality | Complete, tested, documented | | **STANDARD** | 21-40 | Good quality | Functional, basic requirements met | | **BASIC** | 0-20 | Minimal quality | Incomplete, needs improvement | ## Security Framework ### Authentication System OAuth2 + OpenID Connect with comprehensive MFA support. ```typescript import { AuthenticationService, MFAService } from 'planner-mcp/security'; const auth = new AuthenticationService({ providers: ['oauth2', 'openid'], mfa: { required: true, methods: ['totp', 'webauthn', 'sms'] } }); ``` **Security Features:** - **OAuth2/OpenID Connect** - Industry standard authentication - **Multi-Factor Authentication** - TOTP, WebAuthn, SMS backup - **JWT Tokens** - Secure, stateless authentication - **Session Management** - Secure session lifecycle - **Account Protection** - Lockout and abuse prevention ### Authorization Framework Role-based access control with 4-tier hierarchy. ```typescript import { AuthorizationService, Role } from 'planner-mcp/security'; const authz = new AuthorizationService({ roles: { super_admin: ['*'], admin: ['system:*', 'users:*'], planner: ['plans:*', 'profile:read'], viewer: ['plans:read', 'profile:read'] } }); ``` **Access Control:** - **super_admin** - Complete system control - **admin** - User and system administration - **planner** - Plan creation and management - **viewer** - Read-only access ### Data Protection Enterprise-grade encryption and data security. ```typescript import { EncryptionService, FieldEncryption } from 'planner-mcp/security'; const encryption = new EncryptionService({ algorithm: 'AES-256-GCM', keyRotation: { enabled: true, schedule: 'weekly' } }); ``` **Protection Features:** - **AES-256-GCM Encryption** - Industry standard encryption - **Field-Level Encryption** - Granular data protection - **Key Management** - Automated key rotation - **PII Detection** - Automatic sensitive data identification - **Compliance** - GDPR, SOC2, HIPAA ready ## Infrastructure Components ### Monitoring System Comprehensive monitoring with business metrics. ```typescript import { BusinessMetrics, SystemHealthMonitor } from 'planner-mcp/monitoring'; const metrics = new BusinessMetrics({ collectors: ['prometheus', 'statsd'], dashboards: ['executive', 'operations', 'engineering'] }); ``` **Monitoring Capabilities:** - **System Health** - Response times, error rates, resource usage - **Business Metrics** - Success rates, user satisfaction, quality scores - **Security Events** - Authentication, authorization, threat detection - **Performance SLAs** - P50/P95/P99 latency tracking - **Real-time Dashboards** - Executive, operations, engineering views ### Scaling Infrastructure Horizontal scaling with intelligent load balancing. ```typescript import { LoadBalancer, AutoScaler } from 'planner-mcp/scaling'; const scaler = new AutoScaler({ triggers: ['cpu', 'memory', 'queue_depth'], algorithms: ['predictive', 'reactive'], limits: { min: 2, max: 50 } }); ``` **Scaling Features:** - **Auto-scaling** - CPU, memory, and queue-based triggers - **Load Balancing** - Multiple algorithms (round-robin, weighted, least-conn) - **Circuit Breakers** - Failure isolation and recovery - **Performance SLAs** - Automatic scaling to meet targets - **Predictive Scaling** - ML-based capacity planning ### Caching System Multi-tier caching for optimal performance. ```typescript import { CacheManager, CacheLayer } from 'planner-mcp/cache'; const cache = new CacheManager({ layers: [ { type: 'memory', ttl: 300 }, { type: 'redis', ttl: 3600 }, { type: 'distributed', ttl: 86400 } ] }); ``` **Caching Layers:** - **Memory Cache** - Ultra-fast in-process caching - **Redis Cache** - Distributed session and data caching - **Application Cache** - Plan and computation result caching - **CDN Cache** - Static content delivery - **Smart Invalidation** - Event-driven cache updates ## Integration APIs ### MCP Server Clients Pre-built clients for MCP server integration. #### Serena MCP Client Project memory and context management. ```typescript import { SerenaClient } from 'planner-mcp/clients'; const serena = new SerenaClient({ baseURL: 'http://serena:3001', timeout: 30000, retries: 3 }); const projectContext = await serena.getProjectContext(projectId); ``` #### Sequential MCP Client Step-by-step reasoning and analysis. ```typescript import { SequentialClient } from 'planner-mcp/clients'; const sequential = new SequentialClient({ baseURL: 'http://sequential:3002', thinkingMode: 'deep', maxSteps: 20 }); const analysis = await sequential.analyzeRequirements(requirements); ``` #### Context7 MCP Client Best practices and pattern recommendations. ```typescript import { Context7Client } from 'planner-mcp/clients'; const context7 = new Context7Client({ baseURL: 'http://context7:3003', knowledgeBase: 'latest' }); const bestPractices = await context7.getBestPractices(domain); ``` #### TodoList MCP Client Task management and execution planning. ```typescript import { TodoListClient } from 'planner-mcp/clients'; const todolist = new TodoListClient({ baseURL: 'http://todolist:3004', tracking: true }); const executionPlan = await todolist.createExecutionPlan(tasks); ``` ## Error Handling ### Structured Error System Comprehensive error handling with typed errors. ```typescript import { ValidationError, AuthenticationError, InfrastructureError, MCPConnectionError } from 'planner-mcp/errors'; try { const plan = await orchestrator.createPlan(request); } catch (error) { if (error instanceof ValidationError) { console.log('Validation failed:', error.validationResults); } else if (error instanceof MCPConnectionError) { console.log('MCP server unavailable:', error.serverName); } else { console.log('Unexpected error:', error.message); } } ``` **Error Categories:** - **ValidationError** - Plan validation failures - **AuthenticationError** - Authentication/authorization failures - **InfrastructureError** - System infrastructure issues - **MCPConnectionError** - MCP server connectivity problems - **ConfigurationError** - Configuration and setup issues ### Error Recovery Automatic error recovery and fallback strategies. ```typescript import { ErrorRecoveryManager } from 'planner-mcp/recovery'; const recovery = new ErrorRecoveryManager({ strategies: ['retry', 'fallback', 'circuit_breaker'], maxRetries: 3, backoff: 'exponential' }); ``` ## Performance Guidelines ### Optimization Best Practices 1. **Use Caching Effectively** ```typescript // Cache frequently accessed data const cached = await cache.get(key) || await expensive_operation(); ``` 2. **Implement Circuit Breakers** ```typescript // Prevent cascade failures const circuitBreaker = new CircuitBreaker(service, { timeout: 3000, errorThresholdPercentage: 50 }); ``` 3. **Monitor Performance Metrics** ```typescript // Track key performance indicators metrics.timing('plan.generation.duration', duration); metrics.increment('plan.generation.success'); ``` ### Performance Targets | Metric | Target | Monitoring | |--------|--------|------------| | **Response Time (P95)** | < 2 seconds | Real-time | | **Error Rate** | < 1% | Real-time | | **Availability** | > 99.9% | 24/7 | | **Throughput** | > 1000 req/min | Real-time | | **Quality Score** | > 85 average | Daily | ## Configuration ### Environment Configuration Comprehensive configuration management. ```typescript import { ConfigManager } from 'planner-mcp/config'; const config = new ConfigManager({ sources: ['env', 'file', 'vault'], validation: true, encryption: true }); // Access configuration const dbConfig = config.get('database'); const mcpServers = config.get('mcp.servers'); ``` ### Feature Flags Dynamic feature management and A/B testing. ```typescript import { FeatureFlags } from 'planner-mcp/features'; const features = new FeatureFlags({ provider: 'launchdarkly', fallbacks: true }); if (await features.isEnabled('enhanced-validation', userId)) { // Use enhanced validation } ``` ## Support and Community ### Getting Help - **Documentation**: [https://docs.planner-mcp.example.com](https://docs.planner-mcp.example.com) - **GitHub Issues**: [https://github.com/company/planner-mcp/issues](https://github.com/company/planner-mcp/issues) - **Community Forum**: [https://community.planner-mcp.example.com](https://community.planner-mcp.example.com) - **Stack Overflow**: Tag `planner-mcp` ### Contributing We welcome contributions! Please see our [Contributing Guide](../CONTRIBUTING.md) for details. ### License This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details. --- **Generated**: {current_date} **Version**: 1.0.0 **Coverage**: 90%+ of public APIs documented