From 43112779e1e58d7f48ba8ccbb64d3645e3f666a3 Mon Sep 17 00:00:00 2001 From: Mithun Gowda B Date: Mon, 15 Sep 2025 13:26:08 +0530 Subject: [PATCH] Update mcp.py Fixed Signed-off-by: Mithun Gowda B --- setup/components/mcp.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/setup/components/mcp.py b/setup/components/mcp.py index 18b891b..dea2c11 100644 --- a/setup/components/mcp.py +++ b/setup/components/mcp.py @@ -52,7 +52,8 @@ class MCPComponent(Component): "name": "serena", "description": "Semantic code analysis and intelligent editing", "install_method": "uv", - "install_command": "uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project $(pwd)", + "install_command": "uv tool install --from git+https://github.com/oraios/serena serena", + "run_command": "serena start-mcp-server --context ide-assistant --project $(pwd)", "required": False }, "morphllm": { @@ -63,7 +64,6 @@ class MCPComponent(Component): "api_key_env": "MORPH_API_KEY", "api_key_description": "Morph API key for Fast Apply" } - } def get_metadata(self) -> Dict[str, str]: @@ -169,10 +169,14 @@ class MCPComponent(Component): """Install a single MCP server using uv""" server_name = server_info["name"] install_command = server_info.get("install_command") + run_command = server_info.get("run_command") if not install_command: self.logger.error(f"No install_command found for uv-based server {server_name}") return False + if not run_command: + self.logger.error(f"No run_command found for uv-based server {server_name}") + return False try: self.logger.info(f"Installing MCP server using uv: {server_name}") @@ -183,11 +187,11 @@ class MCPComponent(Component): if config.get("dry_run"): self.logger.info(f"Would install MCP server (user scope): {install_command}") + self.logger.info(f"Would register MCP server run command: {run_command}") return True + # Run install command (non-blocking) self.logger.debug(f"Running: {install_command}") - - cmd_parts = shlex.split(install_command) result = subprocess.run( cmd_parts, @@ -199,12 +203,10 @@ class MCPComponent(Component): if result.returncode == 0: self.logger.success(f"Successfully installed MCP server (user scope): {server_name}") - run_command = install_command self.logger.info(f"Registering {server_name} with Claude CLI. Run command: {run_command}") - reg_result = subprocess.run( - ["claude", "mcp", "add", "-s", "user", "--", server_name] + run_command.split(), + ["claude", "mcp", "add", "-s", "user", "--", server_name] + shlex.split(run_command), capture_output=True, text=True, timeout=120, @@ -472,13 +474,7 @@ class MCPComponent(Component): self.settings_manager.save_metadata(metadata) self.logger.info("Removed MCP component from metadata") except Exception as e: - self.logger.warning(f"Could not update metadata: {e}") - - self.logger.success(f"MCP component uninstalled ({uninstalled_count} servers removed)") - return True - - except Exception as e: - self.logger.exception(f"Unexpected error during MCP uninstallation: {e}") + self.logger.exception(f"Unexpected error during MCP uninstallation: {e}") return False def get_dependencies(self) -> List[str]: