Revert "Fixed serena installation by add serena to claude directly (#357)"

This reverts commit 5bee15710f9f6545ca7d6b078269582c9cac8b8b.
This commit is contained in:
Mithun Gowda B 2025-09-14 19:00:11 +05:30 committed by GitHub
parent 5bee15710f
commit 1e5818acf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,8 +51,8 @@ class MCPComponent(Component):
"serena": { "serena": {
"name": "serena", "name": "serena",
"description": "Semantic code analysis and intelligent editing", "description": "Semantic code analysis and intelligent editing",
"mode": "uvx", "install_method": "uv",
"run_command": "uvx --from git+https://github.com/oraios/serena serena start-mcp-server --context ide-assistant --project $(pwd)", "install_command": "uvx --from git+https://github.com/oraios/serena",
"required": False "required": False
}, },
"morphllm": { "morphllm": {
@ -165,36 +165,63 @@ class MCPComponent(Component):
} }
} }
def _install_uvx_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool: def _install_uv_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool:
"""Install a single MCP server using uv""" """Install a single MCP server using uv"""
server_name = server_info["name"] server_name = server_info["name"]
run_command = server_info.get("run_command") install_command = server_info.get("install_command")
if not run_command:
self.logger.error(f"No run command found for uvx-based server {server_name}") if not install_command:
self.logger.error(f"No install_command found for uv-based server {server_name}")
return False return False
try: try:
self.logger.info(f"Installing MCP server using uv: {server_name}")
self.logger.success(f"Successfully installed MCP server (user scope): {server_name}") if self._check_mcp_server_installed(server_name):
self.logger.info(f"MCP server {server_name} already installed")
return True
self.logger.info(f"Registering {server_name} with Claude CLI. Run command: {run_command}") if config.get("dry_run"):
self.logger.info(f"Would install MCP server (user scope): {install_command}")
return True
reg_result = subprocess.run( self.logger.debug(f"Running: {install_command}")
["claude", "mcp", "add", "-s", "user", "--", server_name] + run_command.split(),
cmd_parts = shlex.split(install_command)
result = subprocess.run(
cmd_parts,
capture_output=True, capture_output=True,
text=True, text=True,
timeout=120, timeout=900, # 15 minutes
shell=(sys.platform == "win32") shell=(sys.platform == "win32")
) )
if reg_result.returncode == 0: if result.returncode == 0:
self.logger.success(f"Successfully registered {server_name} with Claude CLI.") self.logger.success(f"Successfully installed MCP server (user scope): {server_name}")
return True run_command = install_command
else:
error_msg = reg_result.stderr.strip() if reg_result.stderr else "Unknown error"
self.logger.error(f"Failed to register MCP server {server_name} with Claude CLI: {error_msg}")
return False
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(),
capture_output=True,
text=True,
timeout=120,
shell=(sys.platform == "win32")
)
if reg_result.returncode == 0:
self.logger.success(f"Successfully registered {server_name} with Claude CLI.")
return True
else:
error_msg = reg_result.stderr.strip() if reg_result.stderr else "Unknown error"
self.logger.error(f"Failed to register MCP server {server_name} with Claude CLI: {error_msg}")
return False
else:
error_msg = result.stderr.strip() if result.stderr else "Unknown error"
self.logger.error(f"Failed to install MCP server {server_name} using uv: {error_msg}\n{result.stdout}")
return False
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
self.logger.error(f"Timeout installing MCP server {server_name} using uv") self.logger.error(f"Timeout installing MCP server {server_name} using uv")
@ -228,8 +255,8 @@ class MCPComponent(Component):
def _install_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool: def _install_mcp_server(self, server_info: Dict[str, Any], config: Dict[str, Any]) -> bool:
"""Install a single MCP server""" """Install a single MCP server"""
if server_info.get("mode") == "uvx": if server_info.get("install_method") == "uv":
return self._install_uvx_mcp_server(server_info, config) return self._install_uv_mcp_server(server_info, config)
server_name = server_info["name"] server_name = server_info["name"]
npm_package = server_info.get("npm_package") npm_package = server_info.get("npm_package")