DSH / Atlas
2026-11-24implementedarchitecture

Server rows beside the MCP manager's `servers` dictionary

MCP 管理器 `servers` 字典之外的服务器行

Every MCP server that a deployment declared lived in one field: the `servers` dictionary in the config of the `mcp-manager` row. The entries of that dictionary are independent of one another, while the Loader composes, switches, and validates rows, so a composition layer could not handle one server alone: - A patch that sets a row's `config` replaces the whole config of the layers before it. A bundle patch, a profile

English

Problem

Every MCP server that a deployment declared lived in one field: the servers dictionary in the config of the mcp-manager row. The entries of that dictionary are independent of one another, while the Loader composes, switches, and validates rows, so a composition layer could not handle one server alone:

  • A patch that sets a row's config replaces the whole config of the layers before it. A bundle patch, a profile patch, or a --patch overlay that added or changed one server therefore restated every other server, and two layers that each added a server could not both take effect.
  • disabled is a key of a row, and a dictionary entry has none. A layer switched one entry off only by restating the dictionary with enabled: false on that entry.
  • The dictionary is validated as one value. One invalid entry fails the manager row at startup, so no server starts.

Decision

A server can be declared as a row of its own, and the servers dictionary stays as it was.

  • @deepseek-ai/dsh-mcp-manager/server is a second plugin of the manager package. Its config is the server's name in serverName and the fields of one servers entry except enabled, built from the entry schema that the manager applies to dictionary entries and registrations.
  • The row calls ctx.mcpManager.register(serverName, entry) and does nothing else. Connector plugins already registered their servers through that call, so the manager gains no code for rows: a row's server is validated, named, mounted, listed, and reconciled as every registered entry is.
  • The Loader's handling of rows decides a row's server. A patch adds a server with insert, changes one by naming its row's id with a new config, and switches one off with disabled: true on that row; a composition that stops listing a row removes its server. The registration is an effect of the row's fiber, so a changed row restarts alone and its disposal waits for the server's unmount. An invalid row fails alone, and the Host reports it among the entries that did not activate.
  • The dictionary, its Settings namespace, the entry field enabled, the disabled status, and every error text are unchanged, so no stored configuration is converted and no interface is removed.
  • Rows and dictionary entries share one namespace of server names under the rule that registrations already followed: the declaration that holds a name keeps it. A row that names the server of a dictionary entry fails alone, a disabled entry included, and a dictionary write that names the server of a running row is refused.
  • A row takes no enabled field and fails when its config carries one. A registration is enabled while it exists, so an enabled: false copied from a dictionary entry would otherwise start a server that its deployment switched off.

This partially supersedes MCP server manager: its rejection of separate Loader entries. That note still owns the dictionary, its Settings writes, the manager's child instances, the MCP client host, status, credential templates, probing, the Remote methods, and OAuth.

Alternatives considered

Remove the servers dictionary. Every server would then have one declaration form, and the manager would lose its config hook, its volatile listener, the entry field enabled, and the disabled status. Published packages accept servers and their README documents it, so a configuration that declares servers there would stop loading until someone rewrites it by hand, and a disabled server could no longer be listed, probed, or authorized. The pi-ai provider rows keep their dictionary beside the rows for the same reason.

Let the declaration that comes last win, as the pi-ai provider rows do. pi-ai lets a row replace a dictionary entry of the same route because a deployment must be able to override a provider that the Models page stored for a person. No shipped surface stores servers in the manager's dictionary, connector plugins rely on a held name being refused, and a row that reports its failure is easier to notice than a server that another declaration replaced.

A separate package for the row plugin. The row is one call to register() with a config that the manager's entry schema validates. A separate package needs that schema exported from the manager's plugin entry, which exports only what the Loader loads and its Service and error classes, and adds a manifest, a README, a locale set, and gate entries for one apply function. A second entry of the manager package imports the schema as a sibling module.

An enabled field on a row. A row would then have two switches. disabled is the one that a patch sets without restating the row's config, and a row that is switched off through it reserves neither its server name nor its oauth.credentialKey.

Consequences

  • A layer adds, changes, switches off, or removes one server row without restating the others. An invalid row fails alone, and a changed row restarts alone.
  • The manager has two declaration forms. The dictionary keeps its costs for the servers declared in it: a layer that sets servers replaces the dictionary, and one invalid entry fails the manager row, which leaves every server row waiting.
  • The two forms switch a server off differently. A dictionary entry with enabled: false stays listed as disabled and can be probed and authorized. A switched-off row is not loaded, so the manager does not know its server.
  • A layer moves a server from the dictionary to a row by deleting the entry and adding the row in one edit.
  • The manager offers no way to edit server rows: a row is not a Settings namespace, and the manager's Remote has no method that adds or changes an entry. The experimental Connectors tab edits rows in the composition instead: it adds, edits, and removes rows of the profile patch with ctx.configEditor's insert(), editRow(), and remove(), switches a row through the plugin manager, and lists the rows from ctx.configEditor.configuration(), because list() holds neither a switched-off row nor which servers have a row.
  • ctx.configEditor.edit() stores a schema-valid edit of a row before the manager validates the entry and restores the previous config when the manager refuses it. A hand-edited file is checked only when the row loads.
  • The manager's refusals of a row's entry start with servers.<name>, as its refusals of every registered entry do.

Testing

Composition tests boot server rows through the Loader from a bundle patch and a profile patch, beside the existing tests of the dictionary. They cover adding, editing, switching off, and removing a row, a row that fails alone, a duplicate server name, a row that carries enabled, a row and a dictionary entry that run together, a row refused for the name of a dictionary entry, a dictionary write refused for the name of a running row, a server moved from the dictionary to a row in one edit, and an invalid dictionary entry that leaves the rows waiting. A process-level test runs the shipped headless profile with one dictionary entry, one valid row, and three refused rows and checks the startup warning. Manager tests register and dispose a row on real Cordis and observe the server's removal.

中文

问题

部署声明的每台 MCP 服务器都位于同一个字段:mcp-manager 行配置中的 servers 字典。字典中的条目彼此独立,而 Loader 组合、开关和校验的是行,因此组合层无法单独处理一台服务器:

  • 设置行 config 的 patch 会替换此前各层的整个配置。因此,添加或修改一台服务器的 bundle patch、profile patch 或 --patch overlay 必须重述其他所有服务器,两个各添加一台服务器的层无法同时生效。
  • disabled 是行的键,字典条目没有这个键。某一层要关闭一个条目,只能重述整个字典,并在该条目上写 enabled: false。
  • 字典作为一个值整体校验。一个无效条目会使管理器行在启动时失败,于是没有任何服务器启动。

决策

服务器可以声明为一条独立的行,servers 字典保持原样。

  • @deepseek-ai/dsh-mcp-manager/server 是管理器包的第二个插件。它的配置是 serverName 中的服务器名,以及一个 servers 条目除 enabled 以外的各字段,由管理器用于字典条目和注册的条目 schema 构建。
  • 该行只调用 ctx.mcpManager.register(serverName, entry),不做其他事。连接器插件本来就通过这个调用注册服务器,因此管理器没有为行增加代码:行的服务器与每个注册的条目一样被校验、命名、挂载、列出和对账。
  • 行的服务器由 Loader 对行的处理决定。patch 用 insert 添加服务器,以行的 id 指名并给出新的 config 来修改服务器,在该行上设置 disabled: true 来关闭服务器;组合不再列出某一行时,它的服务器被移除。注册是该行 fiber 的副作用,因此变更的行单独重启,其释放等待服务器卸载完成。无效的行单独失败,宿主把它报告在未激活的条目之中。
  • 字典、它的 Settings 命名空间、条目字段 enabled、disabled 状态以及所有报错文字都没有变化,因此不需要转换任何已存的配置,也没有移除任何接口。
  • 行与字典条目共用同一个服务器名的命名空间,沿用注册原有的规则:持有名字的声明保留这个名字。指名字典条目所持服务器的行单独失败,已停用的条目也算在内;指名运行中的行所持服务器的字典写入被拒绝。
  • 行不接受 enabled 字段,配置带有它时该行失败。注册只要存在就是启用的,否则从字典条目照抄来的 enabled: false 会启动部署已关闭的服务器。

本决策部分取代 MCP 服务器管理器:其中对独立 Loader 条目的否决。那份 Agent Note 仍然负责字典、它的 Settings 写入、管理器的子实例、MCP 客户端宿主、状态、凭据模板、探测、Remote 方法与 OAuth。

曾考虑的替代方案

移除 servers 字典。 这样每台服务器只有一种声明形式,管理器也不再需要配置钩子、volatile 监听器、条目字段 enabled 和 disabled 状态。但已发布的包接受 servers,其 README 也记载了这种写法,所以在其中声明服务器的配置会无法加载,直到有人手工改写;已停用的服务器也不再能被列出、探测或授权。pi-ai 的提供方条目出于同样的原因,在独立条目之外保留了它的字典。

像 pi-ai 的提供方条目那样,让排在最后的声明生效。 pi-ai 允许独立条目取代同一路由的字典条目,是因为部署必须能覆盖 Models 页面为某个人存下的提供方。没有已发布的界面把服务器存进管理器的字典,连接器插件依赖“已被持有的名字会被拒绝”,而且一条报告自身失败的行,比一台被另一个声明取代的服务器更容易被发现。

为行插件单独建包。 行只是一次 register() 调用,其配置由管理器的条目 schema 校验。单独建包需要管理器的插件入口导出这个 schema,而该入口只导出 Loader 加载的内容及其 Service 和错误类;还要为一个 apply 函数增加清单、README、一组 locale 文件和各项门禁条目。作为管理器包的第二个入口,它把 schema 当作同级模块导入即可。

在行上保留 enabled 字段。 这样一行就有两个开关。patch 不必重述行的 config 就能设置的是 disabled,而且经由它关闭的行既不占用服务器名,也不占用 oauth.credentialKey。

影响

  • 任何一层都可以添加、修改、关闭或移除一条服务器行,而不必重述其他行。无效的行单独失败,变更的行单独重启。
  • 管理器有两种声明形式。对于声明在字典里的服务器,字典的代价仍在:设置 servers 的层会替换整个字典,一个无效条目会使管理器行失败,所有服务器行也因此处于等待。
  • 两种形式关闭服务器的方式不同。enabled: false 的字典条目仍以 disabled 状态列出,可以被探测和授权。被关闭的行没有加载,所以管理器不知道它的服务器。
  • 某一层在同一次编辑中删除字典条目并添加对应的行,就把服务器从字典移到了行。
  • 管理器不提供编辑服务器行的途径:行不是 Settings 命名空间,管理器的 Remote 也没有添加或修改条目的方法。实验性的“连接器”标签改为在组合中编辑行:用 ctx.configEditor 的 insert()、editRow() 和 remove() 添加、编辑和移除 profile patch 中的行,通过插件管理器开关行,并从 ctx.configEditor.configuration() 读取行的列表,因为 list() 既不包含被关闭的行,也不说明哪些服务器有对应的行。
  • ctx.configEditor.edit() 先保存符合 schema 的行编辑,再由管理器校验条目;管理器拒绝时恢复原配置。手工编辑的文件只在行加载时被检查。
  • 管理器对行条目的拒绝信息以 servers.<name> 开头,与它对每个注册条目的拒绝信息相同。

测试

组合测试经由 Loader 从 bundle patch 和 profile patch 启动服务器行,与字典已有的测试并列。它们覆盖行的添加、编辑、关闭与移除,单独失败的行,重复的服务器名,带有 enabled 的行,行与字典条目一起运行,因字典条目的名字而被拒绝的行,因运行中的行的名字而被拒绝的字典写入,同一次编辑把服务器从字典移到行,以及让各行处于等待的无效字典条目。进程级测试用一个字典条目、一条有效的行和三条被拒绝的行运行随产品发布的 headless profile,并检查启动告警。管理器测试在真实的 Cordis 上注册并释放一条行,观察服务器被移除。