Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(apps): show an MCP list failure once
leonongoing03c526038094
diff --git a/src/components/McpServersPanel.hosted.test.ts b/src/components/McpServersPanel.hosted.test.tsindex 67fc5018f2..268effa08a 100644--- a/src/components/McpServersPanel.hosted.test.ts+++ b/src/components/McpServersPanel.hosted.test.ts@@ -322,6 +322,25 @@ describe("the Agentcard tile", () => {});});+describe("hosted MCP list availability", () => {+ it("shows one list error and restores app cards after retry", async () => {+ fixture.api.mockRejectedValueOnce(new Error("no route: GET /api/mcp/servers"));+ await mount();+ const alerts = [...host.querySelectorAll('[role="alert"]')];+ expect(alerts).toHaveLength(1);+ expect(alerts[0]!.textContent).toContain("Couldn't load MCP apps");+ expect(alerts[0]!.textContent).toContain("no route: GET /api/mcp/servers");+ expect(host.querySelector("[data-app-tile]")).toBeNull();+ const retry = [...host.querySelectorAll("button")].find((button) => button.textContent?.trim() === "Retry");+ expect(retry).toBeDefined();+ await act(async () => retry!.click());+ await settle();+ expect(host.querySelector('[role="alert"]')).toBeNull();+ expect(host.querySelectorAll("[data-app-tile]")).toHaveLength(HOSTED_MCP_APPS.length);+ expect(fixture.api.mock.calls.filter(([path]) => path === "/api/mcp/servers")).toHaveLength(2);+ });+});+describe("hiding a hosted card", () => {it("keeps it mounted and loads the servers once for every card", async () => {const [kept, ...others] = HOSTED_MCP_APPS;diff --git a/src/components/McpServersPanel.tsx b/src/components/McpServersPanel.tsxindex 9d750de69d..9e4e2b0313 100644--- a/src/components/McpServersPanel.tsx+++ b/src/components/McpServersPanel.tsx@@ -122,6 +122,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = faconst [editing, setEditing] = useState<string | "new" | null>(null);const [busy, setBusy] = useState<string | null>(null);const [error, setError] = useState<string | McpMessage | null>(null);+ const [loadError, setLoadError] = useState<string | null>(null);const [notice, setNotice] = useState<(McpMessage & { stateKey?: LocaleKey }) | null>(null);const [probe, setProbe] = useState<Record<string, ProbeResult>>({});const [signingIn, setSigningIn] = useState<string | null>(null);@@ -162,6 +163,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = faconst generation = ++loadGeneration.current;setBusy("load");setError(null);+ setLoadError(null);return api("/api/mcp/servers").then((result) => {if (generation === loadGeneration.current) {@@ -170,7 +172,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = fa}}).catch((cause) => {- if (generation === loadGeneration.current) setError(cause instanceof Error ? cause.message : String(cause));+ if (generation === loadGeneration.current) setLoadError(cause instanceof Error ? cause.message : String(cause));}).finally(() => {if (generation === loadGeneration.current) setBusy(null);@@ -622,6 +624,17 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = faif (hostedCards) {const own = hostedCards.ownServers;+ if (loadError !== null) {+ if (!own && !HOSTED_MCP_APPS.some((app) => hostedCards.shown(app.id))) return null;+ return (+ <div className="col-span-full flex min-w-0 flex-wrap items-center justify-between gap-2 rounded-lg bg-danger/10 px-3 py-2">+ <p role="alert" className="min-w-0 break-words text-[13px] text-danger">{t("mcp.loadAppsFailed", { reason: loadError })}</p>+ <button type="button" onClick={() => void load()} disabled={busy !== null} className="rounded-full bg-control px-3 py-1 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40">+ {t("connectors.action.retry")}+ </button>+ </div>+ );+ }return <>{HOSTED_MCP_APPS.map((app) => <div key={app.id} className={hostedCards.shown(app.id) ? "contents" : "hidden"}>{renderHostedCard(app)}</div>)}{own && servers?.filter((server) => server.enabled && ownMcpServer(server) && own.shown(server)).map((server) => renderOwnServer(server, own.manage))}@@ -629,6 +642,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = fa}const visibleServers = servers?.filter((server) => !hideHosted || ownMcpServer(server));+ const panelError = loadError ?? error;return (<section@@ -671,7 +685,7 @@ export function McpServersPanel({ embedded = false, hostedCards, hideHosted = fa<McpServerEditor key={`${editing}${fixingKeys ? ":keys" : ""}`} server={editingServer} fixKeys={fixingKeys} taken={(servers ?? []).map((server) => server.name)} team={Boolean(store.config?.team)}busy={busy !== null} onCancel={closeEditor} onSubmit={(items) => void (editing === "new" ? addServers(items) : saveEdit(items))} />)}- {error && <div role="alert" className="mt-3 rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger">{typeof error === "string" ? error : t(error.key, error.params)}</div>}+ {panelError && <div role="alert" className="mt-3 rounded-lg bg-danger/10 px-3 py-2 text-[12px] text-danger">{typeof panelError === "string" ? panelError : t(panelError.key, panelError.params)}</div>}{notice && <div role="status" className="mt-3 rounded-lg bg-success/10 px-3 py-2 text-[12px] text-success">{t(notice.key, {...notice.params,...(notice.stateKey ? { state: t(notice.stateKey) } : {}),diff --git a/src/locales/en.json b/src/locales/en.jsonindex 4ef63f36d0..28b0972c21 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -5804,6 +5804,7 @@"mcp.cancel": "Cancel","mcp.save": "Save","mcp.loading": "Loading MCP servers…",+ "mcp.loadAppsFailed": "Couldn't load MCP apps: {reason}","mcp.empty.title": "No custom MCP servers yet","mcp.empty.desc": "Add a trusted MCP server (a local command or a URL) to give your bots more tools.","mcp.badge.on": "On",