Skip to content

The agent that grows with you

feat(desktop): after a plugin install, offer "Connect now" for its MCP servers instead of a gateway restart (#119349)

Siddharth Balyan834580309d76
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
index 5ad620907a2..44422b0edcd 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.test.tsx
@@ -191,4 +191,65 @@ describe('Install from Git entry flow', () => {
)
)
})
+
+ it('offers Connect now for deferred MCP servers and reloads them on click', async () => {
+ const { $notifications, dismissNotification } = await import('@/store/notifications')
+ probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: false, warnings: [] })
+ requestGateway.mockImplementation(async (method: string, params?: { action?: unknown }) => {
+ if (method === 'plugins.manage' && params?.action === 'install') {
+ return {
+ ok: true,
+ plugin_name: 'nvidia-app',
+ plugins: [],
+ gateway_reloaded: true,
+ activation: { deferred: { mcp_servers: ['nvidia-app'] } }
+ }
+ }
+
+ return { plugins: [] }
+ })
+ renderFlow()
+ act(() => openPluginInstallRequest({ repo: 'https://github.com/example/nvidia-app' }))
+ fireEvent.click(await screen.findByRole('button', { name: 'Install' }))
+
+ await waitFor(() => {
+ const toast = $notifications.get().find(item => item.action?.label === 'Connect now')
+ expect(toast).toBeTruthy()
+ expect(toast?.message).toBe('nvidia-app installed. Its MCP server is not connected yet.')
+ })
+
+ const toast = $notifications.get().find(item => item.action?.label === 'Connect now')
+ toast?.action?.onClick()
+
+ await waitFor(() =>
+ expect(requestGateway).toHaveBeenCalledWith('reload.mcp', expect.objectContaining({ confirm: true }))
+ )
+ await waitFor(() => expect(requestGateway).toHaveBeenCalledWith('plugins.manage', { action: 'list' }))
+
+ for (const item of $notifications.get()) {
+ dismissNotification(item.id)
+ }
+ })
+
+ it('still offers the gateway restart when the install reports no activation', async () => {
+ const { $notifications, dismissNotification } = await import('@/store/notifications')
+ probePluginRepo.mockResolvedValue({ ok: true, agent: true, desktop: false, warnings: [] })
+ requestGateway.mockImplementation(async method =>
+ method === 'plugins.manage' ? { ok: true, plugin_name: 'plugin', plugins: [] } : { plugins: [] }
+ )
+ renderFlow()
+ act(() => openPluginInstallRequest({ repo: 'https://github.com/example/plugin' }))
+ fireEvent.click(await screen.findByRole('button', { name: 'Install' }))
+
+ await waitFor(() => {
+ const toast = $notifications.get().find(item => item.action?.label === 'Restart gateway')
+ expect(toast).toBeTruthy()
+ expect(toast?.message).toBe('Restart the gateway for the plugin to take effect.')
+ })
+ expect($notifications.get().some(item => item.action?.label === 'Connect now')).toBe(false)
+
+ for (const item of $notifications.get()) {
+ dismissNotification(item.id)
+ }
+ })
})
diff --git a/apps/desktop/src/app/settings/plugin-install-modal.tsx b/apps/desktop/src/app/settings/plugin-install-modal.tsx
index 355cf742697..991990cb05b 100644
--- a/apps/desktop/src/app/settings/plugin-install-modal.tsx
+++ b/apps/desktop/src/app/settings/plugin-install-modal.tsx
@@ -24,7 +24,7 @@ import { ExternalLink } from '@/lib/external-link'
import { AlertTriangle } from '@/lib/icons'
import { resolvePluginSourceLinks } from '@/lib/plugin-source-urls'
import { COMMIT_SHA_RE, installAgentPlugin, loadAgentPlugins } from '@/store/agent-plugins'
-import { notify } from '@/store/notifications'
+import { notify, notifyError } from '@/store/notifications'
import {
$pluginInstallRequest,
closePluginInstallRequest,
@@ -32,7 +32,7 @@ import {
type PluginInstallRequest
} from '@/store/plugin-install-request'
import { $activeGatewayProfile, $profiles, $profileScope, normalizeProfileKey, profileLabel } from '@/store/profile'
-import { $connection } from '@/store/session'
+import { $activeSessionId, $connection } from '@/store/session'
import { runGatewayRestart } from '@/store/system-actions'
type ProbeResult = Awaited<ReturnType<NonNullable<NonNullable<Window['hermesDesktop']>['probePluginRepo']>>>
@@ -207,6 +207,9 @@ export function PluginInstallModal() {
const errors: string[] = []
const successes: string[] = []
let agentInstalled = false
+ let deferredMcpServers: string[] = []
+ let gatewayReloaded = false
+ let agentPluginName = ''
try {
if (installAgent && probe.agent) {
@@ -222,6 +225,9 @@ export function PluginInstallModal() {
if (result.ok) {
successes.push(m.agentSuccess(result.pluginName ?? request.repo))
agentInstalled = true
+ deferredMcpServers = result.deferredMcpServers
+ gatewayReloaded = result.gatewayReloaded
+ agentPluginName = result.pluginName ?? request.repo
if (result.missingEnv?.length) {
const firstVar = result.missingEnv[0]
@@ -284,14 +290,42 @@ export function PluginInstallModal() {
notify({ kind: 'success', message })
}
- // An enabled agent plugin only takes effect after a gateway restart —
- // offer the restart right here instead of a dim hint to run later.
+ // The right follow-up depends on what the backend says is live now:
+ // deferred MCP servers can be connected in place (reload.mcp), an
+ // already-reloaded gateway needs nothing, and only a plugin the
+ // gateway did not pick up still needs the restart.
if (agentInstalled && enableAgent) {
- notify({
- kind: 'success',
- message: m.restartToApply,
- action: { label: m.restartNow, onClick: () => void runGatewayRestart() }
- })
+ if (deferredMcpServers.length > 0) {
+ notify({
+ kind: 'success',
+ message: m.connectServers(agentPluginName, deferredMcpServers.length),
+ meta: m.connectSub,
+ action: {
+ label: m.connectNow,
+ onClick: () => {
+ void (async () => {
+ try {
+ await requestGateway('reload.mcp', {
+ confirm: true,
+ session_id: $activeSessionId.get() ?? undefined
+ })
+ await loadAgentPlugins(requestGateway, targetProfile)
+ } catch (err) {
+ notifyError(err, m.connectFailed)
+ }
+ })()
+ }
+ }
+ })
+ } else if (gatewayReloaded) {
+ notify({ kind: 'success', message: m.liveNow(agentPluginName) })
+ } else {
+ notify({
+ kind: 'success',
+ message: m.restartToApply,
+ action: { label: m.restartNow, onClick: () => void runGatewayRestart() }
+ })
+ }
}
closePluginInstallRequest()
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index bfc050225a5..8634a22d43e 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -528,7 +528,17 @@ export const ar = defineLocale({
disable: 'تعطيل',
failed: 'فشل',
empty: 'لا توجد إضافات سطح مكتب مثبتة بعد.',
- kinds: { bundled: 'مضمّنة', disk: 'على القرص', runtime: 'وقت التشغيل' }
+ kinds: { bundled: 'مضمّنة', disk: 'على القرص', runtime: 'وقت التشغيل' },
+ installModal: {
+ connectServers: (name, n) =>
+ n === 1
+ ? `تم تثبيت ${name}. خادم MCP الخاص به لم يتصل بعد.`
+ : `تم تثبيت ${name}. خوادم MCP ال${n} الخاصة به لم تتصل بعد.`,
+ connectNow: 'الاتصال الآن',
+ connectSub: 'الدردشات المفتوحة تعيد إرسال سياقها',
+ connectFailed: 'تعذر الاتصال بخوادم MCP الخاصة بالإضافة.',
+ liveNow: name => `تم تثبيت ${name} وهو مفعّل.`
+ }
},
notifications: {
title: 'الإشعارات',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index f1ea300b63a..5ba67d7d913 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -850,6 +850,14 @@ export const en: Translations = {
'This entry was human-reviewed at its pinned commit. You can still inspect the exact code below.',
restartToApply: 'Restart the gateway for the plugin to take effect.',
restartNow: 'Restart gateway',
+ connectServers: (name, n) =>
+ n === 1
+ ? `${name} installed. Its MCP server is not connected yet.`
+ : `${name} installed. Its ${n} MCP servers are not connected yet.`,
+ connectNow: 'Connect now',
+ connectSub: 'Open chats re-send their context',
+ connectFailed: 'Could not connect the plugin’s MCP servers.',
+ liveNow: name => `${name} installed and active.`,
missingEnvAction: 'Set it up',
alreadyInstalled: (name: string) => `${name} is already installed.`,
desktopTarget: "Installs into this app's local desktop-plugins folder",
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index d1841e290a5..93da3183762 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -361,7 +361,15 @@ export const ja = defineLocale({
installModal: {
installFromGit: 'Git からインストール',
reviewRepository: 'リポジトリを確認',
- repoPlaceholder: 'https://github.com/owner/repo'
+ repoPlaceholder: 'https://github.com/owner/repo',
+ connectServers: (name, n) =>
+ n === 1
+ ? `${name} をインストールしました。その MCP サーバーはまだ接続されていません。`
+ : `${name} をインストールしました。${n} 個の MCP サーバーはまだ接続されていません。`,
+ connectNow: '今すぐ接続',
+ connectSub: '開いているチャットはコンテキストを再送します',
+ connectFailed: 'プラグインの MCP サーバーに接続できませんでした。',
+ liveNow: name => `${name} はインストールされ、有効です。`
}
},
closeSettings: '設定を閉じる',
diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.ts
index 29bd3d24ed1..e1d338facd9 100644
--- a/apps/desktop/src/i18n/ru.ts
+++ b/apps/desktop/src/i18n/ru.ts
@@ -533,7 +533,15 @@ export const ru = defineLocale({
desktopSuccess: name => `Плагин приложения ${name} установлен`,
agentFailed: 'Не удалось установить плагин агента',
desktopFailed: 'Не удалось установить плагин приложения',
- missingEnv: (_name, vars) => `Не хватает переменных окружения: ${vars}. Добавьте их в Настройки → Ключи.`
+ missingEnv: (_name, vars) => `Не хватает переменных окружения: ${vars}. Добавьте их в Настройки → Ключи.`,
+ connectServers: (name, n) =>
+ n === 1
+ ? `${name} установлен. Его MCP-сервер ещё не подключён.`
+ : `${name} установлен. Его ${n} MCP-сервера ещё не подключены.`,
+ connectNow: 'Подключить сейчас',
+ connectSub: 'Открытые чаты повторно отправят свой контекст',
+ connectFailed: 'Не удалось подключить MCP-серверы плагина.',
+ liveNow: name => `${name} установлен и активен.`
}
},
notifications: {
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 1ea4fa38e12..b558eb59dd7 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -715,6 +715,11 @@ export interface Translations {
reviewedIntro: string
restartToApply: string
restartNow: string
+ connectServers: (name: string, n: number) => string
+ connectNow: string
+ connectSub: string
+ connectFailed: string
+ liveNow: (name: string) => string
missingEnvAction: string
alreadyInstalled: (name: string) => string
desktopTarget: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 8baf0db46bc..7e067074726 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -352,7 +352,13 @@ export const zhHant = defineLocale({
installModal: {
installFromGit: '從 Git 安裝',
reviewRepository: '檢查儲存庫',
- repoPlaceholder: 'https://github.com/owner/repo'
+ repoPlaceholder: 'https://github.com/owner/repo',
+ connectServers: (name, n) =>
+ n === 1 ? `${name} 已安裝。其 MCP 伺服器尚未連線。` : `${name} 已安裝。其 ${n} 個 MCP 伺服器尚未連線。`,
+ connectNow: '立即連線',
+ connectSub: '開啟的聊天會重新傳送其上下文',
+ connectFailed: '無法連線該外掛的 MCP 伺服器。',
+ liveNow: name => `${name} 已安裝並生效。`
}
},
closeSettings: '關閉設定',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index a7f674cec89..923382a92f3 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -632,6 +632,12 @@ export const zh = defineLocale({
reviewedIntro: '此条目已在其固定提交处经过人工审核。你仍可在下方检查确切代码。',
restartToApply: '重启网关后插件才会生效。',
restartNow: '重启网关',
+ connectServers: (name, n) =>
+ n === 1 ? `${name} 已安装。其 MCP 服务器尚未连接。` : `${name} 已安装。其 ${n} 个 MCP 服务器尚未连接。`,
+ connectNow: '立即连接',
+ connectSub: '打开的聊天会重新发送其上下文',
+ connectFailed: '无法连接该插件的 MCP 服务器。',
+ liveNow: name => `${name} 已安装并生效。`,
missingEnvAction: '去设置',
alreadyInstalled: (name: string) => `${name} 已安装。`,
desktopTarget: '安装到此应用的本地 desktop-plugins 文件夹',
diff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.ts
index 31526e8b359..6c1add57820 100644
--- a/apps/desktop/src/store/agent-plugins.ts
+++ b/apps/desktop/src/store/agent-plugins.ts
@@ -241,6 +241,10 @@ export interface AgentPluginInstallResult {
warnings?: string[]
missingEnv?: string[]
error?: string
+ /** Plugin MCP servers not connected yet (`activation.deferred.mcp_servers`). */
+ deferredMcpServers: string[]
+ /** A running gateway already re-wired the plugin's handlers. */
+ gatewayReloaded: boolean
}
export async function installAgentPlugin(
@@ -264,6 +268,8 @@ export async function installAgentPlugin(
plugin_name?: string
warnings?: string[]
missing_env?: string[]
+ activation?: { activated_now?: Record<string, string[]>; deferred?: Record<string, string[]> } | null
+ gateway_reloaded?: boolean
error?: string
}>(
'plugins.manage',
@@ -281,17 +287,19 @@ export async function installAgentPlugin(
)
if (!result?.ok) {
- return { ok: false, error: result?.error || 'Install failed' }
+ return { ok: false, error: result?.error || 'Install failed', deferredMcpServers: [], gatewayReloaded: false }
}
return {
ok: true,
pluginName: result.plugin_name,
warnings: result.warnings,
- missingEnv: result.missing_env
+ missingEnv: result.missing_env,
+ deferredMcpServers: result.activation?.deferred?.mcp_servers ?? [],
+ gatewayReloaded: Boolean(result.gateway_reloaded)
}
} catch (e) {
- return { ok: false, error: e instanceof Error ? e.message : String(e) }
+ return { ok: false, error: e instanceof Error ? e.message : String(e), deferredMcpServers: [], gatewayReloaded: false }
}
}