UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

292 lines 8.59 kB
#!/usr/bin/env node /** * MCP ADR Analysis Server * Main entry point for the Model Context Protocol server * * This server provides Tools, Resources, and Prompts for analyzing * Architectural Decision Records and project architecture. */ /** * Main server class */ export declare class McpAdrAnalysisServer { private server; private maskingConfig; private config; private logger; private kgManager; private stateReinforcementManager; private conversationMemoryManager; private memoryEntityManager; private rootManager; private contextGenerator; constructor(); /** * Validate configuration and project setup */ private validateConfiguration; /** * Public health check method for testing */ healthCheck(): Promise<void>; /** * Setup MCP protocol handlers * * @description Configures all Model Context Protocol request handlers for the ADR Analysis Server. * Implements the complete MCP specification including tools, resources, and prompts. * * @private * @since 2.0.0 * @category MCP Protocol */ private setupHandlers; /** * Tool implementations */ private checkAIExecutionStatus; private getWorkflowGuidance; private getDevelopmentGuidance; private analyzeProjectEcosystem; private getArchitecturalContext; private generateAdrsFromPrd; private compareAdrProgress; /** * Detect and validate environment context */ private detectAndValidateEnvironment; /** * Perform local ADR progress analysis without relying on AI execution */ private performLocalAdrProgressAnalysis; /** * Parse TODO.md content to extract tasks */ private parseTodoTasks; /** * Map TODO tasks to ADRs to identify alignment (now environment-aware) */ private mapTasksToAdrs; /** * Check file existence for completed tasks */ private performFileExistenceChecks; /** * Analyze code for mock vs production implementation */ private performMockVsProductionAnalysis; /** * Calculate environment-specific compliance score */ private calculateEnvironmentScore; /** * Perform environment compliance analysis */ private performEnvironmentComplianceAnalysis; /** * Analyze security compliance based on security level */ private analyzeSecurityCompliance; /** * Content masking tool implementations */ private analyzeContentSecurity; private generateContentMasking; private configureCustomPatterns; private applyBasicContentMasking; private validateContentMasking; private manageCache; private configureOutputMasking; /** * Helper method to get domains based on PRD type */ private getPrdTypeDomains; /** * Helper method to get domains for ecosystem analysis based on technology focus */ private getEcosystemAnalysisDomains; /** * Helper method to create base ADR generation prompt */ private createBaseAdrPrompt; /** * ADR suggestion tool implementations */ private suggestAdrs; private generateAdrFromDecision; private generateAdrBootstrap; private bootstrapValidationLoop; private discoverExistingAdrs; private analyzeAdrTimeline; private reviewExistingAdrs; /** * ADR validation tool implementations */ private validateAdr; private validateAllAdrs; /** * Research integration tool implementations */ private incorporateResearch; private createResearchTemplate; private requestActionConfirmation; /** * Rule generation and validation tool implementations */ private generateRules; private validateRules; private createRuleSet; /** * Environment analysis tool implementation */ private analyzeEnvironment; /** * Research question generation tool implementation */ private generateResearchQuestions; /** * Perform research tool implementation */ private performResearch; /** * Search codebase tool implementation */ private searchCodebase; /** * LLM web search tool implementation */ private llmWebSearch; /** * LLM cloud management tool implementation */ private llmCloudManagement; /** * LLM database management tool implementation */ private llmDatabaseManagement; /** * Deployment analysis tool implementation */ private analyzeDeploymentProgress; /** * Apply content masking to MCP response */ /** * Track memory operations performed by tools */ private trackMemoryOperations; /** * Extract memory operation details from tool execution */ private extractMemoryOperations; /** * Track tool execution in knowledge graph */ private trackToolExecution; private applyOutputMasking; /** * Enrich response with state reinforcement and apply masking * * Implements Phase 2 of context decay mitigation by injecting * context reminders every N turns or when response exceeds token threshold. * * Phase 3 extension: Records conversation turns to structured external memory. */ private enrichResponseWithStateReinforcement; /** * Read MCP resource with prompt-driven caching */ private readResource; /** * Start the server */ start(): Promise<void>; /** * File system tool implementations */ /** * List accessible roots (MCP best practice) */ private listRoots; /** * Read directory contents (MCP best practice for autonomous file discovery) */ private readDirectory; private readFile; private writeFile; private listDirectory; private generateDeploymentGuidance; private smartGitPush; private deploymentReadiness; private troubleshootGuidedWorkflow; private smartScore; private mcpPlanning; private memoryLoading; private expandAnalysisSection; private interactiveAdrPlanning; /** * Tool chain orchestrator implementation */ private toolChainOrchestrator; /** * Phase 3: Expand Memory Tool * Retrieves and expands stored content from tiered responses */ private expandMemory; /** * Phase 3: Query Conversation History Tool * Searches and retrieves conversation sessions */ private queryConversationHistory; /** * Phase 3: Get Conversation Snapshot Tool * Retrieves current conversation context */ private getConversationSnapshot; /** * Phase 3: Get Memory Statistics Tool * Retrieves conversation memory statistics */ private getMemoryStats; /** * Update Knowledge Tool (ADR-018) * Simple CRUD operations for knowledge graph */ private updateKnowledge; /** * Get Server Context Tool * Generates comprehensive server context file for LLM @ referencing */ private getServerContext; /** * Get Current Datetime Tool * Returns the current date and time in various formats for ADR generation and timestamping */ private getCurrentDatetime; /** * Set Project Path Tool - Dynamic Session Configuration * * @description Dynamically sets the active project path for the current session. * This allows switching between projects without restarting the server or modifying * environment variables. Updates both the config and the RootManager. * * @param args - Set project path arguments * @param args.path - Absolute path to the project directory * @param args.validatePath - Whether to validate the path exists (default: true) * @returns Promise<CallToolResult> - Confirmation of the path change */ private setProjectPath; /** * Load Prompt Tool - CE-MCP Phase 4 Lazy Loading * * @description Loads prompts on-demand instead of eagerly loading all prompts at startup. * This reduces token usage by ~96% (from 28K tokens to ~1K on-demand). * * @param args - Load prompt arguments * @param args.promptName - Name of the prompt to load * @param args.section - Optional section within the prompt * @param args.estimateOnly - If true, returns only token estimate * @returns Promise<CallToolResult> - Loaded prompt content or estimate */ private loadPrompt; } //# sourceMappingURL=index.d.ts.map