dsh-plugin-mcp-chat
已验证@linuxsuren/dsh-plugin-mcp-chat · v0.2.1 · MIT · Web 界面
Multi-MCP-server chat plugin for DeepSeek Harness: manage MCP servers in the Web settings UI (with live tool counts); every MCP tool becomes mcp__<server>__<tool>.
安装
dsh plugin add @linuxsuren/dsh-plugin-mcp-chat 用 dsh --profile default --dump-config 确认 layer 已生效 —— 参见安装指南。
源码
发布到 npm 但没有公开仓库。安装前请检查包内容。
标签
作者
说明文档
@linuxsuren/dsh-plugin-mcp-chat
把 DeepSeek Harness (dsh) 改造成基于多个 MCP server 的对话 Agent:
- 所有 MCP 工具以
mcp__<server>__<tool>注册给模型 - 在 Web 设置页里增删 MCP server,即时生效(host 立刻连接/断开,无需重启,进行中的对话即可使用新工具)
- 每个 server 显示实时状态与已注册工具数
- 不提供本地文件/命令工具,对话能力完全来自 MCP server
底层每个 server 复用官方 @deepseek-ai/dsh-mcp-client fiber,重连退避、工具重同步、错误隔离全部保留。
安装
一条命令,全自动:
dsh plugin --profile web add /path/to/@linuxsuren/dsh-plugin-mcp-chat
本包是一个 Profile Bundle(自带 cordis.patch.yml 组合层):dsh plugin add 安装时自动把它追加到 profile 的 bundles 列表,重启 profile 后 mcp-chat 组合行自动生效,无需手动编辑任何 YAML。
启动后打开 Web UI → 设置 → MCP Servers:
- 每行显示 serverName、transport、连接状态(connecting / connected / invalid)和已注册工具数(如
● connected · 12 tools) - Add MCP server 表单支持 stdio(command / args / env)与 streamable-http(url / headers),args/env/headers 填 JSON
- Remove 按钮删除 server,工具随之注销
可选:YAML 基线配置
想声明式地管理 server(配置跟 profile 走、可进版本库、支持 !!js 环境变量插值),在自己的 ~/.dsh/profiles/web/cordis.patch.yml 里覆盖同一行的 config(用户 patch 层在 bundle 层之后应用):
- id: mcp-chat
config:
servers:
- serverName: demo
transport: stdio
command: /usr/local/bin/demo-mcp-server
env:
DEMO_API_BASE_URL: https://api.example.com
注意:如果之前手动加过旧的每-server 一行写法,请删除那段,避免同一 serverName 重复注册。
工作原理
- server 列表存在 dsh settings 命名空间
mcp-chat:组合配置servers:是 base 层,UI 编辑写入 user 层(由 dsh 持久化到settings.yaml,重启后仍生效)。两层合并后的结果即当前生效列表。 - host 监听 settings 变更,按
serverNamediff:新增 →ctx.plugin(dsh-mcp-client, entry)立即挂载;删除/修改 → dispose 旧 fiber 后重挂。 - host 监听工具注册表
tools/change事件,实时统计每个 server 的mcp__<name>__*工具数,通过/mcp-chat-status/servers.json提供给 UI(UI 每 3 秒轮询)。 - UI 写入走标准
api.settings.mutate远程接口,无需插件私有 RPC。
字段参考
每个 server 条目即 @deepseek-ai/dsh-mcp-client 的完整配置:stdio 用 command/args/env/cwd,http 用 url/headers;可选 toolCallTimeoutMs、failOnStartupError、reconnect.*。serverName 需匹配 [A-Za-z0-9_-]{1,32} 且列表内唯一。
去掉 dsh 工作区工具(可选)
本插件不注册任何文件/命令工具。若要会话完全不暴露 dsh 自带工作区工具,在 profile patch / 预设里禁用对应行:
- id: tool-bash
disabled: true
- id: tool-fs
disabled: true
- id: tool-fs-search
disabled: true
已知限制
!!js环境变量插值只在 YAML 组合层可用;UI 添加的 env 是字面值。- UI 修改 server 配置(而非增删)时,host 会断开并重连该 server,工具短暂不可用。
- 状态端点只在带 Web Server 的 profile 上注册(headless profile 自动跳过,MCP 工具照常可用)。