penglai-doll
dsh-mcp-manager
MCP management tab for the Web Plugins settings: list, add, edit, enable/disable, and remove @deepseek-ai/dsh-mcp-client rows in the profile's cordis.patch.yml through a same-origin /mcp-manager JSON API, with live loader phases and registered mcp__* tools.
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 17, 2026
- Updated
- Aug 17, 2026
Introduction
dsh-mcp-manager
Bilingual 中英双语:English first, 中文译文在后。
English
Formal (composition-mounted) DeepSeek Harness plugin: a MCP 管理 tab in the Web Plugins settings section that manages MCP server connections.
What it manages
MCP servers in DSH are composition rows of the shipped
@deepseek-ai/dsh-mcp-client bridge: one row connects one MCP server (stdio
child process or Streamable HTTP endpoint) and registers its tools as
mcp__<serverName>__<toolName>. This plugin edits those rows in the active
profile's cordis.patch.yml:
- List every MCP row with its transport, enablement, live Loader phase
(pending/loading/active/failed), and the currently registered
mcp__*tools per server. - Add / edit rows with a form: transport, serverName, command/args/env/cwd
(stdio) or url/headers (streamable-http), tool-call timeout, startup-error
policy, and reconnect policy. Env/header values shaped like
process.env.Xare emitted as!!jsloader expressions. - Enable / disable / remove rows by line surgery; every write leaves a
cordis.patch.yml.bakbackup next to the file. - Validation mirrors
@deepseek-ai/dsh-mcp-client's schema: serverName[A-Za-z0-9_-]{1,32}and unique, transport enum, required command/url, numeric ranges.
Architecture
lib/index.js— Host half (plain ESM): injectswebServer,fs,loader,tools; serves a same-origin JSON API under/mcp-manager/*viawebServer.register(wrapped inctx.effect, so teardown removes the routes). It parses and splices the patch file with a small YAML-subset parser and never rewrites rows it does not own.lib/client.js— Client half: a hand-written web plugin bundle in thewindow.__ModuleLoader__.load({id, factory})format; registerssettings.plugins.tab(idmcp) and calls the host API withfetch. Only module dependency:react.
Locating the patch file
The host half scans $DSH_HOME/profiles/*/cordis.patch.yml and edits the
profile that mounts this plugin (contains a row with id: mcp-manager). A
single-profile deployment is unambiguous. Overrides:
DSH_MCP_MANAGER_PATCH— edit a specificcordis.patch.ymlpath directly.DSH_PROFILE— disambiguate when several profiles mount the plugin.
Effect timing
The Web profile ships with the hmr row disabled, so edits take effect on
the next dsh web restart. With HMR enabled (deployment choice), the Loader
hot-applies patch edits, and the mcp-client rows disconnect/reconnect without
a restart.
Installation (web profile)
dsh plugin --profile web add <this-directory>
and add one row to the profile's cordis.patch.yml:
- insert:
- id: mcp-manager
name: 'dsh-mcp-manager'
Then restart dsh web. The row is both a host row and (via the dsh.client
field in package.json) a browser roster row.
If you edit this package's source later, re-run the add command (or re-copy
the directory into <profile>/node_modules/) and restart.
Trust
The /mcp-manager routes perform the same mutations a user could make by
editing cordis.patch.yml by hand, and are served on the same host/port as
the Web UI with no additional auth. Keep this plugin on loopback hosts.
中文
正式(composition 挂载)的 DeepSeek Harness 插件:Web 插件设置里的一个 MCP 管理 标签页,管理 MCP 服务器连接。
它管理什么
DSH 里的 MCP 服务器是随附 @deepseek-ai/dsh-mcp-client 桥接的组合行:一行连接一个 MCP 服务器(stdio 子进程或 Streamable HTTP 端点),并把其工具注册为 mcp__<serverName>__<toolName>。本插件在活动 profile 的 cordis.patch.yml 里编辑这些行:
- 列出每个 MCP 行:传输方式、启用状态、实时 Loader 阶段(pending/loading/active/failed),以及每个服务器当前注册的
mcp__*工具。 - 新增 / 编辑行(表单):transport、serverName、command/args/env/cwd(stdio)或 url/headers(streamable-http)、工具调用超时、启动错误策略、重连策略。形如
process.env.X的 env/header 值会被输出为!!jsloader 表达式。 - 启用 / 禁用 / 删除行(行级手术);每次写入都在文件旁留一份
cordis.patch.yml.bak备份。 - 校验镜像
@deepseek-ai/dsh-mcp-client的 schema:serverName[A-Za-z0-9_-]{1,32}且唯一、transport 枚举、command/url 必填、数值范围。
架构
lib/index.js— Host 半边(纯 ESM):注入webServer、fs、loader、tools;通过webServer.register提供/mcp-manager/*同源 JSON API(包在ctx.effect里,卸载即移除路由)。它用一个 YAML 子集解析器解析并拼接补丁文件,绝不重写不属于自己的行。lib/client.js— Client 半边:window.__ModuleLoader__.load({id, factory})格式的手写 web 插件 bundle;注册settings.plugins.tab(idmcp),用fetch调用 host API。唯一模块依赖:react。
定位补丁文件
Host 半边扫描 $DSH_HOME/profiles/*/cordis.patch.yml,并编辑挂载本插件的那个 profile(含 id: mcp-manager 行)。单 profile 部署不会歧义。覆盖项:
DSH_MCP_MANAGER_PATCH— 直接编辑指定的cordis.patch.yml路径。DSH_PROFILE— 多个 profile 挂载本插件时消歧。
生效时机
Web profile 默认禁用 hmr 行,因此编辑在下次 dsh web 重启后生效。启用 HMR(部署选择)时,Loader 会热应用补丁编辑,mcp-client 行无需重启即断开/重连。
安装(web profile)
dsh plugin --profile web add <this-directory>
并向 profile 的 cordis.patch.yml 加一行:
- insert:
- id: mcp-manager
name: 'dsh-mcp-manager'
然后重启 dsh web。该行既是 host 行,也(通过 package.json 里的 dsh.client 字段)是浏览器 roster 行。
后续若修改本包源码,重新执行 add 命令(或把目录重拷到 <profile>/node_modules/)并重启。
信任
/mcp-manager 路由执行的变更是用户手改 cordis.patch.yml 本就能做的,且与 Web UI 同源同端口、无额外鉴权。请仅在 loopback 主机上使用本插件。