greyoak111/siyuan-codex-bridge ↗★ 0
dsh-siyuan
SiYuan (思源笔记) for DeepSeek Harness: bridges the local SiYuan MCP endpoint and registers its official note tools as mcp__siyuan__*.
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge说明文档
阅读完整 README ↗在 DSH 里使用
安装(二选一):
- DSH 桌面端 → 插件市场搜索
dsh-siyuan; - 命令行:
dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge
装完即用,不需要手填 token。 桥接按 环境变量 SIYUAN_API_TOKEN → ~/.config/dsh-siyuan/config.json → 思源自己的工作区配置(~/.config/siyuan/workspace.json 列出工作区,读其 /conf/conf.json 的 api.token)的顺序解析;多数情况下最后一条就能找到,因为 token 本来就在思源自己的设置里。思源没启动时先打开思源桌面端。
操作级别(桥接在每次 tools/call 上重新校验,改完下一次调用即生效):
| 级别 | 允许的动作 |
|---|---|
readonly | 搜索与读取:文档、块、大纲、反链、属性、笔记本列表、系统和工作区信息 |
authoring(默认) | 以上 + 建文档、块 insert/append/prepend/update、属性 set、日记 create/append/prepend |
full | 官方全部 action:删除、移动、重命名、复制、笔记本管理、文件、SQL、导入导出、历史回滚、仓库、同步、HTTP、网页抓取 |
改级别:编辑 ~/.config/dsh-siyuan/config.json(例如 {"profile": "readonly"}),或设环境变量 SIYUAN_MCP_PROFILE(环境变量优先,避免用户配置里一个多余的键推翻部署时的显式声明)。桥接在每次 tools/call 上重新读取该级别,所以下一次调用即生效,不需要重启桥接或 harness。诊断(不打印 token):
node node_modules/.bin/dsh-siyuan-bridge --doctor
状态目录 ~/.config/dsh-siyuan/:可选的 config.json,以及 audit.jsonl 审计(只记时间/级别/工具/action/决策,权限 600,不含参数与笔记正文)。插件目录本身不被写入任何东西。
DSH plugin (English)
The same repository is a DeepSeek Harness plugin: dsh.bundle in package.json
points at cordis.patch.yml, which connects the harness to the local SiYuan
desktop app's own MCP endpoint, registers its official note tools as
mcp__siyuan__, and adds a siyuan skill describing the read-first,
write-on-request etiquette. The bridge is bridge/mcp-stdio.mjs (Node, no
dependencies); it resolves the SiYuan API token from the environment, from
~/.config/dsh-siyuan/config.json, or from SiYuan's own workspace settings, so
a normal install needs no configuration. One of three operation profiles —
readonly, authoring (default) or full — is enforced on every tools/call,
and node node_modules/.bin/dsh-siyuan-bridge --doctor reports the endpoint,
the token's origin and the active profile without printing the token.
配置备份和恢复
每次修改全局 Codex 配置前先创建带时间戳的备份,例如 ~/.codex/config.toml.bak.siyuan-YYYYmmdd-HHMMSS。恢复时先退出 Codex,再选择实际存在的备份文件:
本次配置前的原始备份是 ~/.codex/config.toml.bak.siyuan-20260906-235232。
cp ~/.codex/config.toml.bak.siyuan-20260906-235232 ~/.codex/config.toml
chmod 600 ~/.codex/config.toml
恢复后重新启动 Codex Desktop、CLI 或 IDE 会话。