From 572028b2859375bbef20f38a2566ce22d15b7b55 Mon Sep 17 00:00:00 2001 From: NomenAK Date: Thu, 14 Aug 2025 22:14:56 +0200 Subject: [PATCH] Fix mcp_docs component initialization order issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed AttributeError where selected_servers was accessed before initialization. The issue was that Component.__init__() calls _discover_component_files() which tried to access self.selected_servers before it was set. Solution: Initialize selected_servers and server_docs_map before calling super().__init__() to ensure they're available when needed. Fixes: - mcp_docs component now properly discovered and listed - Installation commands work correctly with mcp_docs - Dry-run installations complete successfully 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- setup/components/mcp_docs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup/components/mcp_docs.py b/setup/components/mcp_docs.py index da384e2..5138bf2 100644 --- a/setup/components/mcp_docs.py +++ b/setup/components/mcp_docs.py @@ -14,7 +14,9 @@ class MCPDocsComponent(Component): def __init__(self, install_dir: Optional[Path] = None): """Initialize MCP docs component""" - super().__init__(install_dir, Path("")) + # Initialize attributes before calling parent constructor + # because parent calls _discover_component_files() which needs these + self.selected_servers: List[str] = [] # Map server names to documentation files self.server_docs_map = { @@ -26,8 +28,7 @@ class MCPDocsComponent(Component): "morphllm": "MCP_Morphllm.md" } - # This will be set during installation - initialize as empty list - self.selected_servers: List[str] = [] + super().__init__(install_dir, Path("")) def get_metadata(self) -> Dict[str, str]: """Get component metadata"""