From 24237c25b91b5650f84c0efe1ffdaee5d7acb41c Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Fri, 24 Oct 2025 18:41:26 +0100 Subject: [PATCH] Fix MCP server status parsing to match API response - Map server status values correctly: connected -> running, disabled -> stopped, failed -> error - Remove array parsing logic as API returns Record - Fixes incorrect MCP server status display in instance welcome view --- src/components/instance-welcome-view.tsx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/instance-welcome-view.tsx b/src/components/instance-welcome-view.tsx index 13de505d..a2128a12 100644 --- a/src/components/instance-welcome-view.tsx +++ b/src/components/instance-welcome-view.tsx @@ -182,19 +182,23 @@ const InstanceWelcomeView: Component = (props) => { if (!status || typeof status !== "object") return [] try { - if (Array.isArray(status)) { - return status.map((s) => ({ - name: s.name || "Unknown", - status: s.status || "stopped", - })) - } + const obj = status as Record + return Object.entries(obj).map(([name, statusValue]) => { + let mappedStatus: "running" | "stopped" | "error" + + if (statusValue === "connected") { + mappedStatus = "running" + } else if (statusValue === "disabled") { + mappedStatus = "stopped" + } else if (statusValue === "failed") { + mappedStatus = "error" + } else { + mappedStatus = "stopped" + } - const obj = status as Record - return Object.entries(obj).map(([name, data]) => { - const serverData = data as { status?: string } return { name, - status: (serverData?.status as "running" | "stopped" | "error") || "stopped", + status: mappedStatus, } }) } catch {