From 3bd70b950808ccd4802b7074c7a11ef66bcd8586 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 12 Oct 2025 12:16:15 +0800 Subject: [PATCH] feat(mcp): add enabled count to panel info section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add enabledCount calculation using useMemo for performance - Display format: "X MCP server(s) configured · Y enabled" - Add i18n keys: mcp.enabledCount for zh and en - Real-time updates when toggling server enabled status --- src/components/mcp/McpPanel.tsx | 7 ++++++- src/i18n/locales/en.json | 1 + src/i18n/locales/zh.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/mcp/McpPanel.tsx b/src/components/mcp/McpPanel.tsx index 754efd4..c534bd1 100644 --- a/src/components/mcp/McpPanel.tsx +++ b/src/components/mcp/McpPanel.tsx @@ -166,6 +166,11 @@ const McpPanel: React.FC = ({ onClose, onNotify, appType }) => { [servers], ); + const enabledCount = useMemo( + () => serverEntries.filter(([_, server]) => server.enabled).length, + [serverEntries], + ); + const panelTitle = appType === "claude" ? t("mcp.claudeTitle") : t("mcp.codexTitle"); @@ -205,7 +210,7 @@ const McpPanel: React.FC = ({ onClose, onNotify, appType }) => { {/* Info Section */}
- {t("mcp.serverCount", { count: Object.keys(servers).length })} + {t("mcp.serverCount", { count: Object.keys(servers).length })} · {t("mcp.enabledCount", { count: enabledCount })}
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 4c36bbf..7dcecd3 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -275,6 +275,7 @@ "editCodexServer": "Edit Codex MCP", "configPath": "Config Path", "serverCount": "{{count}} MCP server(s) configured", + "enabledCount": "{{count}} enabled", "template": { "fetch": "Quick Template: mcp-fetch" }, diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 8988a19..b4a32cb 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -275,6 +275,7 @@ "editCodexServer": "编辑 Codex MCP", "configPath": "配置路径", "serverCount": "已配置 {{count}} 个 MCP 服务器", + "enabledCount": "已启用 {{count}} 个", "template": { "fetch": "快速模板:mcp-fetch" },