feat(ui): show which Agents load an enabled global MCP server in a project

A project's MCP tab only showed Agent logos for a global server that was
turned off, so an enabled row gave no hint of where the server loads.
Enabled rows now show the Agents the global server is written to; a row
overridden by a project server of the same name shows none.

Closes #677
This commit is contained in:
Willie
2026-10-31 17:32:58 +08:00
parent 78a8dc7c0d
commit cc4c9e436b
12 changed files with 18 additions and 4 deletions
+7 -4
View File
@@ -204,7 +204,7 @@ export default function MCPProjectView({ data, root, offered, onChanged, onRemov
const entry = servers[n];
const off = Boolean(entry?.disabled);
const to = switchable(server);
// Off shows as Agent logos. A sentence is kept for the switch that cannot be used, which needs a reason.
// Agent logos say where it applies. A sentence is kept for the switch that cannot be used, which needs a reason.
const written = (entry?.targets ?? to).filter((x) => mcpOffTargets.includes(x));
const reason = entry && !off ? t('mcp.projects.overridden')
: off ? (written.length === 0 ? t('mcp.projects.noSwitchHere') : '')
@@ -215,6 +215,9 @@ export default function MCPProjectView({ data, root, offered, onChanged, onRemov
// loading the server here, and a list saved with the entry does not follow the project.
const stillOn = off ? targets.filter((x) => (server.targets ?? defaults).includes(x) && !written.includes(x)) : [];
const stale = off && entry.targets && [...entry.targets].sort().join() !== [...to].sort().join();
// Off shows where the switch turns it off; on shows every Agent the global server loads in.
const icons = off ? written : entry ? [] : server.targets ?? defaults;
const iconsLabel = t(off ? 'mcp.projects.offIn' : 'mcp.projects.onIn', { targets: icons.map(targetLabel).join(', ') });
return (
<div key={n} className="ss-r !items-stretch !flex-col !gap-2 !py-3">
<span className="flex min-w-0 items-center gap-2">
@@ -222,9 +225,9 @@ export default function MCPProjectView({ data, root, offered, onChanged, onRemov
{off && <span className="ss-tag warn">{t('mcp.projects.offBadge')}</span>}
{changes.some((c) => c.name === n && writes(c)) && <span className="ss-tag warn">{t('plugins.pending')}</span>}
<span className="min-w-0 flex-1 truncate font-mono text-xs text-ink-3">{describeEndpoint(server)}</span>
{off && written.length > 0 && (
<span className="ss-stack" role="img" aria-label={t('mcp.projects.offIn', { targets: written.map(targetLabel).join(', ') })} title={t('mcp.projects.offIn', { targets: written.map(targetLabel).join(', ') })}>
{written.map((x) => <span key={x} className="ss-at"><AgentIcon target={x} size={13} /></span>)}
{icons.length > 0 && (
<span className="ss-stack" role="img" aria-label={iconsLabel} title={iconsLabel}>
{icons.map((x) => <span key={x} className="ss-at"><AgentIcon target={x} size={13} /></span>)}
</span>
)}
<button type="button" role="switch" aria-checked={!off} aria-label={n} aria-describedby={`mcp-sw-${n}`} className={`ss-sw ${off ? '' : 'on'} disabled:opacity-50`} disabled={busy || (!off && to.length === 0) || Boolean(entry && !off)} onClick={() => void toggleGlobal(n, off)}><i /></button>
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "Keine Server nur in diesem Projekt.",
"mcp.projects.offBadge": "hier aus",
"mcp.projects.offIn": "Aus in {targets}",
"mcp.projects.onIn": "An in {targets}",
"mcp.projects.noSwitch": "Keiner seiner Agents hat einen Schalter pro Projekt.",
"mcp.projects.noSwitchHere": "Keiner der Agents dieses Projekts kann ihn hier ausschalten.",
"mcp.projects.stillOn": "Wird in {targets} weiter geladen, dort gibt es keinen Schalter pro Projekt.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "No servers only in this project.",
"mcp.projects.offBadge": "off here",
"mcp.projects.offIn": "Off in {targets}",
"mcp.projects.onIn": "On in {targets}",
"mcp.projects.noSwitch": "None of its Agents has a per-project switch.",
"mcp.projects.noSwitchHere": "None of the Agents this project uses can turn it off here.",
"mcp.projects.stillOn": "Still loads in {targets}, which has no per-project switch.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "No hay servidores solo en este proyecto.",
"mcp.projects.offBadge": "desactivado aquí",
"mcp.projects.offIn": "Desactivado en {targets}",
"mcp.projects.onIn": "Activado en {targets}",
"mcp.projects.noSwitch": "Ninguno de sus Agents tiene un interruptor por proyecto.",
"mcp.projects.noSwitchHere": "Ninguno de los Agents que usa este proyecto puede desactivarlo aquí.",
"mcp.projects.stillOn": "Se sigue cargando en {targets}, que no tiene interruptor por proyecto.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "هیچ سروری فقط در این پروژه نیست.",
"mcp.projects.offBadge": "اینجا خاموش",
"mcp.projects.offIn": "خاموش در {targets}",
"mcp.projects.onIn": "روشن در {targets}",
"mcp.projects.noSwitch": "هیچ‌کدام از Agentهایش کلید جداگانه برای هر پروژه ندارد.",
"mcp.projects.noSwitchHere": "هیچ‌کدام از Agentهای این پروژه نمی‌تواند آن را اینجا خاموش کند.",
"mcp.projects.stillOn": "همچنان در {targets} بارگذاری می‌شود، چون کلید جداگانه برای هر پروژه ندارد.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "Aucun serveur uniquement dans ce projet.",
"mcp.projects.offBadge": "désactivé ici",
"mcp.projects.offIn": "Désactivé dans {targets}",
"mcp.projects.onIn": "Activé dans {targets}",
"mcp.projects.noSwitch": "Aucun de ses Agents n'a d'interrupteur par projet.",
"mcp.projects.noSwitchHere": "Aucun des Agents utilisés par ce projet ne peut le désactiver ici.",
"mcp.projects.stillOn": "Reste chargé dans {targets}, qui n'a pas d'interrupteur par projet.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "Tidak ada server yang hanya di proyek ini.",
"mcp.projects.offBadge": "mati di sini",
"mcp.projects.offIn": "Mati di {targets}",
"mcp.projects.onIn": "Aktif di {targets}",
"mcp.projects.noSwitch": "Tidak ada Agent-nya yang punya sakelar per proyek.",
"mcp.projects.noSwitchHere": "Tidak ada Agent yang dipakai proyek ini yang bisa mematikannya di sini.",
"mcp.projects.stillOn": "Tetap dimuat di {targets}, yang tidak punya sakelar per proyek.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "このプロジェクトだけのサーバーはありません。",
"mcp.projects.offBadge": "ここではオフ",
"mcp.projects.offIn": "{targets} でオフ",
"mcp.projects.onIn": "{targets} でオン",
"mcp.projects.noSwitch": "どの Agent にもプロジェクト単位のスイッチがありません。",
"mcp.projects.noSwitchHere": "このプロジェクトで使う Agent には、ここでオフにできるものがありません。",
"mcp.projects.stillOn": "{targets} にはプロジェクト単位のスイッチがないため、ここでも読み込まれます。",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "이 프로젝트에만 있는 서버가 없습니다.",
"mcp.projects.offBadge": "여기서 꺼짐",
"mcp.projects.offIn": "{targets}에서 꺼짐",
"mcp.projects.onIn": "{targets}에서 켜짐",
"mcp.projects.noSwitch": "이 서버의 Agent 중 프로젝트별 스위치가 있는 것이 없습니다.",
"mcp.projects.noSwitchHere": "이 프로젝트에서 쓰는 Agent 중 여기서 끌 수 있는 것이 없습니다.",
"mcp.projects.stillOn": "{targets}에는 프로젝트별 스위치가 없어 여기서도 계속 로드됩니다.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "Nenhum servidor só neste projeto.",
"mcp.projects.offBadge": "desligado aqui",
"mcp.projects.offIn": "Desligado em {targets}",
"mcp.projects.onIn": "Ligado em {targets}",
"mcp.projects.noSwitch": "Nenhum dos Agents dele tem um interruptor por projeto.",
"mcp.projects.noSwitchHere": "Nenhum dos Agents que este projeto usa pode desligá-lo aqui.",
"mcp.projects.stillOn": "Continua carregando em {targets}, que não tem chave por projeto.",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "没有只在这个项目的服务器。",
"mcp.projects.offBadge": "这里关闭",
"mcp.projects.offIn": "已在 {targets} 关闭",
"mcp.projects.onIn": "已在 {targets} 启用",
"mcp.projects.noSwitch": "它的 Agent 都没有项目级的开关。",
"mcp.projects.noSwitchHere": "这个项目使用的 Agent 都无法在这里关掉它。",
"mcp.projects.stillOn": "{targets} 不支持项目级别的关闭,在这里仍会加载。",
+1
View File
@@ -2635,6 +2635,7 @@
"mcp.projects.noOnlyHere": "沒有只在這個專案的伺服器。",
"mcp.projects.offBadge": "這裡關閉",
"mcp.projects.offIn": "已在 {targets} 關閉",
"mcp.projects.onIn": "已在 {targets} 啟用",
"mcp.projects.noSwitch": "它的 Agent 都沒有專案層級的開關。",
"mcp.projects.noSwitchHere": "這個專案使用的 Agent 都無法在這裡關掉它。",
"mcp.projects.stillOn": "{targets} 不支援專案層級的關閉,在這裡仍會載入。",