#!/usr/bin/env python3 """ Essential Files Analysis for Enhanced MCP Tools This script analyzes which files are absolutely essential vs optional. """ import os from pathlib import Path def analyze_essential_files(): """Analyze which files are essential for running the server""" print("šŸ“¦ Enhanced MCP Tools - Essential Files Analysis") print("=" * 60) enhanced_mcp_dir = Path("enhanced_mcp") # Core Infrastructure (ABSOLUTELY ESSENTIAL) core_essential = [ "enhanced_mcp/__init__.py", "enhanced_mcp/base.py", "enhanced_mcp/mcp_server.py", ] print("\nšŸ”“ ABSOLUTELY ESSENTIAL (Core Infrastructure):") print("-" * 50) for file_path in core_essential: if os.path.exists(file_path): size = os.path.getsize(file_path) print(f"āœ… {file_path:<35} ({size:,} bytes)") else: print(f"āŒ {file_path:<35} (MISSING!)") # Currently Required (due to imports in mcp_server.py) currently_required = [ "enhanced_mcp/diff_patch.py", "enhanced_mcp/intelligent_completion.py", "enhanced_mcp/asciinema_integration.py", "enhanced_mcp/sneller_analytics.py", "enhanced_mcp/git_integration.py", "enhanced_mcp/file_operations.py", "enhanced_mcp/archive_compression.py", "enhanced_mcp/workflow_tools.py", ] print("\n🟔 CURRENTLY REQUIRED (due to imports):") print("-" * 50) total_size = 0 for file_path in currently_required: if os.path.exists(file_path): size = os.path.getsize(file_path) total_size += size print(f"āœ… {file_path:<35} ({size:,} bytes)") else: print(f"āŒ {file_path:<35} (MISSING!)") print(f"\nTotal size of ALL modules: {total_size:,} bytes") # Potentially Optional (could be made optional with refactoring) potentially_optional = [ ("asciinema_integration.py", "Terminal recording - specialized use case"), ("sneller_analytics.py", "High-performance SQL - specialized use case"), ("archive_compression.py", "Archive operations - can use standard tools"), ("diff_patch.py", "Diff/patch - basic functionality, could be optional"), ] print("\n🟢 POTENTIALLY OPTIONAL (with refactoring):") print("-" * 50) for filename, description in potentially_optional: file_path = f"enhanced_mcp/{filename}" if os.path.exists(file_path): size = os.path.getsize(file_path) print(f"šŸ”„ {filename:<35} - {description}") print(f" {file_path:<35} ({size:,} bytes)") # Most Essential Core most_essential = [ ("intelligent_completion.py", "AI-powered tool recommendations - core feature"), ("git_integration.py", "Git operations - fundamental for development"), ("file_operations.py", "File operations - basic functionality"), ("workflow_tools.py", "Development workflow - essential utilities"), ] print("\nšŸ”„ MOST ESSENTIAL (beyond core infrastructure):") print("-" * 50) essential_size = 0 for filename, description in most_essential: file_path = f"enhanced_mcp/{filename}" if os.path.exists(file_path): size = os.path.getsize(file_path) essential_size += size print(f"⭐ {filename:<35} - {description}") print(f" {file_path:<35} ({size:,} bytes)") # Calculate minimal vs full core_size = sum(os.path.getsize(f) for f in core_essential if os.path.exists(f)) print("\nšŸ“Š SIZE ANALYSIS:") print("-" * 50) print(f"Core Infrastructure Only: {core_size:,} bytes") print(f"Minimal Essential: {core_size + essential_size:,} bytes") print(f"Full System (Current): {core_size + total_size:,} bytes") return { "core_essential": core_essential, "currently_required": currently_required, "most_essential": [f"enhanced_mcp/{f}" for f, _ in most_essential], "potentially_optional": [f"enhanced_mcp/{f}" for f, _ in potentially_optional], } def show_minimal_server_example(): """Show how to create a minimal server""" print("\nšŸš€ MINIMAL SERVER EXAMPLE:") print("-" * 50) minimal_example = ''' # minimal_mcp_server.py - Example of absolute minimum files needed from enhanced_mcp.base import * from enhanced_mcp.intelligent_completion import IntelligentCompletion from enhanced_mcp.git_integration import GitIntegration from enhanced_mcp.file_operations import EnhancedFileOperations class MinimalMCPServer(MCPMixin): """Minimal MCP server with only essential tools""" def __init__(self, name: str = "Minimal MCP Server"): super().__init__() self.name = name # Only the most essential tools self.completion = IntelligentCompletion() # AI recommendations self.git = GitIntegration() # Git operations self.file_ops = EnhancedFileOperations() # File operations self.tools = { 'completion': self.completion, 'git': self.git, 'file_ops': self.file_ops } def create_minimal_server(): server = FastMCP("Minimal Enhanced MCP") tool_server = MinimalMCPServer() server.include_router(tool_server, prefix="tools") return server if __name__ == "__main__": server = create_minimal_server() server.run() ''' print(minimal_example) if __name__ == "__main__": os.chdir("/home/rpm/claude/enhanced-mcp-tools") results = analyze_essential_files() show_minimal_server_example() print("\nšŸŽÆ SUMMARY:") print("=" * 60) print("āœ… ABSOLUTE MINIMUM to run ANY server:") for f in results["core_essential"]: print(f" - {f}") print("\nāœ… PRACTICAL MINIMUM for useful server:") for f in results["most_essential"]: print(f" - {f}") print("\nšŸ”„ CURRENTLY ALL REQUIRED due to mcp_server.py imports:") print(" - All 11 modules are imported and instantiated") print("\nšŸ’” TO MAKE MODULES OPTIONAL:") print(" - Refactor mcp_server.py to use conditional imports") print(" - Add configuration to enable/disable modules") print(" - Use dependency injection pattern")