DeepSeek Harness(DSH)遵循「一切皆插件」的理念。在智能體開發中,處理版本控制往往受限於 git 的語義。本插件通過一個零依賴的 MCP stdio server 將本機 jj CLI 暴露爲 mcp__jj__* 工具,讓模型在 jj 倉庫中使用 jj 的語義執行版本控制操作。
前置條件¶
jj版本 ≥ 0.2x(可通過brew install jujutsu安裝,或參考 官方文檔)。- Node.js ≥ 18(服務器僅使用標準庫,無額外依賴)。
安裝與啓用¶
通過官方目錄添加 bundle:
dsh plugin --profile web add github:LosEcher/dsh-jj#main
本地開發或修改源碼時:
dsh plugin --profile web add link:/path/to/dsh-jj
新 bundle 安裝後必須重啓 dsh web(HMR 通常不覆蓋配置變更):
~/.dsh/scripts/dsh-web-restart.sh
配置注意事項¶
bundle patch 中使用 command: jj-mcp(包的 bin 入口)。若 dsh 進程的 PATH 不含 node_modules/.bin 目錄(常見於 launchd 託管場景),MCP 服務啓動會失敗。此時需要在用戶 patch 層覆蓋爲絕對路徑:
- id: mcp-jj
config:
serverName: jj
transport: stdio
command: node
args: ['/absolute/path/to/dsh-jj/server.mjs']
env:
JJ_MCP_BIN: '/path/to/jj'
failOnStartupError: false
toolCallTimeoutMs: 120000
核心功能¶
插件將 jj 的常用操作封裝爲 mcp__jj__* 工具,所有工具均支持可選的 repo 參數。
| 工具 | 作用 |
|---|---|
jj_status |
獲取當前 change 摘要及工作區改動 |
jj_log |
查看變更圖(替代 git log) |
jj_diff |
查看指定 change 的 diff |
jj_describe |
設置或更新 change 描述 |
jj_new |
開啓新的空 change |
jj_commit |
封存當前 change 並開啓新 change |
jj_edit |
跳轉至已有 change 繼續編輯 |
jj_abandon |
丟棄 change(可 undo) |
jj_undo |
撤銷上一次 jj 操作 |
jj_rebase |
將 change 移動到新的父節點 |
jj_fetch |
拉取遠程分支到 bookmark |
jj_push |
推送 bookmark 到遠程 |
jj_bookmark |
管理 bookmark(如 git 分支) |
jj_run |
通用透傳(需注意安全限制) |
安全設計:
* 所有工具通過 spawn 數組參數調用 jj,無 shell 介入,參數注入免疫。
* jj_run 工具會過濾 --config / --config-toml / --config-file 參數,防止通過配置項執行任意命令。
* jj 本身支持 jj undo / jj op restore,破壞性操作風險較低。
環境變量¶
| 變量 | 默認值 | 說明 |
|---|---|---|
JJ_MCP_BIN |
/opt/homebrew/bin/jj 或 jj |
jj 二進制路徑,自動探測失敗時需手動配置 |
JJ_MCP_TIMEOUT_MS |
60000 |
單次調用超時時間 |
JJ_MCP_DEFAULT_REPO |
空 | 默認倉庫目錄 |
JJ_MCP_LOG |
1 |
0 可關閉 stderr 啓動橫幅 |
獨立使用¶
該 server 是標準 MCP stdio server,也可直接用於 Claude Code 或 Codex:
npx -y jj-mcp
總結¶
該插件適用於需要在 DeepSeek Harness 中使用 Jujutsu 進行版本控制的場景。它將 jj 的原生語義映射爲 MCP 工具,避免了模型使用 git 思維硬套 jj 操作。安裝後需重啓 dsh web,若運行環境特殊(如 launchd),需注意 PATH 配置。
- 目錄頁:https://www.skillhub.cn/plugins/LosEcher/dsh-jj
- GitHub 倉庫:https://github.com/LosEcher/dsh-jj