dsh-mcp-manager
DeepSeek Harness(DSH)的 MCP 管理插件:在 Web GUI 设置页启停 profile 中的 mcp-client 服务器实例;停用的服务器断开连接,其工具(
mcp__<server>__*)对 Agent 运行时不可见。
English · English README
适用于 DSH 0.1.0-rc.7 及以上的 bundle 插件模型(dsh.profile.bundles + dsh.bundle.patch)。工程模式与 dsh-skill-manager 完全一致(同作者姊妹插件)。
功能
- 自动发现:在
<harness home>/mcp-servers.json声明服务器(兼容 Claude Desktop / Claude Code 的mcpServers风格),boot 时自动挂载为 mcp-client 实例,无需手改 cordis.patch.yml;面板「重新扫描」实时增删/热更新 - 设置页管理面板:设置(Settings)→「MCP 管理」,列出全部 mcp-client 实例(serverName / 来源 / 传输类型 / 连接地址),支持搜索与「全部 / 已启用 / 已停用」筛选,一键开关
- 真启停:停用 = loader entry
disabled(mcp-client fiber 被 dispose)——断开连接、注销全部mcp__<server>__*工具,对所有 Agent 及子 Agent 全局生效;启用 = 重新连接并注册工具 - 批量操作:工具栏「全部启用 / 全部停用」(停用全部需确认)
- 插件配置卡片:设置 → 插件 →「插件配置」出现 dsh-mcp-manager 卡片(服务端注册 settings 命名空间,rc.7+ keyed 分发)
- 持久化:禁用名单存于
<harness home>/mcp-manager.json,重启后 boot 时自动重新应用;已消失的 serverName 自动清理 - headless 兼容:
loader硬依赖 + webServer 可选等待——无 Web GUI 的 headless profile 启停能力照常可用 - 零构建:单文件插件(ESM host + ModuleLoader client),无编译步骤
前提:接入 MCP 服务器(两种方式)
方式 A —— 自动发现(推荐):在 <harness home>/mcp-servers.json(默认 ~/.dsh/mcp-servers.json)声明服务器,重启 dsh 或点面板「重新扫描」即自动挂载:
{
"servers": {
"filesystem": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
},
"remote": {
"transport": "streamable-http",
"url": "https://your-mcp-server.example.com/mcp",
"headers": { "Authorization": "Bearer sk-xxx" }
}
}
}
也接受 mcpServers 键(Claude Desktop 兼容);transport 缺省时按有无 url 推断。改完点「重新扫描」:新增的挂载、移除的清理、变更的热更新(连接重置),全部无需重启。
方式 B —— patch 实例:在 profile 的 cordis.patch.yml 添加 @deepseek-ai/dsh-mcp-client 行(每实例一个服务器):
- insert:
- id: mcp-my-server
name: '@deepseek-ai/dsh-mcp-client'
config:
serverName: my-server # 唯一标识([A-Za-z0-9_-]{1,32}),管理面板按它列出行
transport: stdio # 或 streamable-http
command: npx
args: ['-y', '@some/mcp-server']
两种方式的实例统一出现在管理面板(来源标记「自动 / 配置」),均可启停;同 serverName 时 patch 实例优先(自动发现跳过重复)。更多选项见 @deepseek-ai/dsh-mcp-client Config。
安装
将下面的提示词复制给你的 AI 助手(Agent),它会按照 AGENT.md 完成安装:
请阅读仓库根目录的 AGENT.md 文档,按照其中的步骤,在当前 DSH profile 中完成 dsh-mcp-manager 插件的安装、挂载与验证。
或手动安装:
# 1) 安装插件包(bundle:自动进入 dsh.profile.bundles,无需手工编辑 patch)
dsh plugin --profile web add dsh-mcp-manager # npm 已发布时
dsh plugin --profile web add github:welsione/dsh-mcp-manager # 直接从 GitHub 装
# 固定版本(推荐,避免 main 漂移):github:welsione/dsh-mcp-manager#v1.0.0
# 未 push 的本地开发:file: 前缀(实体化安装,依赖可解析;裸路径=link: 软链会失败)
# 2) 重启 dsh 进程(bundle 补丁层启动时加载),刷新 Web 页面
git 依赖须知:
github:…装的是 GitHub 上已提交的代码——先git push;固定版本用#v1.0.0。
架构
| 文件 | 职责 |
|---|---|
cordis.patch.yml |
bundle 补丁层:dsh.bundle.patch 指向它,boot 时自动挂载 host 插件行 |
lib/index.js |
Host half(ESM):遍历 loader entries 收集 mcp-client 实例;启停 = entry.update({disabled})(断开/重连连接);HTTP API GET /api/mcp-manager/list、POST /api/mcp-manager/set(单/批量);settings 命名空间注册;禁用名单持久化 + boot 重应用 |
lib/client.js |
Client half:window.__ModuleLoader__.load 注册设置页「MCP 管理」与「插件配置」卡片;设置页导航图标替换为插头样式 |
package.json |
dsh.bundle.patch + dsh.client 声明(bundle + 客户端随包加载);ESM;@deepseek-ai/dsh-settings peer 依赖 |
验证
# 服务端路由
curl -s http://127.0.0.1:3080/api/mcp-manager/list | python3 -m json.tool
# 期望 ok:true、servers 为全部 mcp-client 实例、disabled 为停用名单
# 客户端 bundle(刷新页面后生效)
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:3080/plugins/dsh-mcp-manager/client.js # 期望 200
# 启停与批量
curl -s -X POST http://127.0.0.1:3080/api/mcp-manager/set \
-H 'content-type: application/json' -d '{"serverName":"my-server","enabled":false}' | python3 -m json.tool
curl -s -X POST http://127.0.0.1:3080/api/mcp-manager/set \
-H 'content-type: application/json' -d '{"serverNames":["a","b"],"enabled":true}' | python3 -m json.tool
# 单元测试(CI 同款,无需 DSH 进程)
npm install && npm test # 期望 ALL PASS(12 项宿主逻辑检查)
卸载
dsh plugin --profile web remove dsh-mcp-manager(从依赖与dsh.profile.bundles移除)- 重启 dsh;
mcp-manager.json保留,重新安装后沿用禁用名单
生态与收录
本仓库满足 awesome-dsh-plugin 与 awesome-dsh-plugins 雷达 的收录条件(dsh.bundle 声明 + cordis.patch.yml、真实可用代码 + test/host.test.mjs、CI 全矩阵)。GitHub 侧待办:git push origin main && git tag v1.0.0 && git push origin v1.0.0,仓库 About → Topics 添加 dsh-plugin(雷达每 6 小时自动收录并实机验证);awesome 列表条目 YAML 样例:
url: https://github.com/welsione/dsh-mcp-manager
name: welsione/dsh-mcp-manager
category: tools # 管理 MCP 服务器实例 → tools 类
description:
en: Enable or disable mcp-client server instances from the Web GUI settings page; disabled servers disconnect and their tools are hidden from every agent runtime.
zh: 在 Web GUI 设置页启停 mcp-client 服务器实例;停用的服务器断开连接且工具对 Agent 运行时不可见。
相关
DeepSeek Harness · dsh-skill-manager · dsh-mmx-bridge · awesome-dsh-plugin
No comments yet. Be the first to write one.