refactor(tencent-docs): follow the ctx.mcpManager rename

The base publishes the MCP manager as `ctx.mcpManager`. Inject and
register through that key, and update the tests, the package and group
READMEs, and the generated configuration catalog.
This commit is contained in:
gengruilin committed 2026-11-03 13:35:16 +08:00
1 parent 97fd94fd00
commit ed376baef2
10 files changed
+18 -18

No files matched your search

+1 -1
View File
@@ -3900,7 +3900,7 @@ export interface Config {
## `@deepseek-ai/dsh-tencent-docs`
- `inject`: `mcpServers` · `systemPrompt`
- `inject`: `mcpManager` · `systemPrompt`
- `source`: [`packages/connector/tencent-docs/src/index.ts:30`](../packages/connector/tencent-docs/src/index.ts)
```ts config-catalog
+1 -1
View File
@@ -3902,7 +3902,7 @@ export interface Config {
## `@deepseek-ai/dsh-tencent-docs`
- `inject`: `mcpServers` · `systemPrompt`
- `inject`: `mcpManager` · `systemPrompt`
- `source`: [`packages/connector/tencent-docs/src/index.ts:30`](../packages/connector/tencent-docs/src/index.ts)
```ts config-catalog
+2 -2
View File
@@ -15,8 +15,8 @@
en: 1eb35b015a6c423f
zh: a8a3dceee2c9e943
/connector-application-plugins/packages:
en: 6808b457d240a08f
zh: 3dd57d8cef569e89
en: 49e4a803e45506f1
zh: 1c27a85beaa931bb
/connector-application-plugins/related-documentation:
en: fc6b2a00673cabe5
zh: a3f0169d7bf078f2
+1 -1
View File
@@ -24,7 +24,7 @@ Each package in this group is one application plugin that a user installs into a
| Package | Role | ctx key |
|---|---|---|
| [`tencent-docs/`](tencent-docs/README.md) | Registers Tencent Docs' hosted MCP server with OAuth through the shared MCP manager, adds the Tencent Docs plugin naming guidance, and shows its account on the plugin page | registers on `ctx.mcpServers`, `ctx.systemPrompt`, and `ctx.mcpAccounts` |
| [`tencent-docs/`](tencent-docs/README.md) | Registers Tencent Docs' hosted MCP server with OAuth through the shared MCP manager, adds the Tencent Docs plugin naming guidance, and shows its account on the plugin page | registers on `ctx.mcpManager`, `ctx.systemPrompt`, and `ctx.mcpAccounts` |
-----
+1 -1
View File
@@ -24,7 +24,7 @@ kind: "package-group"
| 包 | 职责 | ctx 键 |
|---|---|---|
| [`tencent-docs/`](tencent-docs/README.zh.md) | 通过共用的 MCP 管理器以 OAuth 注册腾讯文档托管的 MCP 服务器,添加腾讯文档插件称呼指引,并在插件页面显示账号 | 注册到 `ctx.mcpServers`、`ctx.systemPrompt` 与 `ctx.mcpAccounts` |
| [`tencent-docs/`](tencent-docs/README.zh.md) | 通过共用的 MCP 管理器以 OAuth 注册腾讯文档托管的 MCP 服务器,添加腾讯文档插件称呼指引,并在插件页面显示账号 | 注册到 `ctx.mcpManager`、`ctx.systemPrompt` 与 `ctx.mcpAccounts` |
-----
@@ -18,8 +18,8 @@
en: bbff250eba0f1b89
zh: 0a618f05cc88ee2b
/deepseek-ai-dsh-tencent-docs/use-this-package/install-into-a-profile:
en: 4df4523404762aec
zh: 9600a0178d957b93
en: 20fa3e7548836b22
zh: 18e89d0082bc6746
/deepseek-ai-dsh-tencent-docs/use-this-package/authorize-and-sign-out:
en: 3977a8375eeaa8be
zh: 45c513aff4997e78
@@ -30,8 +30,8 @@
en: 78ac23e5b8c3b3b8
zh: c7647d4d295b09a1
/deepseek-ai-dsh-tencent-docs/understand-the-implementation:
en: affbc92a321bc526
zh: 746c63f47ba95254
en: d52a8bb6b0853467
zh: 96bf9507ad43c599
/deepseek-ai-dsh-tencent-docs/further-exploration:
en: f1eff44168e63e36
zh: 65f7fce6a40a615e
+2 -2
View File
@@ -33,7 +33,7 @@ Install the package as a bundle, for example from the Web sidebar's **Plugins**
dsh plugin --profile web add @deepseek-ai/dsh-tencent-docs
```
The bundle patch inserts the `tencent-docs` row after the profile's other layers. The plugin requires the `mcpServers` and `systemPrompt` services, which the Web and Desktop compositions provide through [`dsh-web-app`](../../bundle/web-app/README.md). In a profile without the MCP manager, such as `headless`, the plugin does not activate, and startup prints a warning that names the missing `mcpServers` service.
The bundle patch inserts the `tencent-docs` row after the profile's other layers. The plugin requires the `mcpManager` and `systemPrompt` services, which the Web and Desktop compositions provide through [`dsh-web-app`](../../bundle/web-app/README.md). In a profile without the MCP manager, such as `headless`, the plugin does not activate, and startup prints a warning that names the missing `mcpManager` service.
### Authorize and sign out
@@ -73,7 +73,7 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-te
<details>
<summary>Implementation internals — click to expand</summary>
[`cordis.patch.yml`](cordis.patch.yml) inserts one row with id `tencent-docs` naming this package, so the package is both the bundle and its only row; `config` overrides target that id. The Host half, [`src/index.ts`](src/index.ts), makes two registrations, both effects of the plugin's fiber: `ctx.mcpServers.register('tencent-docs', …)` adds a Streamable HTTP entry with the configured `url` and OAuth credential key, and `ctx.systemPrompt.section()` adds the naming guidance at the `MCP_SERVERS` order. The server name fixes the `mcp__tencent-docs__` tool namespace, and the credential key fixes the grant address, so a reloaded or reinstalled plugin reaches the same tools and grant. The manager validates the entry when it is registered; a configured or registered server that already uses the name or key makes the plugin fail to load before the guidance is added. The entry sets no `scope`, so authorization requests the `docs:read docs:write docs:manage` scopes listed in the protected-resource metadata that Tencent Docs' 401 challenge names, and the authorization page keeps the `authType=2` query of Tencent Docs' authorization endpoint.
[`cordis.patch.yml`](cordis.patch.yml) inserts one row with id `tencent-docs` naming this package, so the package is both the bundle and its only row; `config` overrides target that id. The Host half, [`src/index.ts`](src/index.ts), makes two registrations, both effects of the plugin's fiber: `ctx.mcpManager.register('tencent-docs', …)` adds a Streamable HTTP entry with the configured `url` and OAuth credential key, and `ctx.systemPrompt.section()` adds the naming guidance at the `MCP_SERVERS` order. The server name fixes the `mcp__tencent-docs__` tool namespace, and the credential key fixes the grant address, so a reloaded or reinstalled plugin reaches the same tools and grant. The manager validates the entry when it is registered; a configured or registered server that already uses the name or key makes the plugin fail to load before the guidance is added. The entry sets no `scope`, so authorization requests the `docs:read docs:write docs:manage` scopes listed in the protected-resource metadata that Tencent Docs' 401 challenge names, and the authorization page keeps the `authType=2` query of Tencent Docs' authorization endpoint.
While the account registry runs, the plugin also calls `ctx.mcpAccounts.register({ server: 'tencent-docs', packageName: '@deepseek-ai/dsh-tencent-docs', copy })`, where [`src/copy.ts`](src/copy.ts) holds the text that names Tencent Docs in every shipped language; [`ui-mcp-account`](../../client/ui-mcp-account/README.md) then serves the `tencent-docs` entry and renders the section, guidance, tag, and toast described above. A composition without the registry, such as a headless profile, loads the plugin without the account section.
+2 -2
View File
@@ -33,7 +33,7 @@ kind: "package-bundle"
dsh plugin --profile web add @deepseek-ai/dsh-tencent-docs
```
bundle patch 在 profile 其他层之后插入 `tencent-docs` 行。插件需要 `mcpServers` 与 `systemPrompt` 服务,Web 与 Desktop 组合通过 [`dsh-web-app`](../../bundle/web-app/README.zh.md) 提供它们。在没有 MCP 管理器的 profile(例如 `headless`)中,插件不会激活,启动时会打印一条警告,指出缺少 `mcpServers` 服务。
bundle patch 在 profile 其他层之后插入 `tencent-docs` 行。插件需要 `mcpManager` 与 `systemPrompt` 服务,Web 与 Desktop 组合通过 [`dsh-web-app`](../../bundle/web-app/README.zh.md) 提供它们。在没有 MCP 管理器的 profile(例如 `headless`)中,插件不会激活,启动时会打印一条警告,指出缺少 `mcpManager` 服务。
### 授权与退出登录
@@ -73,7 +73,7 @@ bundle patch 在 profile 其他层之后插入 `tencent-docs` 行。插件需要
<details>
<summary>实现内部机制——点击展开</summary>
[`cordis.patch.yml`](cordis.patch.yml) 插入一行 id 为 `tencent-docs` 的条目,指向本包,因此本包既是 bundle,也是其唯一的一行;`config` 覆盖以该 id 为目标。Host 侧的 [`src/index.ts`](src/index.ts) 进行两项注册,二者都是插件 fiber 的 effect:`ctx.mcpServers.register('tencent-docs', …)` 以配置的 `url` 和 OAuth 凭据 key 添加一个 Streamable HTTP 条目,`ctx.systemPrompt.section()` 在 `MCP_SERVERS` 排序位置添加称呼指引。服务器名固定了 `mcp__tencent-docs__` 工具命名空间,凭据 key 固定了 grant 地址,因此重新加载或重新安装的插件会得到同样的工具和 grant。管理器在注册时校验条目;如果已配置或已注册的服务器占用了该名称或 key,插件会在添加指引之前加载失败。条目未设置 `scope`,因此授权请求腾讯文档 401 challenge 所指资源元数据中列出的 `docs:read docs:write docs:manage` scope,授权页面保留腾讯文档授权端点自带的 `authType=2` 查询参数。
[`cordis.patch.yml`](cordis.patch.yml) 插入一行 id 为 `tencent-docs` 的条目,指向本包,因此本包既是 bundle,也是其唯一的一行;`config` 覆盖以该 id 为目标。Host 侧的 [`src/index.ts`](src/index.ts) 进行两项注册,二者都是插件 fiber 的 effect:`ctx.mcpManager.register('tencent-docs', …)` 以配置的 `url` 和 OAuth 凭据 key 添加一个 Streamable HTTP 条目,`ctx.systemPrompt.section()` 在 `MCP_SERVERS` 排序位置添加称呼指引。服务器名固定了 `mcp__tencent-docs__` 工具命名空间,凭据 key 固定了 grant 地址,因此重新加载或重新安装的插件会得到同样的工具和 grant。管理器在注册时校验条目;如果已配置或已注册的服务器占用了该名称或 key,插件会在添加指引之前加载失败。条目未设置 `scope`,因此授权请求腾讯文档 401 challenge 所指资源元数据中列出的 `docs:read docs:write docs:manage` scope,授权页面保留腾讯文档授权端点自带的 `authType=2` 查询参数。
账号注册表运行时,插件还调用 `ctx.mcpAccounts.register({ server: 'tencent-docs', packageName: '@deepseek-ai/dsh-tencent-docs', copy })`,其中 [`src/copy.ts`](src/copy.ts) 以每种已发布语言保存指明腾讯文档的文案;随后由 [`ui-mcp-account`](../../client/ui-mcp-account/README.zh.md) 提供 `tencent-docs` 条目,并渲染上文所述的区块、引导、标签与 toast。没有注册表的组合(如 headless profile)加载插件时不带账号区块。
+2 -2
View File
@@ -17,7 +17,7 @@ import type {} from '@deepseek-ai/dsh-system-prompt'
import { COPY } from './copy.ts'
export const name = 'tencent-docs'
export const inject = ['mcpServers', 'systemPrompt']
export const inject = ['mcpManager', 'systemPrompt']
// One shared account per Host: a fixed server name keeps tool names stable and
// a fixed credential key lets a reinstalled plugin reuse its saved grant.
@@ -49,7 +49,7 @@ export const Config: z<Partial<Config>, Config> = z.object({
* @throws when another configured or registered server already uses the `tencent-docs` name or credential key.
*/
export function apply(ctx: Context, config: Config): void {
ctx.mcpServers.register(SERVER_NAME, {
ctx.mcpManager.register(SERVER_NAME, {
transport: 'streamable-http',
url: config.url,
oauth: { credentialKey: CREDENTIAL_KEY },
@@ -24,7 +24,7 @@ async function fixture(servers: Record<string, unknown> = {}) {
const world = await oauthWorld()
await world.ctx.plugin(McpResources)
await managerProfile(world.ctx, { base: { servers } })
const view = () => world.ctx.mcpServers.list().find(entry => entry.name === 'tencent-docs')
const view = () => world.ctx.mcpManager.list().find(entry => entry.name === 'tencent-docs')
const state = async (expected: McpManagedServerStatus['state']) => {
await vi.waitFor(() => { expect(view()?.status.state).toBe(expected) }, { timeout: 5000 })
}
@@ -42,7 +42,7 @@ async function fixture(servers: Record<string, unknown> = {}) {
return created
}
const authorize = async () => {
await world.ctx.mcpServers.startAuthorization('tencent-docs')
await world.ctx.mcpManager.startAuthorization('tencent-docs')
expect(await callback(await phase(() => view()?.authorization, 'waiting-browser'))).toBe(200)
await state('connected')
}