`sugarforever/dsh-mcp-apps`:DeepSeek Harness 的 MCP Apps Host 插件

前言

DeepSeek Harness(DSH)的扩展方式是一切实插件。对智能体开发者来说,MCP Server 往往已经提供工具调用能力,但工具结果如果只是文本或 structuredContent,在 DSH 会话里还缺少可直接操作的界面。

@sugarforever/dsh-mcp-appssugarforever 维护的 DSH 插件,MIT 许可,定位是 MCP Apps host plugin for DeepSeek Harness。它把带 UI 资源的 MCP 工具渲染为 DSH 会话中的 sandboxed interactive Apps,同时把 model-visible tools 注册到 ctx.tools,保持这些工具对模型可见。

DSH 社区插件目录是独立站点,不等同于 DeepSeek 或幻方官方应用商店。下面介绍它的定位、核心能力、安装方式、配置示例和使用边界。

定位

这个插件让 DeepSeek Harness 成为 MCP Apps host:

  • Host 侧连接一个 MCP Server,注册它的 model-visible tools 到 ctx.tools,并拥有 MCP network 或 stdio 流量。
  • Web Client 侧把携带 _meta.ui.resourceUri 的工具渲染为 Harness 会话中的 sandboxed interactive Apps。
  • 普通 MCP tools 仍然是普通 Harness tools,MCP Server 不需要为每个工具提供 UI。

核心能力

已核实的能力包括:

  • 支持 MCP Apps extension negotiation:io.modelcontextprotocol/ui
  • 支持 text/html;profile=mcp-app UI resources
  • 支持 modern _meta.ui.resourceUri 和 legacy _meta["ui/resourceUri"]
  • 支持 stdioStreamable HTTP MCP transports
  • 支持 model-visible、app-visible 和 app-only tools
  • 将原始 CallToolResult 传递给 View,包括 structuredContent
  • 支持 View-to-Server tools/callresources/listresources/read
  • 支持 resource CSP metadata 和 iframe Permission Policy requests
  • 提供 Cordis lifecycle disposal:tools、connections、RPC routes、Slots、App bridges

环境要求

DeepSeek Harness 要求 Node.js 版本为 ^22.19.0>=24.0.0。DSH profile plugin manager 会调用 pnpm,README 建议安装当前 DSH release 使用的版本:

npm install --global pnpm@11.7.0

先启动 DSH Web profile:

npx @deepseek-ai/dsh web

默认 Web UI 地址是:

http://127.0.0.1:3080

首次运行会在以下位置初始化 web profile:

~/.dsh/profiles/web
$DSH_HOME/profiles/web

安装插件

安装已发布包到 DSH Web profile:

npx @deepseek-ai/dsh plugin --profile web add @sugarforever/dsh-mcp-apps

安装这个包时,DSH 会应用它携带的 cordis.patch.yml。默认情况下,它会挂载 VibeFun MCP Apps server:

https://vibefun.app/api/mcp

如果你要做本地开发,可以安装本地 checkout:

npx @deepseek-ai/dsh plugin --profile web add /absolute/path/to/dsh-mcp-apps

如果从 GitHub Release 下载了 tarball,也可以安装本地 tarball:

npx @deepseek-ai/dsh plugin --profile web add ./sugarforever-dsh-mcp-apps-0.1.2.tgz

默认配置

安装后,默认 profile patch 中会有类似这样的实例配置:

- insert:
    - id: mcp-apps-vibefun
      name: '@sugarforever/dsh-mcp-apps'
      config:
        serverName: vibefun
        transport: streamable-http
        url: https://vibefun.app/api/mcp
        failOnStartupError: true

如果要连接不同的 MCP Server,需要编辑已安装 profile patch:

~/.dsh/profiles/web/cordis.patch.yml

替换其中的实例配置,再启动或重启 DSH。

启动

安装完成后,启动 Web profile:

npx @deepseek-ai/dsh web

然后在浏览器打开:

http://127.0.0.1:3080

配置 stdio Server

如果要配置一个 stdio MCP Server,可以先创建 mcp-apps.cordis.yml

- insert:
    - id: mcp-apps-vibefun
      name: '@sugarforever/dsh-mcp-apps'
      config:
        serverName: vibefun
        transport: stdio
        command: node
        args: ['/absolute/path/to/your-mcp-server.js']
        env:
          VIBEFUN_API_KEY: !!js process.env.VIBEFUN_API_KEY
        failOnStartupError: true

然后用 patch 文件启动 DSH Web profile:

dsh web --patch "$PWD/mcp-apps.cordis.yml"

这个配置把本地命令、参数和环境变量交给 DSH 进程处理,而不是交给浏览器。

配置 Streamable HTTP Server

如果要配置 Streamable HTTP MCP Server,可以在 profile patch 中设置 urlheadersfailOnStartupError

- insert:
    - id: mcp-apps-vibefun
      name: '@sugarforever/dsh-mcp-apps'
      config:
        serverName: vibefun
        transport: streamable-http
        url: http://127.0.0.1:3000/mcp
        headers:
          Authorization: !!js '`Bearer ${process.env.VIBEFUN_MCP_TOKEN}`'
        failOnStartupError: true

配置完成后再运行:

npx @deepseek-ai/dsh web

安全边界与限制

使用这个插件时,需要注意下面几件事:

  • 插件运行在 DSH 进程环境中,会继承当前 DSH 进程的权限与可访问环境。安装前应检查源码、依赖和许可证。
  • 浏览器不会收到 URL、command、headers、environment 或 credentials。包内 RPC channel 是 loopback-only。
  • 一个插件实例连接一个 MCP Server。多个 MCP Server 需要挂载多个实例。
  • UI tool discovery 发生在 Client plugin activation。如果 Server 后续变更 UI tool 列表,需要 Client refresh 或 plugin reload。
  • 当前还不向 Apps 暴露 prompts、sampling、downloads、external-link opening 和 model-context updates。
  • App HTML 通过 srcdoc 加载。Apps 应提供 self-contained HTML,或在 resource CSP metadata 中声明所有远程 origin。
  • 当前 iframe 路径面向 Web client。Headless 和 ACP entry points 仍会收到这些 tools,但没有 embedded App surface。

结语

@sugarforever/dsh-mcp-apps 的价值在于把 MCP Apps 的 UI 资源接入 DeepSeek Harness Web 会话:模型继续通过 ctx.tools 看到工具,浏览器端可以查看带 UI 的 interactive Apps,而 MCP 网络或 stdio 流量由 DSH Host 侧管理。

适合需要把 MCP Server 工具以交互界面形式展示给用户的 DSH 开发者。项目仓库:

https://github.com/sugarforever/dsh-mcp-apps

如果通过 DSH 社区插件目录浏览,可按仓库名 sugarforever/dsh-mcp-apps 检索。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜