dsh-mcp-manager
模型与 MCP 活跃维护

dsh-mcp-manager

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.

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
20 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:penglai-doll/dsh-mcp-manager
git clone https://github.com/penglai-doll/dsh-mcp-manager.git
git clone git@github.com:penglai-doll/dsh-mcp-manager.git
README.md main

dsh-mcp-manager

GitHub topics: dsh-plugin
License: MIT

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.X are emitted as !!js loader expressions.
  • Enable / disable / remove rows by line surgery; every write leaves a
    cordis.patch.yml.bak backup 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): injects webServer, fs, loader,
    tools; serves a same-origin JSON API under /mcp-manager/* via
    webServer.register (wrapped in ctx.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 the
    window.__ModuleLoader__.load({id, factory}) format; registers
    settings.plugins.tab (id mcp) and calls the host API with fetch.
    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 specific cordis.patch.yml path 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 值会被输出为 !!js loader 表达式。
  • 启用 / 禁用 / 删除行(行级手术);每次写入都在文件旁留一份 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(id mcp),用 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 主机上使用本插件。