diff --git a/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.i18n.yaml b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.i18n.yaml
new file mode 100644
index 0000000000..5e56cbef74
--- /dev/null
+++ b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.i18n.yaml
@@ -0,0 +1,19 @@
+# Bilingual-pair consistency record for 2026-11-02-mcp-account-host-registry.md (docs/i18n/README.md): per heading
+# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
+# After editing either side, bring the other along and re-record with:
+# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.md
+/agent-note-host-registry-for-mcp-connector-accounts:
+ en: 6410b73bca8ec67f
+ zh: 458ad8ac28bb6f65
+/agent-note-host-registry-for-mcp-connector-accounts/problem:
+ en: 6ddb656d7fed5c6b
+ zh: 1215584848f5214c
+/agent-note-host-registry-for-mcp-connector-accounts/decision:
+ en: 2652049b45deb426
+ zh: 1e870763b05fffa2
+/agent-note-host-registry-for-mcp-connector-accounts/alternatives-considered:
+ en: b6fe7cc1b6c30770
+ zh: 3c524be7ad8d0195
+/agent-note-host-registry-for-mcp-connector-accounts/consequences:
+ en: deb811e5c448772b
+ zh: ba746cfafa0ff1de
diff --git a/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.md b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.md
new file mode 100644
index 0000000000..f38aaaf195
--- /dev/null
+++ b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.md
@@ -0,0 +1,31 @@
+# Agent Note: Host registry for MCP connector accounts
+
+Status: implemented
+
+English | [中文](2026-11-02-mcp-account-host-registry.zh.md)
+
+## Problem
+
+Connector plugins such as Linear, Notion, and Tencent Docs register an OAuth MCP server with the MCP manager on the Host and show its account on the Plugins page: a section with status and actions, a title tag, activation guidance, a sign-out confirmation, and notices. The manager already owns the authorization attempt, the grant, and the server status, and every connector needs the same surfaces. Registering each account in the browser makes each connector ship a browser half with a 41-key dictionary, 26 of whose strings are identical across connectors, and a registration that restates the server name its Host half already registered.
+
+## Decision
+
+The Host service `ctx.mcpAccounts` in [`@deepseek-ai/dsh-client-ui-mcp-account`](../../../../packages/client/ui-mcp-account/README.md) holds the accounts. A connector's Host row registers its server name, its bundle package, and the copy that names its service as `LocalizedText`. It registers inside `ctx.inject(['mcpAccounts'], …)`, so a profile without the registry, such as headless, loads the connector without the page. The Web app composition loads the registry.
+
+The registry serves every account with the manager's view of its server through one `mcpAccounts` Remote; authorization, cancellation, sign-out, and restart stay on the manager's Remote, which already takes the server name. One browser half renders the surfaces of every account and keeps the state that belongs to one browser: it opens an authorization page only in the browser that started the attempt, reports notices only there, and ignores clicks while its own action is pending. The 26 shared strings live in the kit dictionary.
+
+## Alternatives considered
+
+**Browser registration.** Each connector's browser half registers with a browser `ctx.mcpAccounts` under its own dictionary namespace and follows the manager stream itself. That needs one browser package per connector, which only restates what its Host half registered, and one manager stream per account in each browser.
+
+**Connector copy from a shared template.** One dictionary with the service name as a placeholder would remove the 15 connector-specific strings, but those strings differ in more than the name, such as what signing out removes, and Chinese spacing around a Latin name depends on its position. Each connector supplies them as `LocalizedText` instead.
+
+**Actions through the registry.** The registry could route `startAuthorization` and the other actions by package. The manager's Remote already takes the server name, so routing would add a second action surface without a new check.
+
+**A base shared with CLI accounts.** The CLI account registry also registers Host accounts for the Plugins page, but MCP accounts follow the manager's fixed authorization states while CLI accounts present each vendor's own states. A shared base would couple the two registries without removing code from either.
+
+## Consequences
+
+A connector ships no browser code for its account; its Host row registers the account and the kit renders it. Each browser opens one stream for all accounts, which follows one manager stream on the Host. A connector whose Host row fails to load shows no account section, while the Plugins page still lists the bundle with its load failure.
+
+Host specs pin registration, the refusal of a second account per package or server, the merge with the manager's stream, its failure and end, and unload. Client specs pin authorization page opening in the starting browser, notices, the pending-action guard, and each account's slot registrations and their removal.
diff --git a/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.zh.md b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.zh.md
new file mode 100644
index 0000000000..2df2e2929d
--- /dev/null
+++ b/.agents/notes/implemented/architecture/2026-11-02-mcp-account-host-registry.zh.md
@@ -0,0 +1,31 @@
+# Agent Note: MCP 连接器账号的 Host 注册表
+
+Status: implemented
+
+[English](2026-11-02-mcp-account-host-registry.md) | 中文
+
+## 问题
+
+Linear、Notion、腾讯文档等连接器插件在 Host 上向 MCP 管理器注册 OAuth MCP 服务器,并在插件页面显示其账号:带状态和操作的区块、标题标签、开启后的引导、退出登录确认和提示。管理器已经持有授权尝试、grant 和服务器状态,而每个连接器都需要同样的界面。在浏览器中注册账号,会让每个连接器都提供一个浏览器一侧:其中一份 41 个 key 的字典有 26 条文案在各连接器间完全相同,另有一次注册重复其 Host 一侧已注册的服务器名。
+
+## 决定
+
+[`@deepseek-ai/dsh-client-ui-mcp-account`](../../../../packages/client/ui-mcp-account/README.zh.md) 中的 Host 服务 `ctx.mcpAccounts` 保存账号。连接器的 Host 行注册其服务器名、bundle 包名,以及以 `LocalizedText` 表示的、指明其服务的文案。注册放在 `ctx.inject(['mcpAccounts'], …)` 中,因此没有注册表的 profile(如 headless)加载连接器时不带页面。Web 应用组合加载注册表。
+
+注册表通过一个 `mcpAccounts` Remote 提供所有账号,并附上管理器对其服务器的视图;授权、取消、退出登录和重启仍走管理器的 Remote,它本来就接受服务器名。一个浏览器一侧渲染所有账号的界面,并保存属于单个浏览器的状态:只在发起尝试的浏览器中打开授权页面,只在那里报告提示,并在自身操作未完成时忽略点击。26 条共用文案放在套件字典中。
+
+## 考虑过的替代方案
+
+**浏览器注册。** 每个连接器的浏览器一侧以自己的字典命名空间向浏览器中的 `ctx.mcpAccounts` 注册,并自行跟随管理器流。这需要每个连接器一个浏览器包,而它只是重复其 Host 一侧已注册的内容,并且每个浏览器中每个账号各开一条管理器流。
+
+**用共享模板生成连接器文案。** 用一份以服务名为占位符的字典可以去掉 15 条连接器专属文案,但这些文案不只服务名不同,例如退出登录会删除什么;而且中文里拉丁文名称两侧的空格取决于其位置。因此由各连接器以 `LocalizedText` 提供这些文案。
+
+**通过注册表执行操作。** 注册表可以按包路由 `startAuthorization` 等操作。管理器的 Remote 本来就接受服务器名,路由只会多出第二个操作入口,而不增加任何检查。
+
+**与 CLI 账号共用基座。** CLI 账号注册表同样为插件页面注册 Host 账号,但 MCP 账号遵循管理器固定的授权状态,而 CLI 账号呈现各厂商自己的状态。共用基座会把两个注册表耦合起来,却不能从任一方删去代码。
+
+## 影响
+
+连接器不为账号提供任何浏览器代码;其 Host 行注册账号,由套件渲染。每个浏览器为所有账号打开一条流,它在 Host 上跟随一条管理器流。Host 行加载失败的连接器不显示账号区块,而插件页面仍列出该 bundle 及其加载失败。
+
+Host 测试固定注册、同一包或服务器的第二个账号被拒绝、与管理器流的合并及其失败和结束,以及卸载。客户端测试固定只在发起尝试的浏览器中打开授权页面、提示、未完成操作保护,以及每个账号的插槽注册及其移除。
diff --git a/docs/capability-seams.i18n.yaml b/docs/capability-seams.i18n.yaml
index 45bcea8a73..f49bcb58d2 100644
--- a/docs/capability-seams.i18n.yaml
+++ b/docs/capability-seams.i18n.yaml
@@ -6,5 +6,5 @@
en: 41d772192075e133
zh: 5ef3da69b4de1d8a
/capability-seams-and-core-services:
- en: dae89a01efc7619c
- zh: db87a92296ba84ab
+ en: 127bf10f09f4f2bc
+ zh: 0e3e9dfdd9b9a74e
diff --git a/docs/capability-seams.md b/docs/capability-seams.md
index 6d5079cff9..edfa271273 100644
--- a/docs/capability-seams.md
+++ b/docs/capability-seams.md
@@ -212,6 +212,8 @@ flowchart LR
pkg_sdk_minimal["sdk-minimal"]
pkg_mcp_manager["mcp-manager"]
svc_mcpServers["ctx.mcpServers Settings-driven MCP server fleet"]
+ pkg_client_ui_mcp_account["client-ui-mcp-account"]
+ svc_mcpAccounts["ctx.mcpAccounts MCP connector accounts on the Plugins page"]
pkg_schedule["schedule"]
svc_schedule["ctx.schedule Host scheduled messages"]
pkg_goal["goal"]
@@ -346,6 +348,7 @@ flowchart LR
pkg_client_file_upload --> svc_fileUploads
pkg_client_modules --> svc_clientModules
pkg_client_product_analytics --> svc_productAnalytics
+ pkg_client_ui_mcp_account --> svc_mcpAccounts
pkg_client_ui_plugin_manager --> svc_pluginRegistryProbe
pkg_command_feedback --> svc_sessionFeedback
pkg_commands --> svc_commands
@@ -730,6 +733,7 @@ flowchart LR
| `ctx.agentDefaultModel` | `core` | [`agent-default-model`](../packages/core/agent-default-model) | - | [`api-session-controller`](../packages/api/session-controller), [`headless`](../packages/bundle/headless) | - | Reads the default ModelSelection from volatile Config and saves selections through the profile editor. |
| `ctx.agentLoop` | `bundle` | [`agent-loop`](../packages/core/agent-loop) | - | [`base`](../packages/bundle/base), [`sdk-minimal`](../packages/bundle/sdk-minimal) | - | The one concrete loop plugin; extension packages depend on dsh-agent events and services, not on this package. |
| `ctx.mcpServers` | `core` | [`mcp-manager`](../packages/mcp/mcp-manager) | - | - | - | Reconciles mcp-client instances against its volatile servers configuration, aggregates their connection statuses, and serves restart and probe to management surfaces. |
+| `ctx.mcpAccounts` | `service` | [`client-ui-mcp-account`](../packages/client/ui-mcp-account) | - | - | - | Holds the accounts MCP connector plugins register and serves them, with the manager's view of each server, to the Plugins page through one Remote; authorization runs through the manager. |
| `ctx.schedule` | `core` | [`schedule`](../packages/schedule/schedule) | - | - | - | Stores tasks independently of Session activation and queues due messages in each task's target Session. |
| `ctx.goals` | `core` | [`goal`](../packages/goal/goal) | - | - | - | Folds revisioned objective state from the session log and keeps live continuation activation process-local. |
| `ctx.ssh` | `core` | [`ssh`](../packages/ssh/ssh) | - | [`fs-ssh`](../packages/ssh/fs-ssh), [`subprocess-ssh`](../packages/ssh/subprocess-ssh), [`sandbox-ssh`](../packages/ssh/sandbox-ssh) | - | Owns one authenticated OpenSSH connection, installed helper identity, independent program streams and disconnect cleanup for the paired remote providers. |
diff --git a/docs/capability-seams.zh.md b/docs/capability-seams.zh.md
index 8cef4cf395..5f9c6a24fb 100644
--- a/docs/capability-seams.zh.md
+++ b/docs/capability-seams.zh.md
@@ -214,6 +214,8 @@ flowchart LR
pkg_sdk_minimal["sdk-minimal"]
pkg_mcp_manager["mcp-manager"]
svc_mcpServers["ctx.mcpServers Settings-driven MCP server fleet"]
+ pkg_client_ui_mcp_account["client-ui-mcp-account"]
+ svc_mcpAccounts["ctx.mcpAccounts MCP connector accounts on the Plugins page"]
pkg_schedule["schedule"]
svc_schedule["ctx.schedule Host scheduled messages"]
pkg_goal["goal"]
@@ -348,6 +350,7 @@ flowchart LR
pkg_client_file_upload --> svc_fileUploads
pkg_client_modules --> svc_clientModules
pkg_client_product_analytics --> svc_productAnalytics
+ pkg_client_ui_mcp_account --> svc_mcpAccounts
pkg_client_ui_plugin_manager --> svc_pluginRegistryProbe
pkg_command_feedback --> svc_sessionFeedback
pkg_commands --> svc_commands
@@ -732,6 +735,7 @@ flowchart LR
| `ctx.agentDefaultModel` | `core` | [`agent-default-model`](../packages/core/agent-default-model) | - | [`api-session-controller`](../packages/api/session-controller), [`headless`](../packages/bundle/headless) | - | Reads the default ModelSelection from volatile Config and saves selections through the profile editor. |
| `ctx.agentLoop` | `bundle` | [`agent-loop`](../packages/core/agent-loop) | - | [`base`](../packages/bundle/base), [`sdk-minimal`](../packages/bundle/sdk-minimal) | - | 唯一的具体循环插件;扩展包依赖 dsh-agent 的事件和服务,而不依赖此包。 |
| `ctx.mcpServers` | `core` | [`mcp-manager`](../packages/mcp/mcp-manager) | - | - | - | 依据自身 volatile servers 配置对账 mcp-client 实例,聚合它们的连接状态,并向管理界面提供 restart 与 probe。 |
+| `ctx.mcpAccounts` | `service` | [`client-ui-mcp-account`](../packages/client/ui-mcp-account) | - | - | - | 保存 MCP 连接器插件注册的账号,并通过一个 Remote 把账号连同管理器对各服务器的视图提供给插件页;授权经由管理器完成。 |
| `ctx.schedule` | `core` | [`schedule`](../packages/schedule/schedule) | - | - | - | 独立于 Session 的加载状态存储任务,并将到期消息排入每个任务的目标 Session。 |
| `ctx.goals` | `core` | [`goal`](../packages/goal/goal) | - | - | - | 从会话日志折叠带修订版本的目标状态,并将实时延续激活保留在进程本地。 |
| `ctx.ssh` | `core` | [`ssh`](../packages/ssh/ssh) | - | [`fs-ssh`](../packages/ssh/fs-ssh), [`subprocess-ssh`](../packages/ssh/subprocess-ssh), [`sandbox-ssh`](../packages/ssh/sandbox-ssh) | - | 负责一条经过认证的 OpenSSH 连接、已安装辅助程序身份、独立程序流,以及配套远端提供方的断连清理。 |
diff --git a/docs/config-catalog.md b/docs/config-catalog.md
index a25c03280e..13207b0933 100644
--- a/docs/config-catalog.md
+++ b/docs/config-catalog.md
@@ -4954,7 +4954,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
| `@deepseek-ai/dsh-client-ui-input-trigger` | — | [`packages/client/ui-input-trigger/src/index.ts`](../packages/client/ui-input-trigger/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-jobs` | — | [`packages/client/ui-jobs/src/index.ts`](../packages/client/ui-jobs/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-layout` | — | [`packages/client/ui-layout/src/index.ts`](../packages/client/ui-layout/src/index.ts) |
-| `@deepseek-ai/dsh-client-ui-mcp-account` | — | [`packages/client/ui-mcp-account/src/index.ts`](../packages/client/ui-mcp-account/src/index.ts) |
+| `@deepseek-ai/dsh-client-ui-mcp-account` | `mcpServers` | [`packages/client/ui-mcp-account/src/index.ts`](../packages/client/ui-mcp-account/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-message-feedback` | — | [`packages/client/ui-message-feedback/src/index.ts`](../packages/client/ui-message-feedback/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-model-selection` | — | [`packages/client/ui-model-selection/src/index.ts`](../packages/client/ui-model-selection/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-open-in-app` | — | [`packages/client/ui-open-in-app/src/index.ts`](../packages/client/ui-open-in-app/src/index.ts) |
diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md
index 917bc877b4..c0f23203d0 100644
--- a/docs/config-catalog.zh.md
+++ b/docs/config-catalog.zh.md
@@ -4956,7 +4956,7 @@ export interface Config {
| `@deepseek-ai/dsh-client-ui-input-trigger` | — | [`packages/client/ui-input-trigger/src/index.ts`](../packages/client/ui-input-trigger/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-jobs` | — | [`packages/client/ui-jobs/src/index.ts`](../packages/client/ui-jobs/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-layout` | — | [`packages/client/ui-layout/src/index.ts`](../packages/client/ui-layout/src/index.ts) |
-| `@deepseek-ai/dsh-client-ui-mcp-account` | — | [`packages/client/ui-mcp-account/src/index.ts`](../packages/client/ui-mcp-account/src/index.ts) |
+| `@deepseek-ai/dsh-client-ui-mcp-account` | `mcpServers` | [`packages/client/ui-mcp-account/src/index.ts`](../packages/client/ui-mcp-account/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-message-feedback` | — | [`packages/client/ui-message-feedback/src/index.ts`](../packages/client/ui-message-feedback/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-model-selection` | — | [`packages/client/ui-model-selection/src/index.ts`](../packages/client/ui-model-selection/src/index.ts) |
| `@deepseek-ai/dsh-client-ui-open-in-app` | — | [`packages/client/ui-open-in-app/src/index.ts`](../packages/client/ui-open-in-app/src/index.ts) |
diff --git a/docs/subsystems/boot.md b/docs/subsystems/boot.md
index 48b9b179e0..3f0dd07e42 100644
--- a/docs/subsystems/boot.md
+++ b/docs/subsystems/boot.md
@@ -195,6 +195,33 @@ async reconcileProfile(requiredIds: readonly string[] = []): Promise
+
+### `ctx.mcpAccounts` — `McpAccounts`
+
+Holds the registered accounts and serves them, with their servers' manager views, to the Plugins page.
+
+```ts cordis-catalog
+/**
+ * Show one account on the Plugins page for as long as the returned disposer has not run.
+ * @param registration - the server name, the bundle package, and the connector's text.
+ * @returns an idempotent disposer that withdraws the account.
+ * @throws when another account already uses the package or the server.
+ */
+register(registration: McpAccountRegistration): () => void
+
+/**
+ * Follow every registered account with the manager's view of its server.
+ * @param signal - the Client's observation lifetime; disposal also ends the stream.
+ * @returns the accounts once the manager lists its servers, then after each change of either, coalescing changes that
+ * arrive before the next read; ends with the manager's stream.
+ * @throws what the manager's stream throws.
+ */
+@Remote({ mode: 'stream' }) async *watch(signal: AbortSignal): AsyncIterable
+```
+
+Source: [`packages/client/ui-mcp-account/src/index.ts`](../../packages/client/ui-mcp-account/src/index.ts)
+
### `ctx.pluginManager` — `PluginManager`
diff --git a/docs/subsystems/boot.zh.md b/docs/subsystems/boot.zh.md
index d80c05fb53..0beebbc39e 100644
--- a/docs/subsystems/boot.zh.md
+++ b/docs/subsystems/boot.zh.md
@@ -195,6 +195,33 @@ async reconcileProfile(requiredIds: readonly string[] = []): Promise
+
+### `ctx.mcpAccounts` — `McpAccounts`
+
+Holds the registered accounts and serves them, with their servers' manager views, to the Plugins page.
+
+```ts cordis-catalog
+/**
+ * Show one account on the Plugins page for as long as the returned disposer has not run.
+ * @param registration - the server name, the bundle package, and the connector's text.
+ * @returns an idempotent disposer that withdraws the account.
+ * @throws when another account already uses the package or the server.
+ */
+register(registration: McpAccountRegistration): () => void
+
+/**
+ * Follow every registered account with the manager's view of its server.
+ * @param signal - the Client's observation lifetime; disposal also ends the stream.
+ * @returns the accounts once the manager lists its servers, then after each change of either, coalescing changes that
+ * arrive before the next read; ends with the manager's stream.
+ * @throws what the manager's stream throws.
+ */
+@Remote({ mode: 'stream' }) async *watch(signal: AbortSignal): AsyncIterable
+```
+
+Source: [`packages/client/ui-mcp-account/src/index.ts`](../../packages/client/ui-mcp-account/src/index.ts)
+
### `ctx.pluginManager` — `PluginManager`
diff --git a/docs/subsystems/mcp.i18n.yaml b/docs/subsystems/mcp.i18n.yaml
index 47e0a0a5bc..d3b9c3b70e 100644
--- a/docs/subsystems/mcp.i18n.yaml
+++ b/docs/subsystems/mcp.i18n.yaml
@@ -12,8 +12,8 @@
en: 5c0aa5a2e528af97
zh: ae2ba2297294e3de
/mcp/configuration:
- en: 48fd114f7abcf18e
- zh: aca729611bac5997
+ en: 4a164aa382a55d28
+ zh: de7794f817f2cf32
/mcp/responsibilities-and-scope:
en: 1cd19cd40c8b010c
zh: 37c9cdbc9e3edba0
diff --git a/docs/subsystems/mcp.md b/docs/subsystems/mcp.md
index fb30e1fa67..2ebc0318c3 100644
--- a/docs/subsystems/mcp.md
+++ b/docs/subsystems/mcp.md
@@ -23,7 +23,7 @@ Model Context Protocol (MCP) connects the model to tools supplied by external se
MCP servers are opt-in. Configure one `@deepseek-ai/dsh-mcp-client` entry per server in the intended Cordis scope. Every shipped profile supplies the [tool registry](tools.md) and mounts the shared resource service once; users configure only client entries. Callers with no visible configured server receive no MCP prompt text or tools in native or PTC mode.
-The Web and Desktop profiles also mount the [MCP server manager](../../packages/mcp/mcp-manager/README.md) once. It runs servers configured through Settings and servers that installed plugins register for their own lifetime, and serves their status, restart, and probe operations to Remote clients. A plugin that registers an OAuth server shows its account on the **Plugins** page through [`ui-mcp-account`](../../packages/client/ui-mcp-account/README.md).
+The Web and Desktop profiles also mount the [MCP server manager](../../packages/mcp/mcp-manager/README.md) once. It runs servers configured through Settings and servers that installed plugins register for their own lifetime, and serves their status, restart, and probe operations to Remote clients. A plugin that registers an OAuth server registers its account with `ctx.mcpAccounts` from [`ui-mcp-account`](../../packages/client/ui-mcp-account/README.md) to show it on the **Plugins** page.
| Choice | Configuration owner |
|---|---|
diff --git a/docs/subsystems/mcp.zh.md b/docs/subsystems/mcp.zh.md
index addfa48a19..5f07747c25 100644
--- a/docs/subsystems/mcp.zh.md
+++ b/docs/subsystems/mcp.zh.md
@@ -23,7 +23,7 @@
MCP 服务器需要主动配置。在目标 Cordis 作用域中,为每台服务器配置一个 `@deepseek-ai/dsh-mcp-client` 条目。每个随附 profile 都提供[工具注册表](tools.zh.md),并统一挂载共享资源服务一次;用户只需配置客户端条目。调用方没有可见的已配置服务器时,在 native 或 PTC 模式下都不会获得 MCP 提示词文本或工具。
-Web 与 Desktop profile 还统一挂载一次 [MCP 服务器管理器](../../packages/mcp/mcp-manager/README.zh.md)。它运行通过 Settings 配置的服务器,以及已安装插件在自身生命周期内注册的服务器,并向 Remote 客户端提供它们的状态、重启与探测操作。注册 OAuth 服务器的插件通过 [`ui-mcp-account`](../../packages/client/ui-mcp-account/README.zh.md) 在**插件**页面显示账号。
+Web 与 Desktop profile 还统一挂载一次 [MCP 服务器管理器](../../packages/mcp/mcp-manager/README.zh.md)。它运行通过 Settings 配置的服务器,以及已安装插件在自身生命周期内注册的服务器,并向 Remote 客户端提供它们的状态、重启与探测操作。注册 OAuth 服务器的插件通过 [`ui-mcp-account`](../../packages/client/ui-mcp-account/README.zh.md) 的 `ctx.mcpAccounts` 注册账号,使其显示在**插件**页面上。
| 选择 | 配置维护位置 |
|---|---|
diff --git a/packages/bundle/web-app/cordis.patch.yml b/packages/bundle/web-app/cordis.patch.yml
index 065004414e..80525bf151 100644
--- a/packages/bundle/web-app/cordis.patch.yml
+++ b/packages/bundle/web-app/cordis.patch.yml
@@ -424,8 +424,9 @@
- id: ui-message-feedback
name: '@deepseek-ai/dsh-client-ui-message-feedback'
- # Account section, title tag, activation guidance, and notices that
- # connector plugins register for their MCP servers on the Plugins page.
+ # MCP connector plugins register their OAuth accounts with the `mcpAccounts`
+ # registry; the Plugins page shows each account's section, title tag,
+ # activation guidance, and notices through the `mcpAccounts` Remote.
- id: ui-mcp-account
name: '@deepseek-ai/dsh-client-ui-mcp-account'
diff --git a/packages/client/README.i18n.yaml b/packages/client/README.i18n.yaml
index 57140ec381..ff4eb429d3 100644
--- a/packages/client/README.i18n.yaml
+++ b/packages/client/README.i18n.yaml
@@ -15,8 +15,8 @@
en: 1eb35b015a6c423f
zh: a8a3dceee2c9e943
/client-web-gui-browser-half/packages:
- en: f8d8a81b9a84a20d
- zh: 7eec715b05f7ef2a
+ en: b8e95472973a08bc
+ zh: 54ad43603dea80e1
/client-web-gui-browser-half/related-documentation:
en: d1d506e68fab7333
zh: 1a90fe6f3f8f24a9
diff --git a/packages/client/README.md b/packages/client/README.md
index 960fe7d30c..8beaf907e4 100644
--- a/packages/client/README.md
+++ b/packages/client/README.md
@@ -87,7 +87,7 @@ The kernel packages boot and serve the page; the UI feature packages present it.
| [`ui-plugin-market/`](ui-plugin-market/README.md) | Contributes the Discover tab to the Plugins page: browse market indexes and install their bundles | — |
| [`ui-settings-plugin-inventory/`](ui-settings-plugin-inventory/README.md) | Contributes the read-only Host Loader inventory tab to Plugins settings | — |
| [`ui-deliverables/`](ui-deliverables/README.md) | Produces the changed-files card with its comparison tabs, delivery cards, and clickable final-response file references | — |
-| [`ui-mcp-account/`](ui-mcp-account/README.md) | Provides the account section, title tag, activation guidance, and notices that connector plugins register for their MCP servers on the Plugins page | `ctx.mcpAccounts` |
+| [`ui-mcp-account/`](ui-mcp-account/README.md) | Holds the OAuth accounts MCP connector plugins register on the Host and shows each one's section, tag, activation guidance, and notices on the Plugins page | `ctx.mcpAccounts` |
| [`ui-message-feedback/`](ui-message-feedback/README.md) | Provides message ratings and feedback dialogs opened from ratings, `/feedback`, or the Session Header menu | `ctx.feedbackUi` |
| [`ui-directory-picker-browse/`](ui-directory-picker-browse/README.md) | In-app directory browsing surface for the workspace directory flow | — |
| [`ui-directory-picker-native/`](ui-directory-picker-native/README.md) | Native directory-picker surface driving the local Desktop or Host OS chooser | — |
diff --git a/packages/client/README.zh.md b/packages/client/README.zh.md
index 394d8a710e..10c005ff38 100644
--- a/packages/client/README.zh.md
+++ b/packages/client/README.zh.md
@@ -87,7 +87,7 @@ kind: "package-group"
| [`ui-plugin-market/`](ui-plugin-market/README.zh.md) | 为“插件”页面贡献“发现”标签页:浏览市场索引并安装其中的组合包 | — |
| [`ui-settings-plugin-inventory/`](ui-settings-plugin-inventory/README.zh.md) | 向「插件」设置贡献只读的 Host Loader 清单标签页 | — |
| [`ui-deliverables/`](ui-deliverables/README.zh.md) | 生成改动文件卡片及其对比 tab、交付文件卡片与可点击的最终响应文件引用 | — |
-| [`ui-mcp-account/`](ui-mcp-account/README.zh.md) | 提供连接器插件为其 MCP 服务器在插件页面注册的账号区块、标题标签、开启后的引导与提示 | `ctx.mcpAccounts` |
+| [`ui-mcp-account/`](ui-mcp-account/README.zh.md) | 保存 MCP 连接器插件在 Host 上注册的 OAuth 账号,并在插件页面显示每个账号的区块、标签、开启后的引导与提示 | `ctx.mcpAccounts` |
| [`ui-message-feedback/`](ui-message-feedback/README.zh.md) | 提供消息赞踩,以及从赞踩、`/feedback` 或会话标题栏菜单打开的反馈弹窗 | `ctx.feedbackUi` |
| [`ui-directory-picker-browse/`](ui-directory-picker-browse/README.zh.md) | 面向工作区目录流程的应用内目录浏览界面 | — |
| [`ui-directory-picker-native/`](ui-directory-picker-native/README.zh.md) | 驱动本地 Desktop 或 Host OS 选择器的原生目录选择界面 | — |
diff --git a/packages/client/ui-mcp-account/README.i18n.yaml b/packages/client/ui-mcp-account/README.i18n.yaml
index 42ccb8115b..568293cbbf 100644
--- a/packages/client/ui-mcp-account/README.i18n.yaml
+++ b/packages/client/ui-mcp-account/README.i18n.yaml
@@ -3,44 +3,50 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-mcp-account/README.md
/:
- en: 1119c5b18393051b
- zh: 245df5eb6b9d7b47
+ en: 24bf21444e64d7bf
+ zh: 31bdd57111a6c094
/deepseek-ai-dsh-client-ui-mcp-account:
en: bc4c3da94b874e94
zh: 2c191170a5f5d4a0
/deepseek-ai-dsh-client-ui-mcp-account/summary:
- en: fff3391cbc58677b
- zh: e92e37c3b0092bc2
+ en: b82e447d4c945fd7
+ zh: 2ee6c8834ea90d82
/deepseek-ai-dsh-client-ui-mcp-account/table-of-contents:
en: d152484eb41ac6b4
zh: 09388d293f9be9cb
/deepseek-ai-dsh-client-ui-mcp-account/use-this-package:
- en: bbff250eba0f1b89
- zh: 0a618f05cc88ee2b
+ en: eafab9a5fc35e4dd
+ zh: 787421f67536f779
/deepseek-ai-dsh-client-ui-mcp-account/use-this-package/register-an-account:
- en: e55f7ef3f1ea7da4
- zh: 503bb7a7c57ae99b
+ en: cceedbcd9e418af2
+ zh: 7da8bddaa664c7ea
/deepseek-ai-dsh-client-ui-mcp-account/use-this-package/what-the-page-shows:
en: 621f9d0e583e589c
zh: 39036f710eaa292e
+/deepseek-ai-dsh-client-ui-mcp-account/use-this-package/following-attempts:
+ en: ce4df6aa75d05535
+ zh: d700f7f40cfba245
/deepseek-ai-dsh-client-ui-mcp-account/use-this-package/failures:
- en: 32863abaf3878c95
- zh: b79b06bf9a9e93fb
+ en: 6417c0db250bedd6
+ zh: ed17f87e569c11b1
+/deepseek-ai-dsh-client-ui-mcp-account/use-this-package/shared-copy:
+ en: b0aac6746b7ff15e
+ zh: 2124a11b3c2b93db
/deepseek-ai-dsh-client-ui-mcp-account/understand-the-implementation:
- en: 91b2814a091dea67
- zh: 9986a1eea283abba
+ en: 8410d2a9a8ec2059
+ zh: 9e832e896462961e
/deepseek-ai-dsh-client-ui-mcp-account/further-exploration:
en: 85c4d99ffc871cc0
zh: 900a989ad90b0472
/deepseek-ai-dsh-client-ui-mcp-account/model-experience:
- en: 92a4247546de6289
- zh: 9d0147cca07afecd
+ en: f9e28e1c8dda6810
+ zh: b37cd6ac7eb039e7
/deepseek-ai-dsh-client-ui-mcp-account/model-experience/kv-cache-effect:
en: 4cd0965a7997970e
zh: 690e5a9d945f7f6e
/deepseek-ai-dsh-client-ui-mcp-account/known-limitations-and-deferred-work:
- en: 22e2ac8a6058447a
- zh: d097c8d74840f1de
+ en: 6127934af412594e
+ zh: 86dc74338eaf9edf
/deepseek-ai-dsh-client-ui-mcp-account/known-limitations-and-deferred-work/dev-note:
- en: c8cb8dbf8308d7cf
- zh: eebcbc895b62f912
+ en: 5948fc04768b539f
+ zh: a7af9e91f3929547
diff --git a/packages/client/ui-mcp-account/README.md b/packages/client/ui-mcp-account/README.md
index 4752bdded3..ec81d67fa5 100644
--- a/packages/client/ui-mcp-account/README.md
+++ b/packages/client/ui-mcp-account/README.md
@@ -1,5 +1,5 @@
---
-description: "The Plugins page account surfaces for connector plugins that register an OAuth MCP server: the account section, title tag, activation guidance, and notices; for connector authors and maintainers."
+description: "Register an MCP connector's OAuth account on the Host with `ctx.mcpAccounts` and show its section, title tag, activation guidance, sign-out confirmation, and notices on the Plugins page through one `mcpAccounts` Remote, with the connector's own text and the shared copy of this package."
kind: "package-reference"
---
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
## Summary
-This package gives connector plugins their account interface on the Web sidebar's **Plugins** page. A connector whose Host half registers an OAuth MCP server with the [MCP manager](../../mcp/mcp-manager/README.md) calls `ctx.mcpAccounts.register()` from its browser half with the server name, its bundle package, and its dictionary namespace. The package then shows the account section on that bundle's page, the connection tag beside its title, guidance after the bundle is switched on, and connection notices. Authorization, status, and sign-out go through the manager's Remote; the page keeps no connection state of its own. The Web and Desktop compositions mount it through [`dsh-web-app`](../../bundle/web-app/README.md).
+Connector plugins that register an OAuth MCP server with the [MCP manager](../../mcp/mcp-manager/README.md) register its account on the Host with `ctx.mcpAccounts` to show it on the Web sidebar's **Plugins** page. The registry serves every account, with the manager's view of its server, through one `mcpAccounts` Remote. The browser half renders each account's section, title tag, activation guidance, and notices, and authorizes, cancels, signs out, and retries through the manager's Remote. Connectors supply the text that names their service as `LocalizedText`; the shared copy comes from this package's dictionary. The Web and Desktop compositions load both halves through [`dsh-web-app`](../../bundle/web-app/README.md).
## Table of Contents
@@ -25,20 +25,23 @@ This package gives connector plugins their account interface on the Web sidebar'
## Use this package
+A connector's Host row registers its account once; the connector ships no browser code for the account.
+
### Register an account
-A connector's browser half injects `locale` and `mcpAccounts`, registers its dictionary, and registers its account for its own lifetime:
+The connector's Host row registers its account while the registry runs, so a composition without the registry, such as a headless profile, skips the registration:
```ts ignore-check
-export const inject = ['locale', 'mcpAccounts']
+import type {} from '@deepseek-ai/dsh-client-ui-mcp-account'
export function apply(ctx: Context): void {
- ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'docs: dictionaries')
- ctx.effect(() => ctx.mcpAccounts.register({ server: 'docs', packageName: '@acme/docs', locale: NS }), 'docs: account')
+ ctx.inject(['mcpAccounts'], (scope) => {
+ scope.effect(() => scope.mcpAccounts.register({ server: 'docs', packageName: '@acme/docs', copy }), 'docs: Plugins page account')
+ })
}
```
-`server` is the name the connector's Host half registers with the MCP manager, and `packageName` is the npm package whose bundle page carries the section and tag. `locale` names the connector's dictionary namespace; its `LocaleNamespaceMap` entry must be exactly `McpAccountKey`, and the dictionary supplies every product string, including the service name and what sign-out removes. The connector lists `@deepseek-ai/dsh-client-ui-mcp-account` in `dsh.client.inject`. The returned disposer removes the surfaces and closes the account's manager stream. A registration whose package or server is already registered throws and leaves none of its surfaces behind.
+`server` is the name the connector registers with the MCP manager, and `packageName` is the npm package whose bundle page carries the section and tag; a second registration for the same package or server throws. `copy` holds every string that names the service: the section title, the Connect label, the activation guidance, the detail line of each state, the sign-out confirmation with what signing out removes, and the connection and sign-out notices. Each string is `LocalizedText`, which each browser resolves in its active language. The connector imports the registry's types with `import type`. The returned disposer withdraws the account from every page.
### What the page shows
@@ -51,9 +54,17 @@ export function apply(ctx: Context): void {
The tag beside the bundle title reports the same states while the bundle is enabled. Switching the bundle on while no account is connected offers to connect, which opens the bundle page and starts authorization. Leaving the page does not cancel an attempt, which the Host owns.
+### Following attempts
+
+Each browser opens one stream when the Web app loads. The browser that starts an attempt opens its authorization page once, only when the URL uses HTTPS or loopback HTTP, and reports the connection; other browsers show the same section but open no page and report no notice. An account the Host withdraws drops the attempt this browser followed. Clicks while an action is pending are ignored.
+
### Failures
-A failed attempt shows an alert under the status line; a failed page action shows a toast, and the Host keeps the diagnostic. While the manager stream is not delivering, every action stays disabled. The page opens an authorization URL only for the attempt this browser started, and only when the URL uses HTTPS or loopback HTTP.
+A failed attempt shows an alert under the status line; a failed page action shows a toast, and the Host keeps the diagnostic. While the stream is not delivering, every action stays disabled.
+
+### Shared copy
+
+The `mcpAccount` dictionary holds the copy every account shares: the status lines and tags, the expired, mismatched, and unavailable details, the hint that authorization happens on the Host computer, the failure alert and notice, and the action labels. Every other string comes from the connector.
-----
@@ -63,7 +74,20 @@ A failed attempt shows an alert under the status line; a failed page action show
Implementation internals — click to expand
-`register()` creates one `McpAccountConnection` per account. It mirrors the manager's `watch` stream, derives the presentation from that server's entry alone, and keeps only whether the stream is delivering, whether a page action is pending, and the latest notice. The registration contributes `plugins.bundle.config` and `plugins.bundle.activation` keyed by the package name, a `plugins.detail.badge` entry with id `.connection`, and a `shell.overlay` toast with id `.connection-toast`. Each entry declares the connector's namespace, so the renderer supplies its `t`, and all four inject one face that shares one snapshot. The registration is one effect of this plugin's fiber: a setup failure disposes what it already added, and teardown removes the slot entries before closing the stream, whichever of the connector's disposer and this plugin's unload runs first.
+The Host half, `McpAccounts`, is a Remote service that injects the MCP manager. `register()` stores the account, and each `watch` stream follows the manager's own `watch` stream: once the manager lists its servers, it yields every account with its server's view after each change of either, coalescing changes that arrive before the next read. It rethrows a failure of the manager's stream and ends with it.
+
+The browser half mounts the `mcpAccounts` Remote and opens one `watch` stream through `McpAccountsConnection`, which keeps one snapshot store per account: the Host entry, whether the stream is delivering, whether an action this browser started is pending, and the latest notice. Its actions call the manager's `startAuthorization`, `cancelAuthorization`, `signOut`, and `restart` with the account's server. For each account the Host reports, it registers `plugins.bundle.config` and `plugins.bundle.activation` keyed by the package name, a `plugins.detail.badge` entry with id `.connection`, and a `shell.overlay` toast with id `.connection-toast`, all under the `mcpAccount` namespace and injecting one face. An account the Host drops loses its four entries, and unloading withdraws the entries and the stream before the Remote.
+
+| File | Role |
+|---|---|
+| [`src/index.ts`](src/index.ts) | The `ctx.mcpAccounts` registry and its Remote |
+| [`src/types.ts`](src/types.ts) | The registration, copy, and stream item types |
+| [`src/client/index.ts`](src/client/index.ts) | The browser entry bound to the generated Remote |
+| [`src/client/mount.ts`](src/client/mount.ts) | The Remote mount, the dictionary, and the slot registrations of each account |
+| [`src/client/connection.ts`](src/client/connection.ts) | The presentation, the stream mirror, authorization page opening, notices, and the pending-action guard |
+| [`src/client/McpAccount.tsx`](src/client/McpAccount.tsx) | The four surfaces |
+| [`src/client/locales.ts`](src/client/locales.ts) | The shared dictionary |
+| [`src/client/types.ts`](src/client/types.ts) | Snapshot, notice, and face types |
@@ -82,7 +106,7 @@ A failed attempt shows an alert under the status line; a failed page action show
## Model Experience
-None, as the account surfaces are browser UI and add no model input. The connector's naming guidance and the server's tools are documented by the connector and the [MCP client](../../mcp/mcp-client/README.md#model-experience).
+None, as the registry and its surfaces are Plugins page UI and add no model input. The connector's naming guidance and the server's tools are documented by the connector and the [MCP client](../../mcp/mcp-client/README.md#model-experience).
#### KV Cache effect
@@ -93,9 +117,10 @@ None; registering or removing an account changes no model-visible text.
- The section exists only while the connector plugin is on. To sign out after turning the plugin off, turn it on again or delete the grant record.
+- A connector whose Host row fails to load shows no account section; the Plugins page still lists the bundle with its load failure.
- The authorization callback is the Host web server's own origin, so the browser that completes authorization must reach that server directly, not through a proxy or the Web app's `publicUrl`.
-- Each account opens its own manager stream.
- One grant serves each server on the Host; there is no account picker.
+- The Web and Desktop compositions load the registry whether or not a connector is installed.
### Dev Note
@@ -103,6 +128,6 @@ None; registering or removing an account changes no model-visible text.
Working context for maintainers — click to expand
-Client specs drive `McpAccountConnection` with a fake manager stream, render the four components with a key-echo translator, and register accounts against a real slot registry.
+Host specs drive the registry with a fake manager stream. Client specs drive `McpAccountsConnection` with a fake Remote stream, render the surfaces with a key-echo translator and Chinese connector text, and mount the browser half against a real slot registry and locale runtime. Source coverage excludes `src/client/index.ts`, which imports the generated Remote that exists only in `lib/`.
diff --git a/packages/client/ui-mcp-account/README.zh.md b/packages/client/ui-mcp-account/README.zh.md
index a786a8417a..209bc3d2b2 100644
--- a/packages/client/ui-mcp-account/README.zh.md
+++ b/packages/client/ui-mcp-account/README.zh.md
@@ -1,5 +1,5 @@
---
-description: "为注册 OAuth MCP 服务器的连接器插件提供插件页面上的账号界面:账号区块、标题标签、开启后的引导与提示;面向连接器作者和维护者。"
+description: "通过 `ctx.mcpAccounts` 在 Host 上注册 MCP 连接器的 OAuth 账号,并经由一个 `mcpAccounts` Remote 在插件页面显示其账号区块、标题标签、开启后的引导、退出登录确认与提示,文案来自连接器自己的文本和本包的共用文案。"
kind: "package-reference"
---
@@ -9,7 +9,7 @@ kind: "package-reference"
## 概述
-本包为连接器插件提供 Web 侧栏**插件**页面上的账号界面。连接器的 Host 一侧向 [MCP 管理器](../../mcp/mcp-manager/README.zh.md)注册 OAuth MCP 服务器后,在浏览器一侧调用 `ctx.mcpAccounts.register()`,传入服务器名、自身的 bundle 包名和文案命名空间。本包随后在该 bundle 的详情页显示账号区块,在标题旁显示连接标签,在开启 bundle 后显示引导,并显示连接提示。授权、状态和退出登录都通过管理器的 Remote 完成;页面不另存连接状态。Web 与 Desktop 组合通过 [`dsh-web-app`](../../bundle/web-app/README.zh.md) 挂载本包。
+向 [MCP 管理器](../../mcp/mcp-manager/README.zh.md)注册 OAuth MCP 服务器的连接器插件,在 Host 上通过 `ctx.mcpAccounts` 注册账号,使其显示在 Web 侧栏的**插件**页面上。注册表通过一个 `mcpAccounts` Remote 提供所有账号,并附上管理器对各自服务器的视图。浏览器一侧渲染每个账号的区块、标题标签、开启后的引导和提示,并通过管理器的 Remote 完成授权、取消、退出登录和重试。连接器以 `LocalizedText` 提供指明其服务的文案;共用文案来自本包的字典。Web 与 Desktop 组合通过 [`dsh-web-app`](../../bundle/web-app/README.zh.md) 加载这两侧。
## 目录
@@ -25,20 +25,23 @@ kind: "package-reference"
## 使用本包
+连接器的 Host 行注册一次账号;连接器不为账号提供任何浏览器代码。
+
### 注册账号
-连接器的浏览器一侧注入 `locale` 与 `mcpAccounts`,注册自己的文案,并在自身生命周期内注册账号:
+连接器的 Host 行在注册表运行时注册账号,因此没有注册表的组合(如 headless profile)会跳过注册:
```ts ignore-check
-export const inject = ['locale', 'mcpAccounts']
+import type {} from '@deepseek-ai/dsh-client-ui-mcp-account'
export function apply(ctx: Context): void {
- ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'docs: dictionaries')
- ctx.effect(() => ctx.mcpAccounts.register({ server: 'docs', packageName: '@acme/docs', locale: NS }), 'docs: account')
+ ctx.inject(['mcpAccounts'], (scope) => {
+ scope.effect(() => scope.mcpAccounts.register({ server: 'docs', packageName: '@acme/docs', copy }), 'docs: Plugins page account')
+ })
}
```
-`server` 是连接器 Host 一侧向 MCP 管理器注册的名称,`packageName` 是承载区块和标签的 bundle 所属 npm 包。`locale` 指定连接器的文案命名空间;它在 `LocaleNamespaceMap` 中的条目必须恰好是 `McpAccountKey`,所有产品文案都由该文案提供,包括服务名称以及退出登录会删除什么。连接器在 `dsh.client.inject` 中列出 `@deepseek-ai/dsh-client-ui-mcp-account`。返回的释放函数移除这些界面,并关闭该账号的管理器流。包名或服务器名已注册时,注册会抛出错误,且不留下这次注册的任何界面。
+`server` 是连接器向 MCP 管理器注册的名称,`packageName` 是承载区块和标签的 bundle 所属 npm 包;同一个包或服务器的第二次注册会抛出错误。`copy` 包含所有指明该服务的文案:区块标题、连接按钮文字、开启后的引导、各状态的说明行、包含退出登录会删除什么的退出确认,以及连接成功与退出登录的提示。每条文案都是 `LocalizedText`,由各浏览器按当前语言解析。连接器用 `import type` 引入注册表的类型。返回的释放函数从所有页面撤下该账号。
### 页面显示什么
@@ -51,9 +54,17 @@ export function apply(ctx: Context): void {
bundle 开启期间,标题旁的标签报告同样的状态。在尚未连接账号时开启 bundle,页面提示连接,点击后打开 bundle 详情页并发起授权。离开页面不会取消授权尝试,尝试由 Host 持有。
+### 跟随授权尝试
+
+每个浏览器在 Web 应用加载时打开一条流。发起尝试的浏览器把授权页面打开一次,且只在 URL 使用 HTTPS 或回环地址上的 HTTP 时打开,并报告连接结果;其他浏览器显示同样的区块,但不打开页面,也不报告提示。Host 撤下账号时,本浏览器放弃所跟随的尝试。操作未完成时的点击会被忽略。
+
### 失败
-授权尝试失败时,状态行下方显示提示;页面操作失败时显示 toast,诊断信息留在 Host。管理器流未在传送时,所有操作保持禁用。页面只为本浏览器发起的尝试打开授权 URL,且该 URL 必须使用 HTTPS 或回环地址上的 HTTP。
+授权尝试失败时,状态行下方显示提示;页面操作失败时显示 toast,诊断信息留在 Host。流未在传送时,所有操作保持禁用。
+
+### 共用文案
+
+`mcpAccount` 字典包含所有账号共用的文案:状态行和标签、授权过期、不再匹配与暂时无法连接的说明、授权需在 Host 所在电脑上完成的提示、失败提示与失败 toast,以及各操作的文字。其余文案都来自连接器。
-----
@@ -63,7 +74,20 @@ bundle 开启期间,标题旁的标签报告同样的状态。在尚未连接
实现内部机制——点击展开
-`register()` 为每个账号创建一个 `McpAccountConnection`。它镜像管理器的 `watch` 流,只依据该服务器的条目推导显示状态,并只保存流是否在传送、页面操作是否进行中以及最新提示。注册向 `plugins.bundle.config` 与 `plugins.bundle.activation` 贡献以包名为 key 的条目,向 `plugins.detail.badge` 贡献 id 为 `.connection` 的条目,并贡献 id 为 `.connection-toast` 的 `shell.overlay` toast。每个条目都声明连接器的命名空间,由渲染器提供对应的 `t`;四个条目注入同一个 face,共享同一份快照。注册是本插件 fiber 上的一个 effect:初始化失败时释放已添加的部分;释放时先移除插槽条目,再关闭流,无论先执行的是连接器的释放函数还是本插件的卸载。
+Host 一侧的 `McpAccounts` 是注入 MCP 管理器的 Remote 服务。`register()` 保存账号,每条 `watch` 流跟随管理器自己的 `watch` 流:管理器列出服务器后,在任一方每次变化后产出所有账号及其服务器的视图,并合并在下一次读取前到达的变化。管理器的流失败时它重新抛出该错误,管理器的流结束时它随之结束。
+
+浏览器一侧挂载 `mcpAccounts` Remote,并通过 `McpAccountsConnection` 打开一条 `watch` 流,为每个账号保存一个快照 store:Host 条目、流是否在传送、本浏览器发起的操作是否未完成,以及最新提示。它的操作以账号的服务器调用管理器的 `startAuthorization`、`cancelAuthorization`、`signOut` 与 `restart`。对 Host 报告的每个账号,它注册以包名为 key 的 `plugins.bundle.config` 与 `plugins.bundle.activation`、id 为 `.connection` 的 `plugins.detail.badge` 条目,以及 id 为 `.connection-toast` 的 `shell.overlay` toast,全部使用 `mcpAccount` 命名空间并注入同一个 face。Host 撤下的账号会失去这四个条目;卸载时先撤下条目和流,再撤下 Remote。
+
+| 文件 | 职责 |
+|---|---|
+| [`src/index.ts`](src/index.ts) | `ctx.mcpAccounts` 注册表及其 Remote |
+| [`src/types.ts`](src/types.ts) | 注册、文案和流条目类型 |
+| [`src/client/index.ts`](src/client/index.ts) | 绑定生成的 Remote 的浏览器入口 |
+| [`src/client/mount.ts`](src/client/mount.ts) | Remote 挂载、字典,以及每个账号的插槽注册 |
+| [`src/client/connection.ts`](src/client/connection.ts) | 显示状态推导、流的镜像、授权页面打开、提示和未完成操作保护 |
+| [`src/client/McpAccount.tsx`](src/client/McpAccount.tsx) | 四个界面 |
+| [`src/client/locales.ts`](src/client/locales.ts) | 共用字典 |
+| [`src/client/types.ts`](src/client/types.ts) | 快照、提示和 face 类型 |
@@ -82,7 +106,7 @@ bundle 开启期间,标题旁的标签报告同样的状态。在尚未连接
## 模型体验
-无。账号界面是浏览器 UI,不增加任何模型输入。连接器的命名引导与服务器工具由连接器和 [MCP 客户端](../../mcp/mcp-client/README.zh.md#model-experience)说明。
+无。注册表及其界面属于插件页面 UI,不增加任何模型输入。连接器的命名引导与服务器工具由连接器和 [MCP 客户端](../../mcp/mcp-client/README.zh.md#model-experience)说明。
#### KV Cache 影响
@@ -93,9 +117,10 @@ bundle 开启期间,标题旁的标签报告同样的状态。在尚未连接
- 区块只在连接器插件开启期间存在。关闭插件后要退出登录,需要重新开启插件,或删除 grant 记录。
+- Host 行加载失败的连接器不显示账号区块;插件页面仍列出该 bundle 及其加载失败。
- 授权回调地址是 Host Web 服务器自身的源地址,因此完成授权的浏览器必须直接访问该服务器,不能经过代理或 Web 应用的 `publicUrl`。
-- 每个账号各自打开一条管理器流。
- Host 上每个服务器只使用一份 grant;没有账号选择器。
+- 无论是否安装了连接器,Web 与 Desktop 组合都会加载注册表。
### 开发备注
@@ -103,6 +128,6 @@ bundle 开启期间,标题旁的标签报告同样的状态。在尚未连接
维护者工作上下文——点击展开
-客户端测试用模拟的管理器流驱动 `McpAccountConnection`,用回显 key 的翻译函数渲染四个组件,并在真实的插槽注册表上注册账号。
+Host 测试用模拟的管理器流驱动注册表。客户端测试用模拟的 Remote 流驱动 `McpAccountsConnection`,用回显 key 的翻译函数和中文的连接器文案渲染各界面,并在真实的插槽注册表和 locale 运行时上挂载浏览器一侧。源码覆盖率排除 `src/client/index.ts`,因为它引入只存在于 `lib/` 中的生成 Remote。
diff --git a/packages/client/ui-mcp-account/package.json b/packages/client/ui-mcp-account/package.json
index 947278c5d7..81524d397a 100644
--- a/packages/client/ui-mcp-account/package.json
+++ b/packages/client/ui-mcp-account/package.json
@@ -1,6 +1,6 @@
{
"name": "@deepseek-ai/dsh-client-ui-mcp-account",
- "description": "MCP account surfaces for connector plugins: the account section, title tag, activation guidance, and notices on the Plugins page, over the MCP manager Remote",
+ "description": "MCP account surfaces for connector plugins: the Host registry connectors register their OAuth server accounts with, and the Plugins page section, title tag, activation guidance, and notices it serves over one Remote",
"version": "0.2.2-alpha.2",
"publishConfig": {
"access": "public"
@@ -24,12 +24,24 @@
},
"./src/*": "./src/*",
"./package.json": "./package.json",
+ "./types": {
+ "types": "./lib/types/types.d.ts"
+ },
+ "./typert": {
+ "types": "./lib/typert.host.d.ts",
+ "default": "./lib/typert.host.js"
+ },
+ "./remote": {
+ "types": "./lib/typert.remote-client.d.ts",
+ "default": "./lib/typert.remote-client.js"
+ },
"./locale/*.json": "./locale/*.json"
},
"dsh": {
"client": {
"inject": [
"@deepseek-ai/dsh-api-remotes",
+ "@deepseek-ai/dsh-client-locale",
"@deepseek-ai/dsh-client-ui-layout",
"@deepseek-ai/dsh-client-ui-plugin-manager"
],
@@ -41,6 +53,10 @@
"watch": "tsdown --watch"
},
"license": "MIT",
+ "dependencies": {
+ "@deepseek-ai/dsh-typert-protocol": "workspace:*",
+ "zod": "4.4.3"
+ },
"peerDependencies": {
"@deepseek-ai/cordis": "workspace:~"
},
@@ -57,7 +73,8 @@
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
"@deepseek-ai/dsh-mcp-client": "workspace:*",
- "@deepseek-ai/dsh-typert-protocol": "workspace:*",
+ "@deepseek-ai/dsh-mcp-manager": "workspace:*",
+ "@deepseek-ai/dsh-package-manifest": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@testing-library/react": "^16.3.3",
"react": "^18.2.0",
@@ -67,6 +84,10 @@
"locale/*.json",
"lib/index.js",
"lib/client.js",
- "lib/types/**/*.d.ts"
+ "lib/types/**/*.d.ts",
+ "lib/typert.host.js",
+ "lib/typert.host.d.ts",
+ "lib/typert.remote-client.js",
+ "lib/typert.remote-client.d.ts"
]
}
diff --git a/packages/client/ui-mcp-account/src/client/McpAccount.tsx b/packages/client/ui-mcp-account/src/client/McpAccount.tsx
index ac25f7a7b9..ffdb6714b8 100644
--- a/packages/client/ui-mcp-account/src/client/McpAccount.tsx
+++ b/packages/client/ui-mcp-account/src/client/McpAccount.tsx
@@ -3,9 +3,12 @@ import { useEffect, useState, type ReactNode } from 'react'
import { Button, IconWarningOutlineRegular, Modal, StateDot, Tag, Toast, type StateDotState, type TagTone } from '@deepseek-ai/dsh-client-ui-primitives'
import type { InjectFace, PropsRuntime, Translate } from '@deepseek-ai/dsh-client-ui-slots'
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
+import { assertNever } from '@deepseek-ai/dsh-util-values'
+import type { McpAccountCopy } from '../types.ts'
import { presentConnection, type ConnectionPresentation } from './connection.ts'
+import type { McpAccountKey } from './locales.ts'
import css from './McpAccount.module.css'
-import type { McpAccountFace, McpAccountKey } from './types.ts'
+import type { McpAccountFace } from './types.ts'
type Phase = ConnectionPresentation['phase']
type FaceProps = InjectFace & { t: Translate }
@@ -22,56 +25,65 @@ const BADGE: Record = {
'reconnect': ['badge.reconnect', 'warning'], 'unavailable': ['badge.unavailable', 'danger'],
}
-function detail(shown: ConnectionPresentation): McpAccountKey | undefined {
+/** The detail line of a phase: the connector's text where it names the service, the shared copy otherwise. */
+function detail(shown: ConnectionPresentation, copy: McpAccountCopy, t: Translate, resolveText: FaceProps['resolveText']): string | undefined {
switch (shown.phase) {
case 'checking': return undefined
- case 'reconnect': return `detail.reconnect.${shown.reason}`
- default: return `detail.${shown.phase}`
+ case 'reconnect':
+ switch (shown.reason) {
+ case 'rejected': return resolveText(copy.detail.rejected)
+ case 'scope': return resolveText(copy.detail.scope)
+ default: return t(`detail.reconnect.${shown.reason}`)
+ }
+ case 'unavailable': return t('detail.unavailable')
+ case 'waiting-browser': return resolveText(copy.detail.waitingBrowser)
+ default: return resolveText(copy.detail[shown.phase])
}
}
/**
* The account section on the connector bundle's page.
- * @param props - the account face and the connector's dictionary.
+ * @param props - the account face and the shared dictionary.
* @returns the status line, its actions, and the sign-out confirmation.
*/
export function McpAccountSection(props: FaceProps): ReactNode {
- const { useMcpAccount, connect, cancel, signOut, retry, openAuthorization, t } = props
+ const { useMcpAccount, resolveText, connect, cancel, signOut, retry, openAuthorization, t } = props
const snapshot = useMcpAccount(value => value)
const [confirming, setConfirming] = useState(false)
- const shown = presentConnection(snapshot.server)
+ const { copy } = snapshot.entry
+ const shown = presentConnection(snapshot.entry.view)
const disabled = snapshot.busy || !snapshot.linked
- const key = detail(shown)
- const action = (label: McpAccountKey, onClick: () => void, variant: 'primary' | 'outline' | 'ghost' = 'outline'): ReactNode =>
-
+ const line = detail(shown, copy, t, resolveText)
+ const action = (label: string, onClick: () => void, variant: 'primary' | 'outline' | 'ghost' = 'outline'): ReactNode =>
+
const actions: ReactNode[] = []
switch (shown.phase) {
- case 'disconnected': actions.push(action('action.connect', connect, 'primary')); break
- case 'reconnect': actions.push(action('action.reconnect', connect, 'primary')); break
- case 'waiting-browser': actions.push(action('action.open', openAuthorization, 'primary'), action('action.cancel', cancel, 'ghost')); break
- case 'authorizing': actions.push(action('action.cancel', cancel, 'ghost')); break
- case 'connected': actions.push(action('action.signOut', () => { setConfirming(true) })); break
- case 'unavailable': if (shown.retryable) actions.push(action('action.retry', retry)); break
+ case 'disconnected': actions.push(action(resolveText(copy.connect), connect, 'primary')); break
+ case 'reconnect': actions.push(action(t('action.reconnect'), connect, 'primary')); break
+ case 'waiting-browser': actions.push(action(t('action.open'), openAuthorization, 'primary'), action(t('action.cancel'), cancel, 'ghost')); break
+ case 'authorizing': actions.push(action(t('action.cancel'), cancel, 'ghost')); break
+ case 'connected': actions.push(action(t('action.signOut'), () => { setConfirming(true) })); break
+ case 'unavailable': if (shown.retryable) actions.push(action(t('action.retry'), retry)); break
case 'checking':
case 'connecting': break
}
return (
-
)
@@ -79,11 +91,11 @@ export function McpAccountSection(props: FaceProps): ReactNode {
/**
* The account tag beside the connector bundle's title.
- * @param props - the open detail page's subject, the account face, and the dictionary.
+ * @param props - the open detail page's subject, the account face, and the shared dictionary.
* @returns the tag for the connector bundle, or null on any other page.
*/
export function McpAccountBadge({ subject, packageName, useMcpAccount, t }: FaceProps & PropsRuntime<'plugins.detail.badge'>): ReactNode {
- const phase = useMcpAccount(value => presentConnection(value.server).phase)
+ const phase = useMcpAccount(value => presentConnection(value.entry.view).phase)
if (subject.kind !== 'bundle' || subject.pkg.name !== packageName || !subject.pkg.enabled) return null
const badge = BADGE[phase]
return badge === undefined ? null : {t(badge[0])}
@@ -91,38 +103,43 @@ export function McpAccountBadge({ subject, packageName, useMcpAccount, t }: Face
/**
* Guidance after the user switches the connector bundle on while no account is connected.
- * @param props - activation callbacks, the account face, and the dictionary.
+ * @param props - activation callbacks, the account face, and the shared dictionary.
* @returns a dismissible prompt that starts authorization from the bundle's page.
*/
-export function McpAccountActivation({ useMcpAccount, connect, onDismiss, onOpenDetails, t }: FaceProps & PropsRuntime<'plugins.bundle.activation'>): ReactNode {
- const phase = useMcpAccount(value => presentConnection(value.server).phase)
+export function McpAccountActivation(props: FaceProps & PropsRuntime<'plugins.bundle.activation'>): ReactNode {
+ const { useMcpAccount, resolveText, connect, onDismiss, onOpenDetails, t } = props
+ const phase = useMcpAccount(value => presentConnection(value.entry.view).phase)
+ const copy = useMcpAccount(value => value.entry.copy)
const needed = phase === 'disconnected' || phase === 'reconnect'
useEffect(() => {
// A first connection attempt may still end in a state that needs the guidance.
if (phase !== 'checking' && phase !== 'connecting' && !needed) onDismiss()
}, [phase, needed, onDismiss])
return (
-
-
+
>}>
-
{t('activation.body')}
+
{resolveText(copy.activation.body)}
)
}
/**
* Connection outcomes reported outside the Plugins panel's lifetime.
- * @param props - the account's notice, its dismissal, and the dictionary.
+ * @param props - the account's notice, its dismissal, and the dictionaries.
* @returns the toast for the latest notice, or null.
*/
-export function McpAccountToast({ useMcpAccount, dismissNotice, t }: FaceProps): ReactNode {
+export function McpAccountToast({ useMcpAccount, resolveText, dismissNotice, t }: FaceProps): ReactNode {
const notice = useMcpAccount(value => value.notice)
+ const copy = useMcpAccount(value => value.entry.copy)
if (notice === undefined) return null
- const failed = notice.kind === 'action-failed'
- return (
- } : { tone: 'success' as const }} />
- )
+ switch (notice.kind) {
+ case 'action-failed': return } onDone={dismissNotice} />
+ case 'connected': return
+ case 'signed-out': return
+ /* v8 ignore next -- closed notice kind union */
+ default: return assertNever(notice.kind)
+ }
}
diff --git a/packages/client/ui-mcp-account/src/client/connection.ts b/packages/client/ui-mcp-account/src/client/connection.ts
index 1b598986c2..b850bd18dd 100644
--- a/packages/client/ui-mcp-account/src/client/connection.ts
+++ b/packages/client/ui-mcp-account/src/client/connection.ts
@@ -1,29 +1,13 @@
-/** Browser mirror of one managed MCP server and the Plugins page's account actions. */
+/** Browser mirror of the registered connector accounts and the Plugins page's account actions. */
import type { Context } from '@deepseek-ai/cordis'
import type { RemoteStream } from '@deepseek-ai/dsh-api-gateway/client'
import type { McpManagedServerView } from '@deepseek-ai/dsh-api-remotes/client'
import { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'
-import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
import type { McpAuthorizationReason, McpOAuthAttemptId, McpOAuthAttemptView } from '@deepseek-ai/dsh-mcp-client/types'
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
import { assertNever } from '@deepseek-ai/dsh-util-values'
-
-/** A transient outcome the page reports outside its own lifetime. */
-export interface ConnectionNotice {
- readonly seq: number
- readonly kind: 'connected' | 'signed-out' | 'action-failed'
-}
-
-/** The page's whole view: the Host's entry for the server plus this browser's pending action and notice. */
-export interface ConnectionSnapshot {
- /** The manager's entry for the server; undefined until the stream reports one. */
- readonly server: McpManagedServerView | undefined
- /** Whether the manager stream is delivering. */
- readonly linked: boolean
- /** Whether an action this page started has not settled. */
- readonly busy: boolean
- readonly notice: ConnectionNotice | undefined
-}
+import type { McpAccountEntry, McpAccountsView } from '../types.ts'
+import type { McpAccountFace, McpAccountNotice, McpAccountSnapshot } from './types.ts'
/** What the user sees about the connection, derived from the Host entry alone. */
export type ConnectionPresentation =
@@ -34,17 +18,6 @@ export type ConnectionPresentation =
| { readonly phase: 'reconnect'; readonly reason: Exclude; readonly failed: boolean }
| { readonly phase: 'unavailable'; readonly failed: boolean; readonly retryable: boolean }
-/** Page-facing actions and the snapshot hook the slot entries inject. */
-export interface ConnectionFace {
- hooks: { mcpAccount: HostObservable }
- connect(): void
- cancel(): void
- signOut(): void
- retry(): void
- openAuthorization(): void
- dismissNotice(): void
-}
-
function attemptPresentation(attempt: McpOAuthAttemptView): ConnectionPresentation | undefined {
switch (attempt.phase) {
case 'waiting-browser': return { phase: 'waiting-browser', attempt: attempt.id, url: attempt.authorizationUrl }
@@ -105,50 +78,76 @@ async function settle(call: Promise>): Promise {
return result.value
}
-/** One manager subscription per registered account, shared by every surface of that account on the Plugins page. */
-export class McpAccountConnection {
- /** The page's whole view, published after each stream item or page action settles. */
- readonly state: SnapshotStore = createSnapshotStore({
- server: undefined, linked: false, busy: false, notice: undefined,
- })
+/** The registry stream the mirror follows. */
+export interface McpAccountsRemote {
+ watch(signal: AbortSignal): AsyncIterable
+}
- /** The attempt this browser started; only its URL opens a window here. */
- private started: McpOAuthAttemptId | undefined
+/** The manager's account actions the page runs. */
+export interface McpServersRemote {
+ startAuthorization(server: string): Promise>
+ cancelAuthorization(server: string, id: McpOAuthAttemptId): Promise>
+ signOut(server: string): Promise>
+ restart(server: string): Promise>
+}
+
+/** One Host subscription per browser, shared by every account surface on the Plugins page. */
+export class McpAccountsConnection {
+ /** Each registered account's snapshot source by bundle package, republished when the Host adds or removes an account. */
+ readonly accounts: SnapshotStore>> =
+ createSnapshotStore>>(new Map())
+
+ private readonly stores = new Map>()
+ /** The attempt each account's latest connect in this browser started; only its authorization page opens here. */
+ private readonly started = new Map()
private readonly opened = new Set()
private seq = 0
private disposed = false
- private readonly stream: RemoteStream
+ private readonly stream: RemoteStream
private readonly observing: Promise
- constructor(private readonly ctx: Context, private readonly server: string) {
- this.stream = ctx.remote.$stream({
- name: `MCP account ${server}`, open: signal => ctx.remote.mcpServers.watch(signal),
- ended: () => new Error(`MCP account ${server} stream ended`),
- carrierFailed: () => { this.patch({ linked: false }) },
+ /**
+ * @param ctx - the browser context carrying the Remote client.
+ * @param registry - the `mcpAccounts` Remote.
+ * @param servers - the manager's `mcpServers` Remote.
+ */
+ constructor(ctx: Context, registry: McpAccountsRemote, private readonly servers: McpServersRemote) {
+ this.stream = ctx.remote.$stream({
+ name: 'MCP accounts', open: signal => registry.watch(signal),
+ ended: () => new Error('MCP accounts stream ended'),
+ carrierFailed: () => { this.setLinked(false) },
})
this.observing = this.observe()
}
/**
- * Bind the page-facing actions; each runs without awaiting so slot handlers stay synchronous.
- * @returns the face the slot entries inject.
+ * Bind one account's page actions; each runs without awaiting so slot handlers stay synchronous.
+ * @param packageName - the account's bundle package.
+ * @returns the actions a surface entry injects.
*/
- face(): ConnectionFace {
+ actions(packageName: string): Pick {
return {
- hooks: { mcpAccount: this.state },
- connect: () => { void this.connect() },
- cancel: () => { void this.cancel() },
- signOut: () => { void this.run(async () => { await settle(this.ctx.remote.mcpServers.signOut(this.server)); this.notify('signed-out') }) },
- retry: () => { void this.run(async () => { await settle(this.ctx.remote.mcpServers.restart(this.server)) }) },
+ connect: () => { void this.connect(packageName) },
+ cancel: () => { void this.cancel(packageName) },
+ signOut: () => {
+ void this.run(packageName, async (server) => {
+ await settle(this.servers.signOut(server))
+ this.notify(packageName, 'signed-out')
+ })
+ },
+ retry: () => { void this.run(packageName, async (server) => { await settle(this.servers.restart(server)) }) },
openAuthorization: () => {
- const shown = presentConnection(this.state.getSnapshot().server)
+ const shown = presentConnection(this.stores.get(packageName)?.getSnapshot().entry.view)
if (shown.phase === 'waiting-browser') openAuthorizationPage(shown.url)
},
- dismissNotice: () => { this.patch({ notice: undefined }) },
+ dismissNotice: () => { this.patch(packageName, { notice: undefined }) },
}
}
- /** Stop observing the manager; Host-owned attempts keep running. */
+ /**
+ * Stop observing the Host; afterwards the page opens no page and reports nothing more. Host-owned attempts keep running.
+ * @returns after the stream closes.
+ */
async dispose(): Promise {
this.disposed = true
await this.stream.dispose()
@@ -158,64 +157,95 @@ export class McpAccountConnection {
private async observe(): Promise {
try {
for await (const item of this.stream) {
- const server = item.value.find(entry => entry.name === this.server)
- this.patch({ server, linked: true })
- this.follow(server)
+ // An item the stream yielded just before disposal must not reach the disposed page.
+ if (this.disposed) return
+ this.show(item.value.accounts)
item.accept()
}
} catch {
// The carrier already reported the failure; a disposed page has nothing left to show.
- if (!this.disposed) this.patch({ linked: false })
+ if (!this.disposed) this.setLinked(false)
}
}
- /** Open this browser's authorization page once, and report its outcome. */
- private follow(server: McpManagedServerView | undefined): void {
- const attempt = server?.authorization
- if (attempt === undefined || attempt.id !== this.started) return
+ private show(entries: readonly McpAccountEntry[]): void {
+ const names = new Set(entries.map(entry => entry.packageName))
+ let changed = false
+ for (const packageName of [...this.stores.keys()]) {
+ if (names.has(packageName)) continue
+ this.stores.delete(packageName)
+ this.started.delete(packageName)
+ changed = true
+ }
+ for (const entry of entries) {
+ const store = this.stores.get(entry.packageName)
+ if (store === undefined) {
+ this.stores.set(entry.packageName, createSnapshotStore({ entry, linked: true, busy: false, notice: undefined }))
+ changed = true
+ } else {
+ store.set({ ...store.getSnapshot(), entry, linked: true })
+ }
+ this.follow(entry)
+ }
+ if (changed) this.accounts.set(new Map(this.stores))
+ }
+
+ /** Open the authorization page of the attempt this browser started once, and report its outcome. */
+ private follow(entry: McpAccountEntry): void {
+ const attempt = entry.view?.authorization
+ if (attempt === undefined || attempt.id !== this.started.get(entry.packageName)) return
if (attempt.phase === 'waiting-browser' && !this.opened.has(attempt.id)) {
this.opened.add(attempt.id)
openAuthorizationPage(attempt.authorizationUrl)
}
- if (attempt.phase === 'authorized') this.notify('connected')
- if (attempt.phase === 'authorized' || attempt.phase === 'cancelled' || attempt.phase === 'failed') this.started = undefined
+ if (attempt.phase === 'authorized') this.notify(entry.packageName, 'connected')
+ if (attempt.phase === 'authorized' || attempt.phase === 'cancelled' || attempt.phase === 'failed') this.started.delete(entry.packageName)
}
- private async connect(): Promise {
- await this.run(async () => {
- const attempt = await settle(this.ctx.remote.mcpServers.startAuthorization(this.server))
- this.started = attempt.id
+ private async connect(packageName: string): Promise {
+ await this.run(packageName, async (server) => {
+ const attempt = await settle(this.servers.startAuthorization(server))
+ const current = this.stores.get(packageName)?.getSnapshot().entry
+ // A disposed page or an account the Host withdrew meanwhile follows nothing.
+ if (this.disposed || current === undefined) return
+ this.started.set(packageName, attempt.id)
// The stream may have reported this attempt before the call answered.
- this.follow(this.state.getSnapshot().server)
+ this.follow(current)
})
}
- private async cancel(): Promise {
- const shown = presentConnection(this.state.getSnapshot().server)
+ private async cancel(packageName: string): Promise {
+ const shown = presentConnection(this.stores.get(packageName)?.getSnapshot().entry.view)
if (shown.phase !== 'waiting-browser' && shown.phase !== 'authorizing') return
- await this.run(async () => { await settle(this.ctx.remote.mcpServers.cancelAuthorization(this.server, shown.attempt)) })
+ await this.run(packageName, async (server) => { await settle(this.servers.cancelAuthorization(server, shown.attempt)) })
}
- private async run(operation: () => Promise): Promise {
- if (this.state.getSnapshot().busy) return
- this.patch({ busy: true })
+ private async run(packageName: string, operation: (server: string) => Promise): Promise {
+ const snapshot = this.stores.get(packageName)?.getSnapshot()
+ if (snapshot === undefined || snapshot.busy) return
+ this.patch(packageName, { busy: true })
try {
- await operation()
+ await operation(snapshot.entry.server)
} catch {
// The Host keeps the diagnostic; the page reports one retryable outcome.
- this.notify('action-failed')
+ this.notify(packageName, 'action-failed')
} finally {
- this.patch({ busy: false })
+ this.patch(packageName, { busy: false })
}
}
- private patch(change: Partial): void {
- this.state.set({ ...this.state.getSnapshot(), ...change })
+ private setLinked(linked: boolean): void {
+ for (const packageName of this.stores.keys()) this.patch(packageName, { linked })
}
- private notify(kind: ConnectionNotice['kind']): void {
+ private patch(packageName: string, change: Partial): void {
+ const store = this.stores.get(packageName)
+ if (store !== undefined) store.set({ ...store.getSnapshot(), ...change })
+ }
+
+ private notify(packageName: string, kind: McpAccountNotice['kind']): void {
if (this.disposed) return
this.seq += 1
- this.patch({ notice: { seq: this.seq, kind } })
+ this.patch(packageName, { notice: { seq: this.seq, kind } })
}
}
diff --git a/packages/client/ui-mcp-account/src/client/index.ts b/packages/client/ui-mcp-account/src/client/index.ts
index 47d9100b09..a0f94d3633 100644
--- a/packages/client/ui-mcp-account/src/client/index.ts
+++ b/packages/client/ui-mcp-account/src/client/index.ts
@@ -1,58 +1,21 @@
/**
- * MCP account surfaces for connector plugins, browser half. `ctx.mcpAccounts`
- * shows a plugin-registered OAuth server's account section, title tag,
- * activation guidance, and notices on its bundle's Plugins page.
- * Authorization, status, and sign-out go through the MCP manager's Remote;
- * the page keeps no connection state of its own.
+ * MCP account surfaces, browser half: follows the accounts connector plugins register on the Host and shows each one's
+ * section, title tag, activation guidance, and notices on its bundle's Plugins page. The surfaces read the shared copy
+ * from this package's dictionary and each connector's text from the Host.
*/
import type { Context } from '@deepseek-ai/cordis'
-import type {} from '@deepseek-ai/dsh-api-remotes/client'
-import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
-import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
-import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
-import { McpAccountConnection } from './connection.ts'
-import { McpAccountActivation, McpAccountBadge, McpAccountSection, McpAccountToast } from './McpAccount.tsx'
-import type { McpAccountFace, McpAccountRegistration, McpAccounts } from './types.ts'
+import mcpAccountsRemote from '@deepseek-ai/dsh-client-ui-mcp-account/remote'
+import { mountMcpAccounts } from './mount.ts'
-export type { McpAccountKey, McpAccountNamespace, McpAccountRegistration, McpAccounts } from './types.ts'
-
-declare module '@deepseek-ai/cordis' {
- interface Context {
- /** Connector account surfaces on the Plugins page. */
- mcpAccounts: McpAccounts
- }
-}
-
-/** Services the slot registrations and the manager Remote need. */
-export const inject = ['remote', 'remote.mcpServers', 'slots']
-
-function register(ctx: Context, account: McpAccountRegistration): () => void {
- const { server, packageName, locale } = account
- const dispose = ctx.effect(function* () {
- const connection = new McpAccountConnection(ctx, server)
- yield async () => { await connection.dispose() }
- const face: McpAccountFace = { ...connection.face(), packageName }
- yield ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
- name: 'plugins.bundle.config', key: packageName, locale, inject: () => face,
- }, McpAccountSection))
- yield ctx.slots.inject('plugins.bundle.activation', () => ctx.slots.register({
- name: 'plugins.bundle.activation', key: packageName, locale, inject: () => face,
- }, McpAccountActivation))
- yield ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
- name: 'plugins.detail.badge', id: `${server}.connection`, locale, inject: () => face,
- }, McpAccountBadge))
- yield ctx.slots.inject('shell.overlay', () => ctx.slots.register({
- name: 'shell.overlay', id: `${server}.connection-toast`, locale, inject: () => face,
- }, McpAccountToast))
- }, `mcpAccounts.register(${server})`)
- return () => void dispose()
-}
+export { inject } from './mount.ts'
+export type { McpAccountKey } from './locales.ts'
+export type { McpAccountFace, McpAccountNotice, McpAccountSnapshot } from './types.ts'
/**
- * Provide the account registry; each registration lives until its disposer runs or this plugin unloads.
+ * Show the registered connector accounts on the Plugins page.
* @param ctx - the browser plugin context.
+ * @returns a disposer that withdraws the surfaces and the stream, then the Remote.
*/
-export function apply(ctx: Context): void {
- const accounts: McpAccounts = { register: account => register(ctx, account) }
- ctx.provide('mcpAccounts', accounts)
+export async function apply(ctx: Context): Promise<() => Promise> {
+ return mountMcpAccounts(ctx, mcpAccountsRemote)
}
diff --git a/packages/client/ui-mcp-account/src/client/locales.ts b/packages/client/ui-mcp-account/src/client/locales.ts
new file mode 100644
index 0000000000..bc8d16fdde
--- /dev/null
+++ b/packages/client/ui-mcp-account/src/client/locales.ts
@@ -0,0 +1,254 @@
+/** Locale-owned copy every connector's account surfaces share; each connector's own text arrives from the Host. */
+import type {} from '@deepseek-ai/dsh-client-ui-slots'
+
+/** Dictionary namespace of the shared account copy. */
+export const NS = 'mcpAccount'
+
+/** Chinese dictionary and key source. */
+export const zh = {
+ close: '关闭',
+ 'status.checking': '正在检查连接',
+ 'status.disconnected': '未连接',
+ 'status.waiting-browser': '等待你在浏览器中确认',
+ 'status.authorizing': '正在连接',
+ 'status.connecting': '正在连接',
+ 'status.connected': '已连接',
+ 'status.reconnect': '需要重新连接',
+ 'status.unavailable': '暂时无法连接',
+ 'detail.reconnect.expired': '授权已过期,请重新连接。',
+ 'detail.reconnect.binding': '授权与当前设置不再匹配,请重新连接。',
+ 'detail.unavailable': '已保留现有授权,可以稍后重试。',
+ hostBrowser: '授权需要在运行 DSH 的这台电脑上的浏览器中完成。',
+ failed: '授权未完成,请重试',
+ 'action.reconnect': '重新连接',
+ 'action.open': '打开授权页面',
+ 'action.cancel': '取消',
+ 'action.signOut': '退出登录',
+ 'action.retry': '重试',
+ 'badge.connected': '已连接',
+ 'badge.disconnected': '未连接',
+ 'badge.reconnect': '需要重新连接',
+ 'badge.unavailable': '暂时无法连接',
+ 'badge.connecting': '连接中',
+ 'activation.later': '稍后',
+ 'notice.action-failed': '操作未完成,请重试',
+}
+
+/** Every key the shared account surfaces translate. */
+export type McpAccountKey = keyof typeof zh
+
+/** English dictionary. */
+export const en: Record = {
+ close: 'Close',
+ 'status.checking': 'Checking connection',
+ 'status.disconnected': 'Not connected',
+ 'status.waiting-browser': 'Waiting for you to confirm in the browser',
+ 'status.authorizing': 'Connecting',
+ 'status.connecting': 'Connecting',
+ 'status.connected': 'Connected',
+ 'status.reconnect': 'Reconnection needed',
+ 'status.unavailable': 'Cannot connect right now',
+ 'detail.reconnect.expired': 'The authorization has expired. Connect again.',
+ 'detail.reconnect.binding': 'The authorization no longer matches the current settings. Connect again.',
+ 'detail.unavailable': 'The existing authorization is kept. Try again later.',
+ hostBrowser: 'Authorization must be completed in a browser on the computer running DSH.',
+ failed: 'Authorization was not completed. Try again.',
+ 'action.reconnect': 'Connect again',
+ 'action.open': 'Open authorization page',
+ 'action.cancel': 'Cancel',
+ 'action.signOut': 'Sign out',
+ 'action.retry': 'Retry',
+ 'badge.connected': 'Connected',
+ 'badge.disconnected': 'Not connected',
+ 'badge.reconnect': 'Reconnect',
+ 'badge.unavailable': 'Unavailable',
+ 'badge.connecting': 'Connecting',
+ 'activation.later': 'Later',
+ 'notice.action-failed': 'The action did not finish. Try again.',
+}
+
+/** Japanese dictionary. */
+export const ja: Record = {
+ close: '閉じる',
+ 'status.checking': '接続を確認中',
+ 'status.disconnected': '未接続',
+ 'status.waiting-browser': 'ブラウザーでの確認を待っています',
+ 'status.authorizing': '接続中',
+ 'status.connecting': '接続中',
+ 'status.connected': '接続済み',
+ 'status.reconnect': '再接続が必要です',
+ 'status.unavailable': '現在接続できません',
+ 'detail.reconnect.expired': '認可の有効期限が切れました。再度接続してください。',
+ 'detail.reconnect.binding': '認可が現在の設定と一致しなくなりました。再度接続してください。',
+ 'detail.unavailable': '現在の認可は保持されています。しばらくしてから再試行してください。',
+ hostBrowser: '認可は、DSH を実行しているコンピューターのブラウザーで完了する必要があります。',
+ failed: '認可が完了しませんでした。もう一度お試しください。',
+ 'action.reconnect': '再接続',
+ 'action.open': '認可ページを開く',
+ 'action.cancel': 'キャンセル',
+ 'action.signOut': 'サインアウト',
+ 'action.retry': '再試行',
+ 'badge.connected': '接続済み',
+ 'badge.disconnected': '未接続',
+ 'badge.reconnect': '要再接続',
+ 'badge.unavailable': '利用不可',
+ 'badge.connecting': '接続中',
+ 'activation.later': '後で',
+ 'notice.action-failed': '操作が完了しませんでした。もう一度お試しください。',
+}
+
+/** Spanish dictionary. */
+export const es: Record = {
+ close: 'Cerrar',
+ 'status.checking': 'Comprobando la conexión',
+ 'status.disconnected': 'No conectado',
+ 'status.waiting-browser': 'Esperando su confirmación en el navegador',
+ 'status.authorizing': 'Conectando',
+ 'status.connecting': 'Conectando',
+ 'status.connected': 'Conectado',
+ 'status.reconnect': 'Se necesita volver a conectar',
+ 'status.unavailable': 'No se puede conectar en este momento',
+ 'detail.reconnect.expired': 'La autorización ha caducado. Vuelva a conectar.',
+ 'detail.reconnect.binding': 'La autorización ya no coincide con la configuración actual. Vuelva a conectar.',
+ 'detail.unavailable': 'Se conserva la autorización actual. Inténtelo de nuevo más tarde.',
+ hostBrowser: 'La autorización debe completarse en un navegador de la computadora donde se ejecuta DSH.',
+ failed: 'La autorización no se completó. Inténtelo de nuevo.',
+ 'action.reconnect': 'Volver a conectar',
+ 'action.open': 'Abrir página de autorización',
+ 'action.cancel': 'Cancelar',
+ 'action.signOut': 'Cerrar sesión',
+ 'action.retry': 'Reintentar',
+ 'badge.connected': 'Conectado',
+ 'badge.disconnected': 'No conectado',
+ 'badge.reconnect': 'Reconectar',
+ 'badge.unavailable': 'No disponible',
+ 'badge.connecting': 'Conectando',
+ 'activation.later': 'Más tarde',
+ 'notice.action-failed': 'La acción no se completó. Inténtelo de nuevo.',
+}
+
+/** French dictionary. */
+export const fr: Record = {
+ close: 'Fermer',
+ 'status.checking': 'Vérification de la connexion',
+ 'status.disconnected': 'Non connecté',
+ 'status.waiting-browser': 'En attente de votre confirmation dans le navigateur',
+ 'status.authorizing': 'Connexion en cours',
+ 'status.connecting': 'Connexion en cours',
+ 'status.connected': 'Connecté',
+ 'status.reconnect': 'Reconnexion nécessaire',
+ 'status.unavailable': 'Connexion impossible pour le moment',
+ 'detail.reconnect.expired': 'L’autorisation a expiré. Reconnectez-vous.',
+ 'detail.reconnect.binding': 'L’autorisation ne correspond plus aux paramètres actuels. Reconnectez-vous.',
+ 'detail.unavailable': 'L’autorisation existante est conservée. Réessayez plus tard.',
+ hostBrowser: 'L’autorisation doit être effectuée dans un navigateur de l’ordinateur qui exécute DSH.',
+ failed: 'L’autorisation n’a pas abouti. Réessayez.',
+ 'action.reconnect': 'Se reconnecter',
+ 'action.open': 'Ouvrir la page d’autorisation',
+ 'action.cancel': 'Annuler',
+ 'action.signOut': 'Se déconnecter',
+ 'action.retry': 'Réessayer',
+ 'badge.connected': 'Connecté',
+ 'badge.disconnected': 'Non connecté',
+ 'badge.reconnect': 'À reconnecter',
+ 'badge.unavailable': 'Indisponible',
+ 'badge.connecting': 'Connexion en cours',
+ 'activation.later': 'Plus tard',
+ 'notice.action-failed': 'L’action n’a pas abouti. Réessayez.',
+}
+
+/** German dictionary. */
+export const de: Record = {
+ close: 'Schließen',
+ 'status.checking': 'Verbindung wird geprüft',
+ 'status.disconnected': 'Nicht verbunden',
+ 'status.waiting-browser': 'Warten auf Ihre Bestätigung im Browser',
+ 'status.authorizing': 'Wird verbunden',
+ 'status.connecting': 'Wird verbunden',
+ 'status.connected': 'Verbunden',
+ 'status.reconnect': 'Erneute Verbindung erforderlich',
+ 'status.unavailable': 'Verbindung gerade nicht möglich',
+ 'detail.reconnect.expired': 'Die Autorisierung ist abgelaufen. Verbinden Sie erneut.',
+ 'detail.reconnect.binding': 'Die Autorisierung passt nicht mehr zu den aktuellen Einstellungen. Verbinden Sie erneut.',
+ 'detail.unavailable': 'Die bestehende Autorisierung bleibt erhalten. Versuchen Sie es später erneut.',
+ hostBrowser: 'Die Autorisierung muss in einem Browser auf dem Computer abgeschlossen werden, auf dem DSH läuft.',
+ failed: 'Die Autorisierung wurde nicht abgeschlossen. Versuchen Sie es erneut.',
+ 'action.reconnect': 'Erneut verbinden',
+ 'action.open': 'Autorisierungsseite öffnen',
+ 'action.cancel': 'Abbrechen',
+ 'action.signOut': 'Abmelden',
+ 'action.retry': 'Erneut versuchen',
+ 'badge.connected': 'Verbunden',
+ 'badge.disconnected': 'Nicht verbunden',
+ 'badge.reconnect': 'Neu verbinden',
+ 'badge.unavailable': 'Nicht verfügbar',
+ 'badge.connecting': 'Wird verbunden',
+ 'activation.later': 'Später',
+ 'notice.action-failed': 'Die Aktion wurde nicht abgeschlossen. Versuchen Sie es erneut.',
+}
+
+/** Russian dictionary. */
+export const ru: Record = {
+ close: 'Закрыть',
+ 'status.checking': 'Проверка подключения',
+ 'status.disconnected': 'Не подключено',
+ 'status.waiting-browser': 'Ожидание вашего подтверждения в браузере',
+ 'status.authorizing': 'Подключение',
+ 'status.connecting': 'Подключение',
+ 'status.connected': 'Подключено',
+ 'status.reconnect': 'Требуется повторное подключение',
+ 'status.unavailable': 'Сейчас не удаётся подключиться',
+ 'detail.reconnect.expired': 'Срок действия авторизации истёк. Подключитесь снова.',
+ 'detail.reconnect.binding': 'Авторизация больше не соответствует текущим настройкам. Подключитесь снова.',
+ 'detail.unavailable': 'Текущая авторизация сохранена. Повторите попытку позже.',
+ hostBrowser: 'Авторизацию нужно завершить в браузере на компьютере, где запущен DSH.',
+ failed: 'Авторизация не завершена. Повторите попытку.',
+ 'action.reconnect': 'Подключить снова',
+ 'action.open': 'Открыть страницу авторизации',
+ 'action.cancel': 'Отмена',
+ 'action.signOut': 'Выйти',
+ 'action.retry': 'Повторить',
+ 'badge.connected': 'Подключено',
+ 'badge.disconnected': 'Не подключено',
+ 'badge.reconnect': 'Переподключить',
+ 'badge.unavailable': 'Недоступно',
+ 'badge.connecting': 'Подключение',
+ 'activation.later': 'Позже',
+ 'notice.action-failed': 'Действие не завершено. Повторите попытку.',
+}
+
+/** Portuguese dictionary. */
+export const pt: Record = {
+ close: 'Fechar',
+ 'status.checking': 'Verificando a conexão',
+ 'status.disconnected': 'Não conectado',
+ 'status.waiting-browser': 'Aguardando sua confirmação no navegador',
+ 'status.authorizing': 'Conectando',
+ 'status.connecting': 'Conectando',
+ 'status.connected': 'Conectado',
+ 'status.reconnect': 'É necessário reconectar',
+ 'status.unavailable': 'Não é possível conectar no momento',
+ 'detail.reconnect.expired': 'A autorização expirou. Conecte novamente.',
+ 'detail.reconnect.binding': 'A autorização não corresponde mais às configurações atuais. Conecte novamente.',
+ 'detail.unavailable': 'A autorização atual foi mantida. Tente novamente mais tarde.',
+ hostBrowser: 'A autorização deve ser concluída em um navegador no computador que executa o DSH.',
+ failed: 'A autorização não foi concluída. Tente novamente.',
+ 'action.reconnect': 'Conectar novamente',
+ 'action.open': 'Abrir página de autorização',
+ 'action.cancel': 'Cancelar',
+ 'action.signOut': 'Sair',
+ 'action.retry': 'Tentar novamente',
+ 'badge.connected': 'Conectado',
+ 'badge.disconnected': 'Não conectado',
+ 'badge.reconnect': 'Reconectar',
+ 'badge.unavailable': 'Indisponível',
+ 'badge.connecting': 'Conectando',
+ 'activation.later': 'Mais tarde',
+ 'notice.action-failed': 'A ação não foi concluída. Tente novamente.',
+}
+
+declare module '@deepseek-ai/dsh-client-ui-slots' {
+ interface LocaleNamespaceMap {
+ mcpAccount: McpAccountKey
+ }
+}
diff --git a/packages/client/ui-mcp-account/src/client/mount.ts b/packages/client/ui-mcp-account/src/client/mount.ts
new file mode 100644
index 0000000000..0edea4d504
--- /dev/null
+++ b/packages/client/ui-mcp-account/src/client/mount.ts
@@ -0,0 +1,78 @@
+/** Mount the `mcpAccounts` Remote and show the surfaces of each account the Host registers, for one plugin lifetime. */
+import type { Context } from '@deepseek-ai/cordis'
+import type {} from '@deepseek-ai/dsh-api-remotes/client'
+import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
+import type {} from '@deepseek-ai/dsh-client-locale/client'
+import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
+import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
+import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
+import type {} from '@deepseek-ai/dsh-client-ui-mcp-account/remote'
+import type { TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol'
+import { McpAccountsConnection } from './connection.ts'
+import { de, en, es, fr, ja, NS, pt, ru, zh } from './locales.ts'
+import { McpAccountActivation, McpAccountBadge, McpAccountSection, McpAccountToast } from './McpAccount.tsx'
+import type { McpAccountFace, McpAccountSnapshot } from './types.ts'
+
+/** Services the Remote mount and the slot registrations need. */
+export const inject = ['remote', 'slots', 'locale']
+
+function registerAccount(
+ ctx: Context, connection: McpAccountsConnection, packageName: string, store: SnapshotStore,
+): () => void {
+ const { server } = store.getSnapshot().entry
+ const face: McpAccountFace = {
+ hooks: { mcpAccount: store }, packageName, resolveText: text => ctx.locale.resolveText(text), ...connection.actions(packageName),
+ }
+ const dispose = ctx.effect(function* () {
+ yield ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
+ name: 'plugins.bundle.config', key: packageName, locale: NS, inject: () => face,
+ }, McpAccountSection))
+ yield ctx.slots.inject('plugins.bundle.activation', () => ctx.slots.register({
+ name: 'plugins.bundle.activation', key: packageName, locale: NS, inject: () => face,
+ }, McpAccountActivation))
+ yield ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
+ name: 'plugins.detail.badge', id: `${server}.connection`, locale: NS, inject: () => face,
+ }, McpAccountBadge))
+ yield ctx.slots.inject('shell.overlay', () => ctx.slots.register({
+ name: 'shell.overlay', id: `${server}.connection-toast`, locale: NS, inject: () => face,
+ }, McpAccountToast))
+ }, `mcpAccounts: ${packageName}`)
+ return () => void dispose()
+}
+
+function showAccounts(ctx: Context): void {
+ ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'mcp-account: dictionaries')
+ const connection = new McpAccountsConnection(ctx, ctx.remote.mcpAccounts, ctx.remote.mcpServers)
+ ctx.effect(() => async () => { await connection.dispose() }, 'mcp-account: connection')
+ ctx.effect(() => {
+ const shown = new Map void>()
+ const sync = (): void => {
+ const accounts = connection.accounts.getSnapshot()
+ for (const [name, withdraw] of shown) {
+ if (accounts.has(name)) continue
+ withdraw()
+ shown.delete(name)
+ }
+ for (const [name, store] of accounts) if (!shown.has(name)) shown.set(name, registerAccount(ctx, connection, name, store))
+ }
+ sync()
+ const stop = connection.accounts.subscribe(sync)
+ return () => {
+ stop()
+ for (const withdraw of shown.values()) withdraw()
+ }
+ }, 'mcp-account: surfaces')
+}
+
+/**
+ * Mount the `mcpAccounts` Remote, then show the registered accounts for the same plugin lifetime.
+ * @param ctx - the browser plugin context.
+ * @param contribution - the generated `mcpAccounts` Remote definitions the built entry supplies.
+ * @returns a disposer that withdraws the surfaces and the stream before the Remote.
+ */
+export async function mountMcpAccounts(ctx: Context, contribution: TypertRemoteContribution): Promise<() => Promise> {
+ const unmount = await ctx.remote.$mount(contribution)
+ const ui = ctx.inject(['remote.mcpAccounts', 'remote.mcpServers', 'slots', 'locale'], showAccounts)
+ try { await ui } catch (error) { await ui.dispose(); await unmount(); throw error }
+ return async () => { await ui.dispose(); await unmount() }
+}
diff --git a/packages/client/ui-mcp-account/src/client/types.ts b/packages/client/ui-mcp-account/src/client/types.ts
index 9b209c4ae7..e360478ef7 100644
--- a/packages/client/ui-mcp-account/src/client/types.ts
+++ b/packages/client/ui-mcp-account/src/client/types.ts
@@ -1,52 +1,34 @@
-/** Registration and dictionary types a connector plugin uses to show its MCP account on the Plugins page. */
-import type { LocaleNamespaceMap } from '@deepseek-ai/dsh-client-ui-slots'
-import type { ConnectionFace } from './connection.ts'
+/** Browser-side state and face of the connector accounts the Plugins page shows. */
+import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
+import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
+import type { McpAccountEntry } from '../types.ts'
-/** Every key a connector's account dictionary translates. */
-export type McpAccountKey =
- | 'section.title'
- | 'status.checking' | 'status.disconnected' | 'status.waiting-browser' | 'status.authorizing'
- | 'status.connecting' | 'status.connected' | 'status.reconnect' | 'status.unavailable'
- | 'detail.disconnected' | 'detail.waiting-browser' | 'detail.authorizing' | 'detail.connecting' | 'detail.connected'
- | 'detail.reconnect.expired' | 'detail.reconnect.binding' | 'detail.reconnect.rejected' | 'detail.reconnect.scope'
- | 'detail.unavailable'
- | 'hostBrowser' | 'failed'
- | 'action.connect' | 'action.reconnect' | 'action.open' | 'action.cancel' | 'action.signOut' | 'action.retry'
- | 'badge.connected' | 'badge.disconnected' | 'badge.reconnect' | 'badge.unavailable' | 'badge.connecting'
- | 'signOut.title' | 'signOut.body'
- | 'activation.title' | 'activation.body' | 'activation.later'
- | 'notice.connected' | 'notice.signed-out' | 'notice.action-failed'
- | 'close'
+/** A transient outcome the page reports outside its own lifetime; `seq` distinguishes repeats. */
+export interface McpAccountNotice {
+ readonly seq: number
+ readonly kind: 'connected' | 'signed-out' | 'action-failed'
+}
-type LocaleNamespace = Extract
+/** One account as this browser shows it: the Host's entry plus the stream state, pending action, and notice. */
+export interface McpAccountSnapshot {
+ readonly entry: McpAccountEntry
+ /** Whether the Host stream is delivering. */
+ readonly linked: boolean
+ /** Whether an action this browser started for the account has not settled. */
+ readonly busy: boolean
+ readonly notice: McpAccountNotice | undefined
+}
-/** Locale namespaces whose dictionary is exactly {@link McpAccountKey}. */
-export type McpAccountNamespace = {
- [N in LocaleNamespace]: [LocaleNamespaceMap[N]] extends [McpAccountKey]
- ? [McpAccountKey] extends [LocaleNamespaceMap[N]] ? N : never
- : never
-}[LocaleNamespace]
-
-/** One connector's managed server, the bundle page that shows it, and the dictionary that names it. */
-export interface McpAccountRegistration {
- /** Name the connector registers its server under with the MCP manager. */
- readonly server: string
- /** npm package whose bundle page carries the account section. */
+/** The face every surface entry of one account injects. */
+export interface McpAccountFace {
+ hooks: { mcpAccount: HostObservable }
readonly packageName: string
- /** The connector's dictionary namespace. */
- readonly locale: McpAccountNamespace
-}
-
-/** The account face each slot entry injects. */
-export type McpAccountFace = ConnectionFace & { readonly packageName: string }
-
-/** The `ctx.mcpAccounts` registry. */
-export interface McpAccounts {
- /**
- * Show one account's section, title tag, activation guidance, and notices on the Plugins page.
- * @param account - the server, its bundle package, and its dictionary namespace.
- * @returns an idempotent disposer that removes the surfaces and stops observing the server.
- * @throws when another registration already occupies the package's bundle slots.
- */
- register(account: McpAccountRegistration): () => void
+ /** Pick the active language's entry of the connector's text. */
+ readonly resolveText: (text: LocalizedText) => string
+ readonly connect: () => void
+ readonly cancel: () => void
+ readonly signOut: () => void
+ readonly retry: () => void
+ readonly openAuthorization: () => void
+ readonly dismissNotice: () => void
}
diff --git a/packages/client/ui-mcp-account/src/index.ts b/packages/client/ui-mcp-account/src/index.ts
index 5133c20663..d44eace35a 100644
--- a/packages/client/ui-mcp-account/src/index.ts
+++ b/packages/client/ui-mcp-account/src/index.ts
@@ -1,9 +1,117 @@
/**
- * MCP account surfaces plugin, Node half. Pure UI plugin: the empty apply
- * exists so the plugin appears in the host cordis.yml / Loader; the browser
- * half ships via exports["./client"], discovered through the package.json
- * dsh.client declaration.
+ * MCP account surfaces, Host half. Connector plugins register their OAuth server's account with `ctx.mcpAccounts`; the
+ * Plugins page follows every registered account, with the MCP manager's view of its server, through the `mcpAccounts`
+ * Remote, and authorizes, cancels, signs out, and retries through the manager's own Remote.
+ * @module @deepseek-ai/dsh-client-ui-mcp-account
*/
-/** Host plugin body — no host-side behavior for this surface plugin. */
-export function apply(): void {}
+import type { Context } from '@deepseek-ai/cordis'
+import type {} from '@deepseek-ai/dsh-mcp-manager'
+import type { McpManagedServerView } from '@deepseek-ai/dsh-mcp-manager/types'
+import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
+import type { McpAccountRegistration, McpAccountsView } from './types.ts'
+
+export type * from './types.ts'
+
+declare module '@deepseek-ai/cordis' {
+ interface Context {
+ /** Connector accounts on the Plugins page. */
+ mcpAccounts: McpAccounts
+ }
+}
+
+/** Holds the registered accounts and serves them, with their servers' manager views, to the Plugins page. */
+export default class McpAccounts extends TypertRemoteService {
+ static inject = ['mcpServers']
+
+ private readonly accounts = new Map()
+ private readonly listeners = new Set<() => void>()
+ private readonly lifetime = new AbortController()
+
+ /** @param ctx - the Host context carrying the MCP manager. */
+ constructor(ctx: Context) {
+ super(ctx, 'mcpAccounts')
+ ctx.effect(() => () => { this.lifetime.abort(new Error('mcpAccounts: registry disposed')) })
+ }
+
+ /**
+ * Show one account on the Plugins page for as long as the returned disposer has not run.
+ * @param registration - the server name, the bundle package, and the connector's text.
+ * @returns an idempotent disposer that withdraws the account.
+ * @throws when another account already uses the package or the server.
+ */
+ register(registration: McpAccountRegistration): () => void {
+ const { server, packageName } = registration
+ for (const account of this.accounts.values()) {
+ if (account.packageName === packageName) throw new Error(`mcpAccounts: ${packageName} is already registered`)
+ if (account.server === server) throw new Error(`mcpAccounts: server ${server} is already registered`)
+ }
+ this.accounts.set(packageName, registration)
+ this.changed()
+ let active = true
+ return () => {
+ if (!active) return
+ active = false
+ this.accounts.delete(packageName)
+ this.changed()
+ }
+ }
+
+ /**
+ * Follow every registered account with the manager's view of its server.
+ * @param signal - the Client's observation lifetime; disposal also ends the stream.
+ * @returns the accounts once the manager lists its servers, then after each change of either, coalescing changes that
+ * arrive before the next read; ends with the manager's stream.
+ * @throws what the manager's stream throws.
+ */
+ @Remote({ mode: 'stream' })
+ async *watch(signal: AbortSignal): AsyncIterable {
+ const stop = new AbortController()
+ const ended = AbortSignal.any([signal, this.lifetime.signal, stop.signal])
+ let servers: readonly McpManagedServerView[] | undefined
+ let failure: { readonly error: unknown } | undefined
+ let wake = Promise.withResolvers()
+ let dirty = true
+ const notify = (): void => { dirty = true; wake.resolve() }
+ this.listeners.add(notify)
+ ended.addEventListener('abort', notify, { once: true })
+ const following = (async () => {
+ try {
+ for await (const next of this.ctx.mcpServers.watch(ended)) {
+ servers = next
+ notify()
+ }
+ } catch (error) {
+ failure = { error }
+ } finally {
+ stop.abort()
+ }
+ })()
+ try {
+ for (;;) {
+ if (!dirty) await wake.promise
+ if (failure !== undefined) throw failure.error
+ if (ended.aborted) break
+ wake = Promise.withResolvers()
+ dirty = false
+ if (servers === undefined) continue
+ const listed = servers
+ yield {
+ accounts: [...this.accounts.values()].map((account) => {
+ const view = listed.find(server => server.name === account.server)
+ return view === undefined ? account : { ...account, view }
+ }),
+ }
+ }
+ } finally {
+ this.listeners.delete(notify)
+ ended.removeEventListener('abort', notify)
+ stop.abort()
+ await following
+ }
+ }
+
+ private changed(): void {
+ for (const notify of this.listeners) notify()
+ }
+}
diff --git a/packages/client/ui-mcp-account/src/types.ts b/packages/client/ui-mcp-account/src/types.ts
new file mode 100644
index 0000000000..6446bcc86c
--- /dev/null
+++ b/packages/client/ui-mcp-account/src/types.ts
@@ -0,0 +1,51 @@
+/** The Plugins page account a connector registers for its MCP server, and what the page receives about it. */
+import type { McpManagedServerView } from '@deepseek-ai/dsh-mcp-manager/types'
+import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
+
+/**
+ * The text that names the connector's service; every other string comes from this package's dictionary.
+ * @typeParam Text - each string's type; a connector narrows it to require every language it ships.
+ */
+export interface McpAccountCopy {
+ /** The section title, such as the service's account. */
+ readonly title: Text
+ /** The connect button's label, which the activation prompt also uses. */
+ readonly connect: Text
+ /** The prompt after the bundle is switched on while no account is connected. */
+ readonly activation: { readonly title: Text; readonly body: Text }
+ /** The detail line of each state that names the service. */
+ readonly detail: {
+ readonly disconnected: Text
+ readonly waitingBrowser: Text
+ readonly authorizing: Text
+ readonly connecting: Text
+ readonly connected: Text
+ /** The service no longer accepts the grant. */
+ readonly rejected: Text
+ /** The grant lacks a permission the server requires. */
+ readonly scope: Text
+ }
+ /** The sign-out confirmation, including what signing out removes. */
+ readonly signOut: { readonly title: Text; readonly body: Text }
+ /** What a connection and a sign-out report in the browser that started them. */
+ readonly notice: { readonly connected: Text; readonly signedOut: Text }
+}
+
+/** One connector's account, registered with the Host's `ctx.mcpAccounts`. */
+export interface McpAccountRegistration {
+ /** The name the connector registers its server under with the MCP manager. */
+ readonly server: string
+ /** npm package whose bundle page carries the section and tag. */
+ readonly packageName: string
+ readonly copy: McpAccountCopy
+}
+
+/** One registered account as the Plugins page receives it, with the manager's view of its server once the manager lists it. */
+export interface McpAccountEntry extends McpAccountRegistration {
+ readonly view?: McpManagedServerView
+}
+
+/** Every registered account, as each change publishes it. */
+export interface McpAccountsView {
+ readonly accounts: readonly McpAccountEntry[]
+}
diff --git a/packages/client/ui-mcp-account/tests/components.client.spec.tsx b/packages/client/ui-mcp-account/tests/components.client.spec.tsx
index 4b79e90b19..c33c648eea 100644
--- a/packages/client/ui-mcp-account/tests/components.client.spec.tsx
+++ b/packages/client/ui-mcp-account/tests/components.client.spec.tsx
@@ -1,5 +1,5 @@
// @vitest-environment jsdom
-/** The connection section, title tag, activation guidance, and notices render the Host entry the page mirrors. */
+/** The account surfaces render the Host entry with the connector's text and this package's shared copy. */
import type { ComponentProps } from 'react'
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import type { McpManagedServerStatus, McpManagedServerView } from '@deepseek-ai/dsh-api-remotes/client'
@@ -7,15 +7,29 @@ import { bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-tes
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
import type { PluginPackageRef, PluginsSubject } from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
import type { McpOAuthAttemptId, McpOAuthAttemptView } from '@deepseek-ai/dsh-mcp-client/types'
+import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest'
import { afterEach, expect, it, vi } from 'vitest'
-import type { ConnectionSnapshot } from '../src/client/connection.ts'
import { McpAccountActivation, McpAccountBadge, McpAccountSection, McpAccountToast } from '../src/client/McpAccount.tsx'
+import type { McpAccountSnapshot } from '../src/client/types.ts'
+import type { McpAccountCopy } from '../src/types.ts'
afterEach(cleanup)
const MISSING: McpManagedServerStatus = { state: 'waiting-authorization', reason: 'missing', lastError: 'x' }
const CONNECTED: McpManagedServerStatus = { state: 'connected', toolCount: 1, connectedAt: 1 }
const PACKAGE = '@acme/docs'
+const zh = (text: string): LocalizedText => ({ en: `en ${text}`, zh: text })
+
+const COPY: McpAccountCopy = {
+ title: zh('Docs 账号'), connect: zh('连接 Docs'),
+ activation: { title: zh('连接 Docs?'), body: zh('Docs 已开启。') },
+ detail: {
+ disconnected: zh('尚未连接 Docs。'), waitingBrowser: zh('在浏览器中完成授权。'), authorizing: zh('正在授权。'),
+ connecting: zh('正在连接 Docs。'), connected: zh('已连接 Docs。'), rejected: zh('Docs 拒绝了授权。'), scope: zh('Docs 需要更多权限。'),
+ },
+ signOut: { title: zh('退出 Docs?'), body: zh('将删除授权。') },
+ notice: { connected: zh('Docs 已连接'), signedOut: zh('已退出 Docs') },
+}
function server(status: McpManagedServerStatus, phase?: McpOAuthAttemptView['phase'], authorizationUrl?: string): McpManagedServerView {
return {
@@ -24,102 +38,129 @@ function server(status: McpManagedServerStatus, phase?: McpOAuthAttemptView['pha
}
}
-function fixture(initial: Partial = {}) {
- const state = createSnapshotStore({ server: undefined, linked: true, busy: false, notice: undefined, ...initial })
+interface Change extends Partial> {
+ readonly view?: McpManagedServerView | undefined
+}
+
+function snapshot({ view, ...change }: Change): McpAccountSnapshot {
+ const entry = { server: 'docs', packageName: PACKAGE, copy: COPY, ...view === undefined ? {} : { view } }
+ return { entry, linked: true, busy: false, notice: undefined, ...change }
+}
+
+function fixture(initial: Change = {}) {
+ let current = initial
+ const state = createSnapshotStore(snapshot(initial))
const face = {
packageName: PACKAGE,
useMcpAccount: bindSnapshotSelector(state),
+ resolveText: (text: LocalizedText) => typeof text === 'string' ? text : text.zh ?? text.en,
connect: vi.fn(), cancel: vi.fn(), signOut: vi.fn(), retry: vi.fn(), openAuthorization: vi.fn(), dismissNotice: vi.fn(),
t: makeTranslate(),
}
- return { state, face, set: (change: Partial) => { act(() => { state.set({ ...state.getSnapshot(), ...change }) }) } }
+ return {
+ state, face,
+ set(change: Change) {
+ current = { ...current, ...change }
+ act(() => { state.set(snapshot(current)) })
+ },
+ }
}
const button = (name: string) => screen.getByRole('button', { name })
-it('offers the next step for each connection state', () => {
- const b = fixture({ server: server(MISSING) })
- render()
+it('offers the next step for each connection state with the connector\'s text', () => {
+ const b = fixture({ view: server(MISSING) })
+ const { container } = render()
+ expect(screen.getByText('Docs 账号')).toBeTruthy()
expect(screen.getByText('status.disconnected')).toBeTruthy()
+ expect(screen.getByText('尚未连接 Docs。')).toBeTruthy()
expect(screen.getByText('hostBrowser')).toBeTruthy()
- fireEvent.click(button('action.connect'))
+ expect(container.querySelector('[data-mcp-account="disconnected"][data-mcp-account-package="@acme/docs"]')).toBeTruthy()
+ fireEvent.click(button('连接 Docs'))
expect(b.face.connect).toHaveBeenCalledOnce()
- b.set({ server: server(MISSING, 'waiting-browser', 'https://docs.test') })
- expect(screen.getByText('detail.waiting-browser')).toBeTruthy()
+ b.set({ view: server(MISSING, 'waiting-browser', 'https://docs.test') })
+ expect(screen.getByText('在浏览器中完成授权。')).toBeTruthy()
fireEvent.click(button('action.open'))
fireEvent.click(button('action.cancel'))
expect(b.face.openAuthorization).toHaveBeenCalledOnce()
expect(b.face.cancel).toHaveBeenCalledOnce()
- b.set({ server: server(MISSING, 'exchanging') })
+ b.set({ view: server(MISSING, 'exchanging') })
+ expect(screen.getByText('正在授权。')).toBeTruthy()
expect(screen.queryByRole('button', { name: 'action.open' })).toBeNull()
fireEvent.click(button('action.cancel'))
expect(b.face.cancel).toHaveBeenCalledTimes(2)
- b.set({ server: server(MISSING, 'failed') })
+ b.set({ view: server(MISSING, 'failed') })
expect(screen.getByRole('alert').textContent).toBe('failed')
- b.set({ server: server({ state: 'waiting-authorization', reason: 'scope', lastError: 'x' }) })
- expect(screen.getByText('detail.reconnect.scope')).toBeTruthy()
+ b.set({ view: server({ state: 'waiting-authorization', reason: 'scope', lastError: 'x' }) })
+ expect(screen.getByText('Docs 需要更多权限。')).toBeTruthy()
fireEvent.click(button('action.reconnect'))
expect(b.face.connect).toHaveBeenCalledTimes(2)
+ b.set({ view: server({ state: 'waiting-authorization', reason: 'rejected', lastError: 'x' }) })
+ expect(screen.getByText('Docs 拒绝了授权。')).toBeTruthy()
+ b.set({ view: server({ state: 'waiting-authorization', reason: 'expired', lastError: 'x' }) })
+ expect(screen.getByText('detail.reconnect.expired')).toBeTruthy()
- b.set({ server: server({ state: 'failed', reason: 'gave-up' }) })
+ b.set({ view: server({ state: 'failed', reason: 'gave-up' }) })
+ expect(screen.getByText('detail.unavailable')).toBeTruthy()
fireEvent.click(button('action.retry'))
expect(b.face.retry).toHaveBeenCalledOnce()
// Only a Host restart recovers incomplete cleanup, so the page offers no retry.
- b.set({ server: server({ state: 'failed', reason: 'cleanup', result: { closeConfirmed: false } }) })
- expect(screen.getByText('detail.unavailable')).toBeTruthy()
+ b.set({ view: server({ state: 'failed', reason: 'cleanup', result: { closeConfirmed: false } }) })
expect(screen.queryAllByRole('button')).toHaveLength(0)
- b.set({ server: server({ state: 'connecting', attempt: 0 }) })
+ b.set({ view: server({ state: 'connecting', attempt: 0 }) })
+ expect(screen.getByText('正在连接 Docs。')).toBeTruthy()
expect(screen.queryAllByRole('button')).toHaveLength(0)
- b.set({ server: undefined })
+ b.set({ view: undefined })
expect(screen.getByText('status.checking')).toBeTruthy()
expect(document.querySelector('[data-mcp-account="checking"] p')?.textContent).toBe('hostBrowser')
})
it('disables actions while one is pending or the Host stream is offline', () => {
- const b = fixture({ server: server(MISSING), busy: true })
+ const b = fixture({ view: server(MISSING), busy: true })
render()
- expect(button('action.connect').hasAttribute('disabled')).toBe(true)
+ expect(button('连接 Docs').hasAttribute('disabled')).toBe(true)
b.set({ busy: false, linked: false })
- expect(button('action.connect').hasAttribute('disabled')).toBe(true)
+ expect(button('连接 Docs').hasAttribute('disabled')).toBe(true)
b.set({ linked: true })
- expect(button('action.connect').hasAttribute('disabled')).toBe(false)
+ expect(button('连接 Docs').hasAttribute('disabled')).toBe(false)
})
-it('signs out only after confirmation', () => {
- const b = fixture({ server: server(CONNECTED) })
+it('signs out only after the connector\'s confirmation', () => {
+ const b = fixture({ view: server(CONNECTED) })
render()
- expect(screen.getByText('detail.connected')).toBeTruthy()
+ expect(screen.getByText('已连接 Docs。')).toBeTruthy()
fireEvent.click(button('action.signOut'))
- expect(screen.getByText('signOut.body')).toBeTruthy()
+ expect(screen.getByText('退出 Docs?')).toBeTruthy()
+ expect(screen.getByText('将删除授权。')).toBeTruthy()
fireEvent.click(button('action.cancel'))
expect(b.face.signOut).not.toHaveBeenCalled()
fireEvent.click(button('action.signOut'))
fireEvent.click(button('close'))
- expect(screen.queryByText('signOut.body')).toBeNull()
+ expect(screen.queryByText('将删除授权。')).toBeNull()
fireEvent.click(button('action.signOut'))
fireEvent.click(screen.getAllByRole('button', { name: 'action.signOut' }).at(-1)!)
expect(b.face.signOut).toHaveBeenCalledOnce()
})
it('tags only the enabled bundle of its package', () => {
- const b = fixture({ server: server(CONNECTED) })
+ const b = fixture({ view: server(CONNECTED) })
const pkg = (name: string, enabled = true): PluginPackageRef => ({ name, installed: true, availability: 'profile', official: false, enabled, rows: [] })
const badge = (subject: PluginsSubject) =>
} />
const { rerender } = render(badge({ kind: 'bundle', pkg: pkg(PACKAGE) }))
expect(screen.getByText('badge.connected')).toBeTruthy()
- b.set({ server: server(MISSING, 'waiting-browser') })
+ b.set({ view: server(MISSING, 'waiting-browser') })
expect(screen.getByText('badge.connecting')).toBeTruthy()
- b.set({ server: undefined })
+ b.set({ view: undefined })
expect(document.body.textContent).toBe('')
- b.set({ server: server(MISSING) })
+ b.set({ view: server(MISSING) })
rerender(badge({ kind: 'bundle', pkg: pkg(PACKAGE, false) }))
expect(document.body.textContent).toBe('')
rerender(badge({ kind: 'bundle', pkg: pkg('@acme/other') }))
@@ -130,31 +171,36 @@ it('tags only the enabled bundle of its package', () => {
expect(document.body.textContent).toBe('')
})
-it('guides a newly enabled bundle to connect, and steps aside once connected', () => {
+it('guides a newly enabled bundle to connect with the connector\'s prompt, and steps aside once connected', () => {
const b = fixture()
const onDismiss = vi.fn(), onOpenDetails = vi.fn()
const props = { ...b.face, onDismiss, onOpenDetails } as ComponentProps
render()
- expect(screen.queryByText('activation.body')).toBeNull()
+ expect(screen.queryByText('Docs 已开启。')).toBeNull()
expect(onDismiss).not.toHaveBeenCalled()
// A first connection attempt is still settling; the guidance waits for its outcome.
- b.set({ server: server({ state: 'connecting', attempt: 0 }) })
+ b.set({ view: server({ state: 'connecting', attempt: 0 }) })
expect(onDismiss).not.toHaveBeenCalled()
- b.set({ server: server(MISSING) })
- expect(screen.getByText('activation.body')).toBeTruthy()
- fireEvent.click(button('action.connect'))
+ b.set({ view: server(MISSING) })
+ expect(screen.getByText('连接 Docs?')).toBeTruthy()
+ expect(screen.getByText('Docs 已开启。')).toBeTruthy()
+ fireEvent.click(button('activation.later'))
+ expect(onDismiss).toHaveBeenCalledOnce()
+ fireEvent.click(button('连接 Docs'))
expect(onOpenDetails).toHaveBeenCalledOnce()
expect(b.face.connect).toHaveBeenCalledOnce()
- b.set({ server: server(CONNECTED) })
- expect(onDismiss).toHaveBeenCalledOnce()
+ b.set({ view: server(CONNECTED) })
+ expect(onDismiss).toHaveBeenCalledTimes(2)
})
-it('reports the latest notice and leaves dismissal to the toast', () => {
+it('reports the latest notice with the connector\'s text and leaves dismissal to the toast', () => {
const b = fixture()
render()
expect(document.body.textContent).toBe('')
b.set({ notice: { seq: 1, kind: 'connected' } })
- expect(screen.getByText('notice.connected')).toBeTruthy()
- b.set({ notice: { seq: 2, kind: 'action-failed' } })
+ expect(screen.getByText('Docs 已连接')).toBeTruthy()
+ b.set({ notice: { seq: 2, kind: 'signed-out' } })
+ expect(screen.getByText('已退出 Docs')).toBeTruthy()
+ b.set({ notice: { seq: 3, kind: 'action-failed' } })
expect(screen.getByText('notice.action-failed')).toBeTruthy()
})
diff --git a/packages/client/ui-mcp-account/tests/connection.client.spec.ts b/packages/client/ui-mcp-account/tests/connection.client.spec.ts
index b2d0be8171..e6a4ec1067 100644
--- a/packages/client/ui-mcp-account/tests/connection.client.spec.ts
+++ b/packages/client/ui-mcp-account/tests/connection.client.spec.ts
@@ -1,14 +1,18 @@
// @vitest-environment jsdom
-/** The page derives one server's connection from the manager's entry and drives authorization through its Remote. */
+/** The page follows every registered account through one Host stream and drives authorization through the manager's Remote. */
import { Context } from '@deepseek-ai/cordis'
import type { RemoteStreamOptions } from '@deepseek-ai/dsh-api-gateway/client'
import type { McpManagedServerStatus, McpManagedServerView } from '@deepseek-ai/dsh-api-remotes/client'
import type { McpOAuthAttemptId, McpOAuthAttemptView } from '@deepseek-ai/dsh-mcp-client/types'
-import { RemoteError } from '@deepseek-ai/dsh-typert-protocol'
+import { RemoteError, type RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
import { expect, it, onTestFinished, vi } from 'vitest'
-import { McpAccountConnection, presentConnection } from '../src/client/connection.ts'
+import { McpAccountsConnection, presentConnection } from '../src/client/connection.ts'
+import type { McpAccountEntry, McpAccountsView } from '../src/types.ts'
const ATTEMPT = 'attempt-1' as McpOAuthAttemptId
+const DOCS = '@acme/docs'
+const WIKI = '@acme/wiki'
+const ok = (value: T): RemoteResult => ({ ok: true, value })
function attempt(phase: McpOAuthAttemptView['phase'], authorizationUrl?: string, id = ATTEMPT): McpOAuthAttemptView {
return { id, phase, ...authorizationUrl === undefined ? {} : { authorizationUrl } }
@@ -47,43 +51,55 @@ it.each<[string, McpManagedServerView | undefined, ReturnType void) | undefined, closed = false, failure: Error | undefined, accepted = 0
- let options!: RemoteStreamOptions
+ let options!: RemoteStreamOptions
const stream = {
async *[Symbol.asyncIterator]() {
for (;;) {
if (failure !== undefined) throw failure
- if (closed) return
+ // A queued item still arrives after close, as an item the stream yielded just before disposal does.
const next = queue.shift()
- if (next === undefined) { await new Promise((resolve) => { wake = resolve }); continue }
- yield { value: next, accept: () => { accepted++ } }
+ if (next !== undefined) { yield { value: next, accept: () => { accepted++ } }; continue }
+ if (closed) return
+ await new Promise((resolve) => { wake = resolve })
}
},
dispose: vi.fn(async () => { closed = true; wake?.() }),
}
- const ok = (value: T) => ({ ok: true as const, value })
- const remote = {
- watch: vi.fn(),
- startAuthorization: vi.fn(async () => ok(attempt('starting'))),
- cancelAuthorization: vi.fn(async () => ok(undefined)),
- signOut: vi.fn(async () => ok(undefined)),
- restart: vi.fn(async () => ok(undefined)),
+ const registry = { watch: vi.fn() }
+ const servers = {
+ startAuthorization: vi.fn(async (_server: string) => ok(attempt('starting'))),
+ cancelAuthorization: vi.fn(async (_server: string, _id: McpOAuthAttemptId): Promise> => ok(undefined)),
+ signOut: vi.fn(async (_server: string): Promise> => ok(undefined)),
+ restart: vi.fn(async (_server: string): Promise> => ok(undefined)),
}
const ctx = new Context()
- ctx.provide('remote', { mcpServers: remote, $stream: (value: typeof options) => { options = value; return stream } })
+ ctx.provide('remote', { $stream: (value: typeof options) => { options = value; return stream } })
const open = vi.spyOn(window, 'open').mockReturnValue(null)
- const connection = new McpAccountConnection(ctx, 'docs')
+ const connection = new McpAccountsConnection(ctx, registry, servers)
onTestFinished(async () => { await connection.dispose(); open.mockRestore(); await ctx.fiber.dispose() })
- const face = connection.face()
- const snapshot = () => connection.state.getSnapshot()
return {
- connection, face, remote, open, stream, snapshot, options: () => options,
- async publish(...servers: McpManagedServerView[]) {
+ connection, registry, servers, open, stream, options: () => options,
+ face: (packageName = DOCS) => connection.actions(packageName),
+ snapshot: (packageName = DOCS) => connection.accounts.getSnapshot().get(packageName)?.getSnapshot(),
+ deliver(...entries: McpAccountEntry[]) { queue.push({ accounts: entries }); wake?.() },
+ async publish(...entries: McpAccountEntry[]) {
const target = accepted + 1
- queue.push([{ name: 'other', configured: true, status: CONNECTED }, ...servers])
- wake?.()
+ this.deliver(...entries)
await vi.waitFor(() => { expect(accepted).toBe(target) })
},
fail(error: Error) { failure = error; wake?.() },
@@ -91,120 +107,175 @@ function fixture() {
}
}
-it('mirrors only its server entry and opens the manager stream', async () => {
+const settle = async (b: ReturnType, packageName = DOCS) => {
+ await vi.waitFor(() => { expect(b.snapshot(packageName)?.busy).toBe(false) })
+}
+// Every fixture step settles through microtasks, so one macrotask lets a pending action finish.
+const drain = () => new Promise((resolve) => { setTimeout(resolve, 0) })
+
+it('opens the registry stream and keeps one snapshot source per account the Host registers', async () => {
const b = fixture()
const signal = new AbortController().signal
b.options().open(signal)
- expect(b.remote.watch).toHaveBeenCalledWith(signal)
+ expect(b.registry.watch).toHaveBeenCalledWith(signal)
expect(b.options().ended(true)).toBeInstanceOf(Error)
- await b.publish()
- expect(b.snapshot()).toMatchObject({ server: undefined, linked: true, busy: false })
+ await b.publish(entry(server(MISSING)))
+ expect(b.snapshot()).toEqual({ entry: entry(server(MISSING)), linked: true, busy: false, notice: undefined })
+ const shown = b.connection.accounts.getSnapshot()
+ const store = shown.get(DOCS)
+
+ await b.publish(entry(server(CONNECTED)))
+ expect(b.connection.accounts.getSnapshot()).toBe(shown)
+ expect(store?.getSnapshot().entry.view?.status).toEqual(CONNECTED)
+ await b.publish(entry(server(CONNECTED)), entry(undefined, WIKI))
+ expect([...b.connection.accounts.getSnapshot().keys()]).toEqual([DOCS, WIKI])
+ expect(b.connection.accounts.getSnapshot().get(DOCS)).toBe(store)
+ await b.publish(entry(undefined, WIKI))
+ expect([...b.connection.accounts.getSnapshot().keys()]).toEqual([WIKI])
+})
+
+it('marks every account offline while the carrier is down', async () => {
+ const b = fixture()
+ await b.publish(entry(server(MISSING)), entry(undefined, WIKI))
b.options().carrierFailed?.(new Error('lost'))
- expect(b.snapshot().linked).toBe(false)
- await b.publish(server(MISSING))
- expect(b.snapshot().linked).toBe(true)
+ expect([b.snapshot()?.linked, b.snapshot(WIKI)?.linked]).toEqual([false, false])
+ await b.publish(entry(server(MISSING)), entry(undefined, WIKI))
+ expect([b.snapshot()?.linked, b.snapshot(WIKI)?.linked]).toEqual([true, true])
})
it('opens the authorization page once for the attempt this browser started, then reports the connection', async () => {
const b = fixture()
- await b.publish(server(MISSING))
- b.face.connect()
- await vi.waitFor(() => { expect(b.snapshot().busy).toBe(false) })
- expect(b.remote.startAuthorization).toHaveBeenCalledWith('docs')
- const waiting = server(MISSING, attempt('waiting-browser', 'https://docs.test/auth'))
- await b.publish(waiting)
- await b.publish(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth')))
+ await b.publish(entry(server(MISSING)), entry(undefined, WIKI))
+ b.face().connect()
+ await settle(b)
+ expect(b.servers.startAuthorization).toHaveBeenCalledWith('docs')
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth'))), entry(undefined, WIKI))
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth'))), entry(undefined, WIKI))
expect(b.open).toHaveBeenCalledOnce()
expect(b.open).toHaveBeenCalledWith('https://docs.test/auth', '_blank', 'noopener,noreferrer')
- b.face.openAuthorization()
+ b.face().openAuthorization()
expect(b.open).toHaveBeenCalledTimes(2)
- await b.publish(server(CONNECTED, attempt('authorized')))
- expect(b.snapshot().notice).toEqual({ seq: 1, kind: 'connected' })
- await b.publish(server(CONNECTED, attempt('authorized')))
- expect(b.snapshot().notice?.seq).toBe(1)
- b.face.dismissNotice()
- expect(b.snapshot().notice).toBeUndefined()
+ await b.publish(entry(server(CONNECTED, attempt('authorized'))), entry(undefined, WIKI))
+ expect(b.snapshot()?.notice).toEqual({ seq: 1, kind: 'connected' })
+ expect(b.snapshot(WIKI)?.notice).toBeUndefined()
+ await b.publish(entry(server(CONNECTED, attempt('authorized'))), entry(undefined, WIKI))
+ expect(b.snapshot()?.notice?.seq).toBe(1)
+ b.face().dismissNotice()
+ expect(b.snapshot()?.notice).toBeUndefined()
})
it('opens a page the stream reported before the start call answered, and never another browser\'s attempt', async () => {
const b = fixture()
- const answer = Promise.withResolvers<{ ok: true; value: McpOAuthAttemptView }>()
- b.remote.startAuthorization.mockReturnValueOnce(answer.promise)
- await b.publish(server(MISSING, attempt('waiting-browser', 'https://docs.test/other', 'other' as McpOAuthAttemptId)))
+ const answer = Promise.withResolvers>()
+ b.servers.startAuthorization.mockReturnValueOnce(answer.promise)
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/other', 'other' as McpOAuthAttemptId))))
expect(b.open).not.toHaveBeenCalled()
- b.face.connect()
- await b.publish(server(MISSING, attempt('waiting-browser', 'http://127.0.0.1:3080/authorize')))
+ b.face().connect()
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'http://127.0.0.1:3080/authorize'))))
expect(b.open).not.toHaveBeenCalled()
- answer.resolve({ ok: true, value: attempt('starting') })
+ answer.resolve(ok(attempt('starting')))
await vi.waitFor(() => { expect(b.open).toHaveBeenCalledWith('http://127.0.0.1:3080/authorize', '_blank', 'noopener,noreferrer') })
})
it.each(['http://docs.test/auth', 'javascript:alert(1)', 'not a url'])('refuses to open %s', async (url) => {
const b = fixture()
- b.face.connect()
- await vi.waitFor(() => { expect(b.snapshot().busy).toBe(false) })
- await b.publish(server(MISSING, attempt('waiting-browser', url)))
- b.face.openAuthorization()
+ await b.publish(entry(server(MISSING)))
+ b.face().connect()
+ await settle(b)
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', url))))
+ b.face().openAuthorization()
expect(b.open).not.toHaveBeenCalled()
})
it('cancels only an active attempt and forgets an attempt that ended', async () => {
const b = fixture()
- await b.publish(server(MISSING))
- b.face.cancel()
- b.face.openAuthorization()
- expect(b.remote.cancelAuthorization).not.toHaveBeenCalled()
+ await b.publish(entry(server(MISSING)))
+ b.face().cancel()
+ b.face().openAuthorization()
+ expect(b.servers.cancelAuthorization).not.toHaveBeenCalled()
expect(b.open).not.toHaveBeenCalled()
- b.face.connect()
- await vi.waitFor(() => { expect(b.snapshot().busy).toBe(false) })
- await b.publish(server(MISSING, attempt('starting')))
- b.face.cancel()
- await vi.waitFor(() => { expect(b.remote.cancelAuthorization).toHaveBeenCalledWith('docs', ATTEMPT) })
- await b.publish(server(MISSING, attempt('cancelled')))
- await b.publish(server(MISSING, attempt('waiting-browser', 'https://docs.test/late')))
+ b.face().connect()
+ await settle(b)
+ await b.publish(entry(server(MISSING, attempt('starting'))))
+ b.face().cancel()
+ await vi.waitFor(() => { expect(b.servers.cancelAuthorization).toHaveBeenCalledWith('docs', ATTEMPT) })
+ await b.publish(entry(server(MISSING, attempt('cancelled'))))
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/late'))))
expect(b.open).not.toHaveBeenCalled()
- expect(b.snapshot().notice).toBeUndefined()
+ expect(b.snapshot()?.notice).toBeUndefined()
})
it('signs out and retries through the manager, reporting a failed action once and ignoring overlapping clicks', async () => {
const b = fixture()
- await b.publish(server(CONNECTED))
- b.face.signOut()
- b.face.retry()
- await vi.waitFor(() => { expect(b.snapshot().notice?.kind).toBe('signed-out') })
- expect(b.remote.signOut).toHaveBeenCalledWith('docs')
- expect(b.remote.restart).not.toHaveBeenCalled()
- b.remote.restart.mockResolvedValueOnce({ ok: false, error: new RemoteError('gateway/internal', 'offline', {}) } as never)
- b.face.retry()
- await vi.waitFor(() => { expect(b.snapshot().notice?.kind).toBe('action-failed') })
- expect(b.remote.restart).toHaveBeenCalledWith('docs')
- expect(b.snapshot().busy).toBe(false)
+ await b.publish(entry(server(CONNECTED)))
+ b.face().signOut()
+ b.face().retry()
+ await vi.waitFor(() => { expect(b.snapshot()?.notice?.kind).toBe('signed-out') })
+ expect(b.servers.signOut).toHaveBeenCalledWith('docs')
+ expect(b.servers.restart).not.toHaveBeenCalled()
+ b.servers.restart.mockResolvedValueOnce({ ok: false, error: new RemoteError('gateway/internal', 'offline', {}) })
+ b.face().retry()
+ await vi.waitFor(() => { expect(b.snapshot()?.notice?.kind).toBe('action-failed') })
+ expect(b.servers.restart).toHaveBeenCalledWith('docs')
+ expect(b.snapshot()?.busy).toBe(false)
+})
+
+it('ignores actions for an account the Host has not registered, and follows no attempt of a withdrawn account', async () => {
+ const b = fixture()
+ for (const action of Object.values(b.face())) action()
+ await b.publish(entry(server(MISSING)))
+ const answer = Promise.withResolvers>()
+ b.servers.startAuthorization.mockReturnValueOnce(answer.promise)
+ b.face().connect()
+ await b.publish()
+ answer.resolve(ok(attempt('starting')))
+ await drain()
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth'))))
+ expect(b.snapshot()?.busy).toBe(false)
+ expect(b.open).not.toHaveBeenCalled()
+
+ await b.publish(entry(server(MISSING)))
+ b.face().connect()
+ await settle(b)
+ await b.publish(entry(undefined, WIKI))
+ await b.publish(entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth'))))
+ expect(b.open).not.toHaveBeenCalled()
+ expect(b.servers.startAuthorization).toHaveBeenCalledTimes(2)
+ expect([b.servers.cancelAuthorization, b.servers.signOut, b.servers.restart].every(call => call.mock.calls.length === 0)).toBe(true)
})
it('stops observing on disposal without reporting the closed stream', async () => {
const b = fixture()
- await b.publish(server(MISSING))
- await b.connection.dispose()
- expect(b.stream.dispose).toHaveBeenCalled()
- expect(b.snapshot().linked).toBe(true)
-})
-
-it('reports nothing for a stream failure or an action that settles after disposal', async () => {
- const b = fixture()
- await b.publish(server(CONNECTED))
- const answer = Promise.withResolvers<{ ok: true; value: undefined }>()
- b.remote.signOut.mockReturnValueOnce(answer.promise)
- b.face.signOut()
+ await b.publish(entry(server(MISSING)))
b.failOnClose(new Error('closed'))
await b.connection.dispose()
- answer.resolve({ ok: true, value: undefined })
- await vi.waitFor(() => { expect(b.snapshot().busy).toBe(false) })
- expect(b.snapshot()).toMatchObject({ linked: true, notice: undefined })
+ expect(b.stream.dispose).toHaveBeenCalled()
+ expect(b.snapshot()?.linked).toBe(true)
+})
+
+it('reports nothing and follows no attempt for an action that settles after disposal, and ignores a view yielded after it', async () => {
+ const b = fixture()
+ const waiting = entry(server(MISSING, attempt('waiting-browser', 'https://docs.test/auth')), WIKI)
+ await b.publish(entry(server(CONNECTED)), waiting)
+ const signedOut = Promise.withResolvers>()
+ const started = Promise.withResolvers>()
+ b.servers.signOut.mockReturnValueOnce(signedOut.promise)
+ b.servers.startAuthorization.mockReturnValueOnce(started.promise)
+ b.face().signOut()
+ b.face(WIKI).connect()
+ b.deliver(entry(server(MISSING)), waiting)
+ await b.connection.dispose()
+ signedOut.resolve(ok(undefined))
+ started.resolve(ok(attempt('starting')))
+ await settle(b)
+ await settle(b, WIKI)
+ expect(b.snapshot()).toMatchObject({ entry: entry(server(CONNECTED)), linked: true, notice: undefined })
+ expect(b.open).not.toHaveBeenCalled()
})
it('marks the page offline when the stream fails', async () => {
const b = fixture()
- await b.publish(server(MISSING))
+ await b.publish(entry(server(MISSING)))
b.fail(new Error('invalid frame'))
- await vi.waitFor(() => { expect(b.snapshot().linked).toBe(false) })
+ await vi.waitFor(() => { expect(b.snapshot()?.linked).toBe(false) })
})
diff --git a/packages/client/ui-mcp-account/tests/mount.client.spec.ts b/packages/client/ui-mcp-account/tests/mount.client.spec.ts
new file mode 100644
index 0000000000..7c7663f258
--- /dev/null
+++ b/packages/client/ui-mcp-account/tests/mount.client.spec.ts
@@ -0,0 +1,152 @@
+/**
+ * The browser plugin mounts the `mcpAccounts` Remote and shows each account the Host registers, withdrawing its surfaces
+ * with the account or the plugin.
+ */
+import assert from 'node:assert/strict'
+import { Context, Service } from '@deepseek-ai/cordis'
+import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client'
+import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client'
+import type { McpOAuthAttemptId, McpOAuthAttemptView } from '@deepseek-ai/dsh-mcp-client/types'
+import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol'
+import { expect, it, onTestFinished, vi } from 'vitest'
+import { NS } from '../src/client/locales.ts'
+import { McpAccountActivation, McpAccountBadge, McpAccountSection, McpAccountToast } from '../src/client/McpAccount.tsx'
+import { inject, mountMcpAccounts } from '../src/client/mount.ts'
+import type { McpAccountFace } from '../src/client/types.ts'
+import type { McpAccountEntry, McpAccountsView } from '../src/types.ts'
+
+const contribution: TypertRemoteContribution = { package: '@deepseek-ai/dsh-client-ui-mcp-account', descriptors: [] }
+const DOCS = '@acme/docs'
+const WIKI = '@acme/wiki'
+
+const SLOTS = [
+ ['plugins.bundle.config', McpAccountSection],
+ ['plugins.bundle.activation', McpAccountActivation],
+ ['plugins.detail.badge', McpAccountBadge],
+ ['shell.overlay', McpAccountToast],
+] as const
+
+function isFace(value: Record): asserts value is Record & McpAccountFace {
+ assert(typeof value.packageName === 'string' && typeof value.resolveText === 'function' && typeof value.connect === 'function')
+ assert(typeof value.hooks === 'object' && value.hooks !== null)
+}
+
+/** Read the face a slot entry injects. */
+function faceOf(item: { readonly inject?: (() => Record) | undefined }): McpAccountFace {
+ const face = item.inject!()
+ isFace(face)
+ return face
+}
+
+function entry(packageName: string): McpAccountEntry {
+ const server = packageName === DOCS ? 'docs' : 'wiki'
+ return {
+ server, packageName, copy: {
+ title: server, connect: `Connect ${server}`, activation: { title: server, body: server },
+ detail: { disconnected: '-', waitingBrowser: '-', authorizing: '-', connecting: '-', connected: '-', rejected: '-', scope: '-' },
+ signOut: { title: server, body: server }, notice: { connected: server, signedOut: server },
+ },
+ }
+}
+
+async function bench() {
+ const ctx = new Context()
+ onTestFinished(async () => { await ctx.fiber.dispose() })
+ const queue: McpAccountsView[] = []
+ let wake: (() => void) | undefined, closed = false, accepted = 0
+ const closeStream = vi.fn(async () => { closed = true; wake?.() })
+ const unmount = vi.fn(async () => {})
+ const startAuthorization = vi.fn(async (_server: string): Promise> =>
+ ({ ok: true, value: { id: 'attempt-1' as McpOAuthAttemptId, phase: 'starting' } }))
+ class Remote extends Service {
+ constructor() { super(ctx, 'remote') }
+ async $mount(received: TypertRemoteContribution) {
+ expect(received).toBe(contribution)
+ return unmount
+ }
+ $stream() {
+ return {
+ async *[Symbol.asyncIterator]() {
+ for (;;) {
+ const next = queue.shift()
+ if (next !== undefined) { yield { value: next, accept: () => { accepted++ } }; continue }
+ if (closed) return
+ await new Promise((resolve) => { wake = resolve })
+ }
+ },
+ dispose: closeStream,
+ }
+ }
+ }
+ new Remote()
+ ctx.provide('remote.mcpAccounts', { watch: vi.fn() })
+ ctx.provide('remote.mcpServers', { startAuthorization, cancelAuthorization: vi.fn(), signOut: vi.fn(), restart: vi.fn() })
+ const locale = new LocaleRuntime(ctx)
+ ctx.provide('locale', locale)
+ await ctx.plugin(SlotRegistry)
+ ctx.slots.register({ name: 'root', children: {
+ 'plugins.bundle.activation': { kind: 'keyed', scope: 'root' },
+ 'plugins.bundle.config': { kind: 'keyed', scope: 'root' },
+ 'plugins.detail.badge': { kind: 'list', scope: 'root' },
+ 'shell.overlay': { kind: 'list', scope: 'root' },
+ } } as never, () => null)
+ const owners = () => SLOTS.flatMap(([slot]) => ctx.slots.entries(slot).map(item => faceOf(item).packageName))
+ return {
+ ctx, locale, startAuthorization, closeStream, unmount, owners,
+ mount: () => ctx.plugin({ inject: [...inject], apply: scope => mountMcpAccounts(scope, contribution) }),
+ async publish(...entries: McpAccountEntry[]) {
+ const target = accepted + 1
+ queue.push({ accounts: entries })
+ wake?.()
+ await vi.waitFor(() => { expect(accepted).toBe(target) })
+ },
+ }
+}
+
+it('shows each registered account with one face under the shared dictionary and withdraws the surfaces of an account the Host drops', async () => {
+ const b = await bench()
+ await b.mount()
+ expect(b.locale.bind(NS)('action.retry')).toBe('Retry')
+ expect(b.owners()).toEqual([])
+ await b.publish(entry(DOCS), entry(WIKI))
+ const faces = SLOTS.map(([slot, component]) => {
+ const found = b.ctx.slots.entries(slot).find(item => faceOf(item).packageName === DOCS)
+ expect(found).toMatchObject({ locale: NS, component })
+ return faceOf(found!)
+ })
+ expect(new Set(faces.map(face => face.hooks.mcpAccount)).size).toBe(1)
+ expect(faces[0]!.hooks.mcpAccount.getSnapshot().entry).toEqual(entry(DOCS))
+ expect(faces[0]!.resolveText({ en: 'Connected', zh: '已连接' })).toBe('Connected')
+ expect(b.ctx.slots.entries('plugins.bundle.config').map(item => item.options.key)).toEqual([DOCS, WIKI])
+ expect(b.ctx.slots.entries('plugins.bundle.activation').map(item => item.options.key)).toEqual([DOCS, WIKI])
+ expect(b.ctx.slots.entries('plugins.detail.badge').map(item => item.options.id)).toEqual(['docs.connection', 'wiki.connection'])
+ expect(b.ctx.slots.entries('shell.overlay').map(item => item.options.id)).toEqual(['docs.connection-toast', 'wiki.connection-toast'])
+ faces[0]!.connect()
+ await vi.waitFor(() => { expect(b.startAuthorization).toHaveBeenCalledWith('docs') })
+
+ await b.publish(entry(WIKI))
+ expect(b.owners()).toEqual([WIKI, WIKI, WIKI, WIKI])
+ await b.publish(entry(WIKI), entry(DOCS))
+ expect(b.owners().filter(owner => owner === DOCS)).toHaveLength(4)
+})
+
+it('withdraws every surface, the dictionaries, and the stream before the Remote when the plugin unloads', async () => {
+ const b = await bench()
+ const fiber = b.mount()
+ await fiber
+ await b.publish(entry(DOCS), entry(WIKI))
+ expect(b.owners()).toHaveLength(8)
+ await fiber.dispose()
+ expect(b.owners()).toEqual([])
+ expect(b.locale.bind(NS)('action.retry')).toBe('action.retry')
+ expect(b.closeStream).toHaveBeenCalledOnce()
+ expect(b.unmount).toHaveBeenCalledOnce()
+ expect(b.closeStream.mock.invocationCallOrder[0]).toBeLessThan(b.unmount.mock.invocationCallOrder[0]!)
+})
+
+it('withdraws the Remote when the surfaces fail to mount', async () => {
+ const b = await bench()
+ vi.spyOn(b.locale, 'register').mockImplementation(() => { throw new Error('registration failed') })
+ await expect(mountMcpAccounts(b.ctx, contribution)).rejects.toThrow('registration failed')
+ expect(b.unmount).toHaveBeenCalledOnce()
+})
diff --git a/packages/client/ui-mcp-account/tests/registry.host.spec.ts b/packages/client/ui-mcp-account/tests/registry.host.spec.ts
new file mode 100644
index 0000000000..8343d898b3
--- /dev/null
+++ b/packages/client/ui-mcp-account/tests/registry.host.spec.ts
@@ -0,0 +1,139 @@
+/** The registry serves every registered account to the Plugins page with the MCP manager's view of its server. */
+import { Context } from '@deepseek-ai/cordis'
+import type { McpManagedServerView } from '@deepseek-ai/dsh-mcp-manager/types'
+import { expect, it, onTestFinished, vi } from 'vitest'
+import McpAccounts from '../src/index.ts'
+import type { McpAccountCopy, McpAccountRegistration, McpAccountsView } from '../src/types.ts'
+
+const COPY: McpAccountCopy = {
+ title: { en: 'Docs account', zh: 'Docs 账号' },
+ connect: 'Connect Docs',
+ activation: { title: 'Connect Docs', body: 'Docs is on.' },
+ detail: {
+ disconnected: 'Not connected.', waitingBrowser: 'Finish in the browser.', authorizing: 'Authorizing.', connecting: 'Connecting.',
+ connected: 'Connected.', rejected: 'Docs rejected the grant.', scope: 'Docs needs more permissions.',
+ },
+ signOut: { title: 'Sign out of Docs?', body: 'Removes the grant.' },
+ notice: { connected: 'Docs connected', signedOut: 'Signed out of Docs' },
+}
+
+const DOCS: McpAccountRegistration = { server: 'docs', packageName: '@acme/docs', copy: COPY }
+const WIKI: McpAccountRegistration = { server: 'wiki', packageName: '@acme/wiki', copy: COPY }
+
+function view(name: string, toolCount = 1): McpManagedServerView {
+ return { name, configured: true, status: { state: 'connected', toolCount, connectedAt: 1 } }
+}
+
+/** A manager whose stream yields the lists the test publishes, until the subscriber stops it, it fails, or it ends. */
+function manager() {
+ const lists: McpManagedServerView[][] = []
+ const signals: AbortSignal[] = []
+ let wake: (() => void) | undefined
+ let failure: Error | undefined
+ let ended = false
+ const service = {
+ async *watch(signal: AbortSignal): AsyncIterable {
+ signals.push(signal)
+ signal.addEventListener('abort', () => { wake?.() }, { once: true })
+ for (;;) {
+ if (signal.aborted) return
+ if (failure !== undefined) throw failure
+ const next = lists.shift()
+ if (next !== undefined) { yield next; continue }
+ if (ended) return
+ await new Promise((resolve) => { wake = resolve })
+ }
+ },
+ }
+ return {
+ service, signals,
+ list(...servers: McpManagedServerView[]) { lists.push(servers); wake?.() },
+ fail(error: Error) { failure = error; wake?.() },
+ end() { ended = true; wake?.() },
+ }
+}
+
+async function registry(servers = manager()) {
+ const ctx = new Context()
+ onTestFinished(async () => { await ctx.fiber.dispose() })
+ ctx.provide('mcpServers', servers.service)
+ const fiber = ctx.plugin(McpAccounts)
+ await fiber
+ return { ctx, fiber, servers }
+}
+
+function watch(ctx: Context, signal = new AbortController().signal): AsyncIterator {
+ return ctx.mcpAccounts.watch(signal)[Symbol.asyncIterator]()
+}
+
+it('publishes the accounts once the manager lists its servers, then after each change of either', async () => {
+ const { ctx, servers } = await registry()
+ const withdraw = ctx.mcpAccounts.register(DOCS)
+ const controller = new AbortController()
+ const stream = watch(ctx, controller.signal)
+ let read = false
+ const reading = stream.next().finally(() => { read = true })
+ await vi.waitFor(() => { expect(servers.signals).toHaveLength(1) })
+ expect(read).toBe(false)
+ servers.list(view('docs'), view('other'))
+ expect((await reading).value).toEqual({ accounts: [{ ...DOCS, view: view('docs') }] })
+
+ // An account whose server the manager does not list carries no view.
+ ctx.mcpAccounts.register(WIKI)
+ expect((await stream.next()).value).toEqual({ accounts: [{ ...DOCS, view: view('docs') }, WIKI] })
+ servers.list(view('docs', 3), view('wiki'))
+ expect((await stream.next()).value).toEqual({ accounts: [{ ...DOCS, view: view('docs', 3) }, { ...WIKI, view: view('wiki') }] })
+
+ withdraw()
+ withdraw()
+ expect((await stream.next()).value).toEqual({ accounts: [{ ...WIKI, view: view('wiki') }] })
+ controller.abort()
+ expect((await stream.next()).done).toBe(true)
+ expect(servers.signals[0]!.aborted).toBe(true)
+})
+
+it('publishes the accounts registered before the manager lists in one view', async () => {
+ const { ctx, servers } = await registry()
+ const stream = watch(ctx)
+ const reading = stream.next()
+ ctx.mcpAccounts.register(DOCS)
+ ctx.mcpAccounts.register(WIKI)
+ servers.list()
+ expect((await reading).value).toEqual({ accounts: [DOCS, WIKI] })
+})
+
+it('refuses a second account for a package or a server', async () => {
+ const { ctx } = await registry()
+ ctx.mcpAccounts.register(DOCS)
+ expect(() => ctx.mcpAccounts.register({ ...WIKI, packageName: DOCS.packageName })).toThrow('mcpAccounts: @acme/docs is already registered')
+ expect(() => ctx.mcpAccounts.register({ ...WIKI, server: DOCS.server })).toThrow('mcpAccounts: server docs is already registered')
+})
+
+it('rethrows what the manager stream throws', async () => {
+ const { ctx, servers } = await registry()
+ const stream = watch(ctx)
+ servers.list()
+ await stream.next()
+ servers.fail(new Error('manager offline'))
+ await expect(stream.next()).rejects.toThrow('manager offline')
+})
+
+it('ends with the manager stream', async () => {
+ const { ctx, servers } = await registry()
+ const stream = watch(ctx)
+ servers.list()
+ await stream.next()
+ servers.end()
+ expect((await stream.next()).done).toBe(true)
+})
+
+it('ends every stream when the registry unloads', async () => {
+ const { ctx, fiber, servers } = await registry()
+ const stream = watch(ctx)
+ servers.list()
+ await stream.next()
+ const pending = stream.next()
+ await fiber.dispose()
+ expect((await pending).done).toBe(true)
+ expect(servers.signals[0]!.aborted).toBe(true)
+})
diff --git a/packages/client/ui-mcp-account/tsconfig.client.json b/packages/client/ui-mcp-account/tsconfig.client.json
new file mode 100644
index 0000000000..06e93f1d06
--- /dev/null
+++ b/packages/client/ui-mcp-account/tsconfig.client.json
@@ -0,0 +1,60 @@
+{
+ "extends": "../../../tsconfig.base.client.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types",
+ "tsBuildInfoFile": "lib/tsconfig.client.tsbuildinfo"
+ },
+ "include": [
+ "src/client",
+ "src/css-modules.d.ts",
+ "src/types.ts"
+ ],
+ "references": [
+ {
+ "path": "../../../vendor/cordis"
+ },
+ {
+ "path": "../../api/gateway/tsconfig.client.json"
+ },
+ {
+ "path": "../../api/remotes/tsconfig.client.json"
+ },
+ {
+ "path": "../store"
+ },
+ {
+ "path": "../ui-layout"
+ },
+ {
+ "path": "../ui-plugin-manager/tsconfig.client.json"
+ },
+ {
+ "path": "../ui-primitives"
+ },
+ {
+ "path": "../ui-renderer"
+ },
+ {
+ "path": "../ui-slots"
+ },
+ {
+ "path": "../../mcp/mcp-client"
+ },
+ {
+ "path": "../../typert/protocol"
+ },
+ {
+ "path": "../../util/values"
+ },
+ {
+ "path": "../locale/tsconfig.client.json"
+ },
+ {
+ "path": "../../util/package-manifest"
+ },
+ {
+ "path": "../../mcp/mcp-manager"
+ }
+ ]
+}
diff --git a/packages/client/ui-mcp-account/tsconfig.host.json b/packages/client/ui-mcp-account/tsconfig.host.json
new file mode 100644
index 0000000000..a0b64f5bfa
--- /dev/null
+++ b/packages/client/ui-mcp-account/tsconfig.host.json
@@ -0,0 +1,26 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "outDir": "lib/types",
+ "tsBuildInfoFile": "lib/tsconfig.host.tsbuildinfo"
+ },
+ "files": [
+ "src/index.ts",
+ "src/types.ts"
+ ],
+ "references": [
+ {
+ "path": "../../../vendor/cordis"
+ },
+ {
+ "path": "../../mcp/mcp-manager"
+ },
+ {
+ "path": "../../typert/protocol"
+ },
+ {
+ "path": "../../util/package-manifest"
+ }
+ ]
+}
diff --git a/packages/client/ui-mcp-account/tsconfig.json b/packages/client/ui-mcp-account/tsconfig.json
index 3150520026..2eca820546 100644
--- a/packages/client/ui-mcp-account/tsconfig.json
+++ b/packages/client/ui-mcp-account/tsconfig.json
@@ -1,48 +1,11 @@
{
- "extends": "../../../tsconfig.base.client.json",
- "compilerOptions": {
- "rootDir": "src",
- "outDir": "lib/types"
- },
- "include": [
- "src"
- ],
+ "files": [],
"references": [
{
- "path": "../../../vendor/cordis"
+ "path": "./tsconfig.host.json"
},
{
- "path": "../../api/gateway/tsconfig.client.json"
- },
- {
- "path": "../../api/remotes/tsconfig.client.json"
- },
- {
- "path": "../store"
- },
- {
- "path": "../ui-layout"
- },
- {
- "path": "../ui-plugin-manager/tsconfig.client.json"
- },
- {
- "path": "../ui-primitives"
- },
- {
- "path": "../ui-renderer"
- },
- {
- "path": "../ui-slots"
- },
- {
- "path": "../../mcp/mcp-client"
- },
- {
- "path": "../../typert/protocol"
- },
- {
- "path": "../../util/values"
+ "path": "./tsconfig.client.json"
}
]
}
diff --git a/packages/client/ui-mcp-account/tsdown.config.ts b/packages/client/ui-mcp-account/tsdown.config.ts
index 7aa03cebc1..620261533c 100644
--- a/packages/client/ui-mcp-account/tsdown.config.ts
+++ b/packages/client/ui-mcp-account/tsdown.config.ts
@@ -1,3 +1,3 @@
import { clientBundle } from '../tsdown.client.ts'
-export default clientBundle(import.meta.dirname, ['lib/types/index.js'])
+export default clientBundle(import.meta.dirname, ['lib/types/index.js'], { hostPhase: true })
diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts
index 50854a2eb8..ab18ef9889 100644
--- a/packages/extensions/tool-cordis/src/api-catalog.ts
+++ b/packages/extensions/tool-cordis/src/api-catalog.ts
@@ -2032,6 +2032,27 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [
},
],
},
+ {
+ key: 'mcpAccounts',
+ summary: 'Holds the registered accounts and serves them, with their servers\' manager views, to the Plugins page.',
+ description: 'Holds the registered accounts and serves them, with their servers\' manager views, to the Plugins page.',
+ methods: [
+ {
+ signature: 'register(registration: McpAccountRegistration): () => void',
+ description: 'Show one account on the Plugins page for as long as the returned disposer has not run.',
+ parameters: [{ name: 'registration', description: 'the server name, the bundle package, and the connector\'s text.' }],
+ returns: 'an idempotent disposer that withdraws the account.',
+ throws: ['when another account already uses the package or the server.'],
+ },
+ {
+ signature: '@Remote({ mode: \'stream\' }) async *watch(signal: AbortSignal): AsyncIterable',
+ description: 'Follow every registered account with the manager\'s view of its server.',
+ parameters: [{ name: 'signal', description: 'the Client\'s observation lifetime; disposal also ends the stream.' }],
+ returns: 'the accounts once the manager lists its servers, then after each change of either, coalescing changes that arrive before the next read; ends with the manager\'s stream.',
+ throws: ['what the manager\'s stream throws.'],
+ },
+ ],
+ },
{
key: 'mcpResources',
summary: 'Scoped resource access plus three tools shared by configured MCP servers.',
@@ -7150,6 +7171,22 @@ export const TYPE_API: readonly TypeApiEntry[] = [
name: 'MatcherValue',
declaration: 'export type MatcherValue = string | number | boolean | null | RegExp | readonly (string | number | boolean | null)[];',
},
+ {
+ name: 'McpAccountCopy',
+ declaration: 'export interface McpAccountCopy {\n readonly title: Text;\n readonly connect: Text;\n readonly activation: {\n readonly title: Text;\n readonly body: Text;\n };\n readonly detail: {\n readonly disconnected: Text;\n readonly waitingBrowser: Text;\n readonly authorizing: Text;\n readonly connecting: Text;\n readonly connected: Text;\n readonly rejected: Text;\n readonly scope: Text;\n };\n readonly signOut: {\n readonly title: Text;\n readonly body: Text;\n };\n readonly notice: {\n readonly connected: Text;\n readonly signedOut: Text;\n };\n}',
+ },
+ {
+ name: 'McpAccountEntry',
+ declaration: 'export interface McpAccountEntry extends McpAccountRegistration {\n readonly view?: McpManagedServerView;\n}',
+ },
+ {
+ name: 'McpAccountRegistration',
+ declaration: 'export interface McpAccountRegistration {\n readonly server: string;\n readonly packageName: string;\n readonly copy: McpAccountCopy;\n}',
+ },
+ {
+ name: 'McpAccountsView',
+ declaration: 'export interface McpAccountsView {\n readonly accounts: readonly McpAccountEntry[];\n}',
+ },
{
name: 'McpAuthorizationReason',
declaration: 'export type McpAuthorizationReason = \'missing\' | \'expired\' | \'binding\' | \'rejected\' | \'scope\';',
diff --git a/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md b/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md
index bfbbe9e489..5928b31c04 100644
--- a/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md
+++ b/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md
@@ -86,7 +86,7 @@ Every package below exports a Cordis plugin that a bundle patch can name in a Lo
| `@deepseek-ai/dsh-client-ui-input-trigger` | no | Input trigger pipeline: '/' and '@' detection, candidate menu, pick routing to registered sources |
| `@deepseek-ai/dsh-client-ui-jobs` | no | Session-header background-job list with on-demand streaming record panels |
| `@deepseek-ai/dsh-client-ui-layout` | no | Shell plugin: three-column AppFrame with drag handles, ctx.layout viewing-state service (navigation + panels) |
-| `@deepseek-ai/dsh-client-ui-mcp-account` | no | MCP account surfaces for connector plugins: the account section, title tag, activation guidance, and notices on the Plugins page, over the MCP manager Remote |
+| `@deepseek-ai/dsh-client-ui-mcp-account` | no | MCP account surfaces for connector plugins: the Host registry connectors register their OAuth server accounts with, and the Plugins page section, title tag, activation guidance, and notices it serves over one Remote |
| `@deepseek-ai/dsh-client-ui-message-feedback` | no | The Web feedback surface: per-message Like/Dislike in the assistant-message action strip and the feedback dialog behind both ratings and /feedback, backed by the messageFeedback and sessionFeedback Host Remotes |
| `@deepseek-ai/dsh-client-ui-model-selection` | no | Model selection over the shared model catalog, Session projection, and session.selectModel |
| `@deepseek-ai/dsh-client-ui-open-in-app` | no | Web "Open In..." controls: the Session-header split button opening the workspace directory in an installed application, and the document preview's default-application controls for one file |
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1e0e10bc07..f6356cde94 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4823,6 +4823,13 @@ importers:
version: 18.3.1
packages/client/ui-mcp-account:
+ dependencies:
+ '@deepseek-ai/dsh-typert-protocol':
+ specifier: workspace:*
+ version: link:../../typert/protocol
+ zod:
+ specifier: 4.4.3
+ version: 4.4.3
devDependencies:
'@deepseek-ai/cordis':
specifier: workspace:~
@@ -4860,9 +4867,12 @@ importers:
'@deepseek-ai/dsh-mcp-client':
specifier: workspace:*
version: link:../../mcp/mcp-client
- '@deepseek-ai/dsh-typert-protocol':
+ '@deepseek-ai/dsh-mcp-manager':
specifier: workspace:*
- version: link:../../typert/protocol
+ version: link:../../mcp/mcp-manager
+ '@deepseek-ai/dsh-package-manifest':
+ specifier: workspace:*
+ version: link:../../util/package-manifest
'@deepseek-ai/dsh-util-values':
specifier: workspace:*
version: link:../../util/values
diff --git a/scripts/gen-cordis-catalog.ts b/scripts/gen-cordis-catalog.ts
index 3a6ac57397..9be1f60ef4 100644
--- a/scripts/gen-cordis-catalog.ts
+++ b/scripts/gen-cordis-catalog.ts
@@ -64,6 +64,7 @@ export const SERVICE_PAGE: Record = {
pluginRecommendations: 'boot.md',
pluginMarket: 'boot.md',
pluginRegistryProbe: 'boot.md',
+ mcpAccounts: 'boot.md',
configEditor: 'boot.md',
profileContext: 'boot.md',
hmr: 'boot.md',
@@ -205,7 +206,6 @@ export const SERVICE_WALK_EXEMPTIONS: Record = {
commandUi: 'client-side interface-typed browser service — packages/client/ui-commands/README.md owns the API',
fileDrag: 'client-side file preparation and transfer service — packages/client/ui-file-drag/README.md owns the API',
feedbackUi: 'client-side feedback dialog service — packages/client/ui-message-feedback/README.md owns the API',
- mcpAccounts: 'client-side connector account registry — packages/client/ui-mcp-account/README.md owns the API',
conversation: 'client-side interface-typed browser service — packages/client/ui-conversation/README.md owns the API',
layout: 'client-side interface-typed browser service — packages/client/ui-layout/README.md owns the API',
pluginNavigation: 'client-side bundle navigation — packages/client/ui-plugin-manager/README.md owns the API',
@@ -1005,6 +1005,8 @@ export const TYPE_LINK_EXEMPTIONS: Readonly> = {
Profile: 'resolved profile layers are owned by packages/boot/app-boot/README.md',
PatchOptions: 'Include patch entries are owned by vendor/include (vendored upstream)',
McpResourceProvider: 'scoped resource provider is owned by packages/mcp/mcp-resources/README.md',
+ McpAccountRegistration: 'Plugins page account registration is owned by packages/client/ui-mcp-account/README.md',
+ McpAccountsView: 'registered account stream item is owned by packages/client/ui-mcp-account/README.md',
'z.ZodType': 'Zod response validation API is owned by https://zod.dev/packages/zod',
Socket: 'Node.js byte stream API is owned by https://nodejs.org/api/net.html#class-netsocket',
z: 'schemastery schema constructor is owned by vendor/schemastery (vendored upstream)',
diff --git a/scripts/gen-doc-graphs.ts b/scripts/gen-doc-graphs.ts
index d3bc4c87fe..6cd0c1dfa7 100644
--- a/scripts/gen-doc-graphs.ts
+++ b/scripts/gen-doc-graphs.ts
@@ -712,6 +712,13 @@ const SERVICE_ROLES: ServiceRole[] = [
mode: 'core',
note: 'Reconciles mcp-client instances against its volatile servers configuration, aggregates their connection statuses, and serves restart and probe to management surfaces.',
},
+ {
+ key: 'mcpAccounts',
+ pkg: 'client-ui-mcp-account',
+ title: 'MCP connector accounts on the Plugins page',
+ mode: 'service',
+ note: 'Holds the accounts MCP connector plugins register and serves them, with the manager\'s view of each server, to the Plugins page through one Remote; authorization runs through the manager.',
+ },
{
key: 'schedule',
pkg: 'schedule',
diff --git a/scripts/verify-package-readme-model-experience.ts b/scripts/verify-package-readme-model-experience.ts
index 9de2ef9d5d..4e1ebb467a 100644
--- a/scripts/verify-package-readme-model-experience.ts
+++ b/scripts/verify-package-readme-model-experience.ts
@@ -151,7 +151,7 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly> = {
'packages/client/ui-conversation': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' },
'packages/client/ui-approval': { kind: 'none', reason: 'Browser-side approval presentation; registers nothing model-facing.' },
'packages/client/ui-chat': { kind: 'none', reason: 'Browser-side Chat presentation; registers nothing model-facing.' },
- 'packages/client/ui-mcp-account': { kind: 'none', reason: 'Browser-side account controls over the MCP manager Remote; the connector and the MCP client document the tools a grant exposes.' },
+ 'packages/client/ui-mcp-account': { kind: 'none', reason: 'Plugins page account registry and controls over the MCP manager; the connector and the MCP client document the tools a grant exposes.' },
'packages/client/ui-message-feedback': { kind: 'none', reason: 'Browser-side controls over log-only message feedback; ratings and notes never enter model context or change model-input tokens.' },
'packages/client/ui-tool': { kind: 'none', reason: 'Browser-side Tool presentation layer; renders logged calls without changing model context.' },
'packages/client/ui-schedule': { kind: 'none', reason: 'Browser-side catalog, editing, and deletion of Host Schedule records; dsh-schedule owns storage and delivery, and dsh-tool-schedule contributes the model-facing tools in a preset that mounts it.' },
diff --git a/tsconfig.client.json b/tsconfig.client.json
index 208283d64c..a978b1755e 100644
--- a/tsconfig.client.json
+++ b/tsconfig.client.json
@@ -140,7 +140,7 @@
{ "path": "./packages/client/ui-directory-picker-browse" },
{ "path": "./packages/client/ui-directory-picker-native" },
{ "path": "./packages/client/ui-goal" },
- { "path": "./packages/client/ui-mcp-account" },
+ { "path": "./packages/client/ui-mcp-account/tsconfig.client.json" },
{ "path": "./packages/client/ui-message-feedback" },
{ "path": "./packages/client/ui-model-selection" },
{ "path": "./packages/client/ui-agent-preset" },
diff --git a/tsconfig.host.json b/tsconfig.host.json
index 83bbb17817..f9bb397a64 100644
--- a/tsconfig.host.json
+++ b/tsconfig.host.json
@@ -346,6 +346,7 @@
{ "path": "./packages/util/lazy-require" },
{ "path": "./packages/util/native-command" },
{ "path": "./packages/util/home-paths" },
+ { "path": "./packages/client/ui-mcp-account/tsconfig.host.json" },
{ "path": "./packages/client/ui-plugin-manager/tsconfig.host.json" },
{ "path": "./packages/client/ui-trajectory/tsconfig.host.json" },
{ "path": "./packages/util/time" },
diff --git a/vitest.config.ts b/vitest.config.ts
index c57dc090d0..631c5d92ac 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -370,6 +370,9 @@ export default defineConfig({
// The forge panel entry imports its generated Remote contribution, which exists only in lib;
// forge-panel.e2e.ts exercises the built entry, while source tests cover mountForgePanel.
'packages/experimental/client-ui-forge/src/client/index.ts',
+ // The MCP account entry imports its generated Remote contribution, which exists only in lib;
+ // built Web runs load it with the Web app, while source tests cover mountMcpAccounts.
+ 'packages/client/ui-mcp-account/src/client/index.ts',
// Slash/command/input round: per-file gaps deferred with the same
// client-lane debt. TODO(gui): cover and remove with the lane above.
'packages/client/ui-commands/src/index.ts',