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

前言

DeepSeek Harness(DSH)的擴展方式是一切實插件。對智能體開發者來說,MCP Server 往往已經提供工具調用能力,但工具結果如果只是文本或 structuredContent,在 DSH 會話裏還缺少可直接操作的界面。

@sugarforever/dsh-mcp-apps 是 sugarforever 維護的 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"]
  • 支持 stdio 與 Streamable HTTP MCP transports
  • 支持 model-visible、app-visible 和 app-only tools
  • 將原始 CallToolResult 傳遞給 View,包括 structuredContent
  • 支持 View-to-Server tools/call、resources/list、resources/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 中設置 url、headers 和 failOnStartupError:

- 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 檢索。

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

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

小夜