dsh-basemind-plugin:爲當前工作區自動接入 BaseMind 代碼智能工具

前言

在 DeepSeek Harness(DSH)裏給智能體配 BaseMind,常見做法是在 MCP 配置裏手寫一行 basemind serve,並固定 cwd 指向某個倉庫根目錄。會話裏一旦 cd 到別的項目,工具仍指向舊根目錄;多倉庫就要多配幾行。下面介紹社區插件 dsh-basemind-plugin:以 DSH bundle 形式啓動 BaseMind 的 MCP 服務,按會話工作目錄解析倉庫根,無需再單獨維護 MCP 行。

這是什麼

dsh-basemind-plugin 是發佈在 npm 上的 DSH bundle(當前版本 0.1.5,MIT 許可證)。倉庫由 zengjunlin2022 維護。它會在當前會話所工作的倉庫上執行 BaseMind 自帶的 basemind serve,註冊 BaseMind 通過 tools/list 宣告的工具,並在會話內切換目錄時讓後續調用指向新的倉庫根,而不重啓服務。插件沒有獨立 UI 頁,也不改 agent preset。

與手動 MCP 行相比,工作區根由每次調用時從會話工作目錄解析;工具集隨 BaseMind 動態發現;bundle 自行插入插件行,無需在配置裏再寫 MCP 行;多倉庫時按根目錄自動建立 relay,而不是每個倉庫再加一行。

環境與兼容

組件 要求
DeepSeek Harness >= 0.2.1-rc.3 < 0.3.0-0(engines.dsh 聲明,安裝與啓動時由 DSH 校驗;README 寫明在 0.2.1-rc.5 上驗證)
Node.js >= 24.20.0(純 ESM,無 npm 依賴)
BaseMind 不鎖定版本;暴露的工具與當前運行的 basemind serve 一致(README 在 BaseMind 0.31.1 上驗證)

核心功能

  1. 工作區感知:會話在哪個 Git 倉庫裏工作,BaseMind 就針對該根目錄提供代碼智能能力;會話內 cd 後,下一次工具調用使用新倉庫,無需重啓。
  2. 工具註冊:默認 serverName 下注冊九個工具:admin、agents、code、git、graph、memory、shell、web、workspace。調用名前綴爲 mcp__basemind__<tool>,每個工具都需要必填參數 mode,其餘參數隨 mode 變化;具體 mode 以運行中的 BaseMind 爲準,新版本可能更多。
  3. MCP 資源:BaseMind 的 MCP 資源(如 basemind://status、basemind://repo/map)以 resource server basemind 暴露,可用 list_mcp_resources 與 read_mcp_resource 訪問。

各工具職責概覽(來自 README 工具表):

工具 覆蓋能力
mcp__basemind__admin status、repo 信息、rescan、緩存統計、gc、telemetry
mcp__basemind__agents 多智能體通信
mcp__basemind__code outline、symbols、grep、files、find、definition、references、callers、implementations、dependents、expand、語義搜索、chunk 等
mcp__basemind__git status、history、blame、diff
mcp__basemind__graph calls、neighbours、paths、subgraphs、communities、map、export
mcp__basemind__memory memory put/recall、文檔搜索
mcp__basemind__shell 長生命週期 shell 會話
mcp__basemind__web scrape、crawl、list
mcp__basemind__workspace workspaces、worktrees、branches、claims

安裝與啓用

插件以當前 DSH 進程權限運行;安裝前建議閱讀倉庫源碼與 LICENSE,確認可接受 MIT 條款與行爲。DSH 社區目錄 SkillHub 插件頁 與 GitHub 爲獨立信息來源,並非 DeepSeek 或幻方官方應用商店。

1. 安裝 BaseMind

先按 BaseMind 介紹 安裝 basemind,並確認 DSH 使用的環境能找到它:

basemind --version

若 DSH 的 PATH 裏沒有 basemind,可用絕對路徑配置 BASEMIND_BIN(或插件的 command 選項)指向可執行文件。

2. 安裝 bundle

  • DSH Desktop:打開插件管理(Plugins 頁),安裝 dsh-basemind-plugin 並啓用。
  • CLI 管理的 profile:對啓動時使用的 profile 執行:
dsh plugin --profile <profile> add dsh-basemind-plugin

安裝按 profile 隔離。若運行時提示需重啓或先禁用再啓用以加載新 bundle,按提示操作。

3. 驗證

在項目目錄打開會話後,調用 mcp__basemind__admin,參數 { "mode": "repo" },應返回該會話倉庫的工作區根與 HEAD。默認 serverName 下應能看到上述九個工具已註冊。

查看 npm 上的版本:

npm view dsh-basemind-plugin version

4. 更新與移除

  • 更新:Plugins 頁點 Update,或 dsh plugin --profile <profile> add dsh-basemind-plugin@latest。
  • 移除:在插件管理器中禁用或卸載,或 dsh plugin --profile <profile> remove dsh-basemind-plugin。

典型用法

以下示例來自官方 README,參數通過 DSH 工具調用傳入(示例以 JSON 形式展示 arguments)。

讀文件前先要看結構時,對 mcp__basemind__code 使用 outline:

{ "tool": "mcp__basemind__code", "arguments": { "mode": "outline", "path": "index.js" } }

查符號定義:

{ "tool": "mcp__basemind__code", "arguments": { "mode": "symbols", "name": "createWorkspacePool" } }

查符號的所有引用點:

{ "tool": "mcp__basemind__code", "arguments": { "mode": "references", "name": "publicToolName" } }

在符號粒度上看 git 歷史:

{ "tool": "mcp__basemind__git", "arguments": { "mode": "blame_symbol", "path": "index.js", "name": "activate" } }

看倉庫架構圖:

{ "tool": "mcp__basemind__graph", "arguments": { "mode": "map" } }

檢查當前工作區索引健康狀態:

{ "tool": "mcp__basemind__admin", "arguments": { "mode": "status" } }

適用場景與注意

適合已經在用或計劃用 BaseMind、又不想爲每個倉庫手寫 MCP 行的 DSH 用戶;分類上屬於工作流類 bundle,強調「裝一次、按會話工作目錄自動橋接」。

注意:必須先能本機運行 basemind;DSH 與 Node 版本需滿足 engines;BaseMind 升級後工具與 mode 可能變化,以實際 tools/list 爲準。插件不替代 BaseMind 本身的安裝與索引維護——例如需要 rescan 時仍通過 mcp__basemind__admin 等工具或 BaseMind 文檔中的方式處理。

結尾

dsh-basemind-plugin 把 BaseMind 的 MCP 能力收成 DSH 可安裝的 bundle:少配一行 MCP,多倉庫隨會話目錄切換。目錄與詳情見 SkillHub,源碼與完整說明見 GitHub 倉庫。

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

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

小夜