greyoak111/siyuan-codex-bridge
Local Codex and SiYuan official MCP bridge with the Siyuan Notes plugin tooling.
Project Overview项目介绍
siyuan-codex-bridge is a single repository that ships as both a DeepSeek Harness native plugin and a Codex-side local MCP bridge for SiYuan Notes. On the DSH side, package.json declares a dsh.bundle field that points at cordis.patch.yml, which connects the harness to SiYuan's built-in MCP endpoint at 127.0.0.1:6806/mcp, re-registers the official note tools as mcp__siyuan__<tool>, and attaches a siyuan skill describing a read-first, write-on-request etiquette. The bridge runtime itself lives at bridge/mcp-stdio.mjs and is a dependency-free Node script. On the Codex side, the same checkout exposes a Python STDIO proxy under bin/ so Codex Desktop, Codex CLI, and IDE integrations can talk to the identical SiYuan endpoint, with the two transports maintaining independent tokens, policies, and audit logs.
The bridge forwards requests verbatim, only injecting the SiYuan API token into headers, and never parses .sy files or touches siyuan.db directly. Operation level is re-evaluated on every tools/call and can be switched at runtime between readonly, authoring (default), and full via the SIYUAN_MCP_PROFILE environment variable or the ~/.config/dsh-siyuan/config.json file; environment wins over file. The bridge also surfaces SiYuan's built-in AI as a single ai tool with capabilities, chat, action, editor, agent, status, confirm, answer, and permission actions, where the agent action is interactive and keeps an SSE stream open so callers can step through approvals. Tool catalogue resolution order is live → local cache → bundled snapshot, so a fresh install never reports an empty list.
Installation targets the DSH desktop marketplace (search siyuan-codex-bridge under the Memory category), the command dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge, or the prebuilt npm source dsh-siyuan-notes, the latter avoiding the allowBuilds approval step. Optional launchOnCall: true in ~/.config/dsh-siyuan/config.json makes the first real tools/call start /Applications/SiYuan.app/Contents/MacOS/SiYuan via a macOS background launch, with a configurable launchTimeoutMs (default 60s) and environment scrubbing that drops __CFBundleIdentifier, ELECTRON_*, NODE_*, and the bridge's own DSH_*/SIYUAN_* keys. Token resolution cascades from SIYUAN_API_TOKEN → ~/.config/dsh-siyuan/config.json → SiYuan's own workspace conf.json, so a normal install needs no manual token entry. Audit entries land in audit/operations.jsonl or ~/.config/dsh-siyuan/audit.jsonl with mode 600, recording only timestamp, level, tool, action, and decision — never parameters, note bodies, or tokens — and the SiYuan port stays bound to loopback. License is MIT, and on first run SiYuan Desktop must be open with its official MCP enabled; HTTP 429 responses propagate Retry-After.
siyuan-codex-bridge 是一个把思源笔记官方 MCP 端点桥接到 Codex 与 DSH 的本地代理仓库,作为 DSH 原生插件发布,package.json 里的 dsh.bundle 指向 cordis.patch.yml,将官方工具注册为 mcp__siyuan__* 并附带 siyuan 技能;同仓另有 bin/ 下 Python 代理供 Codex Desktop、CLI、IDE 通过 STDIO 使用,两侧 token、策略、审计互不影响。DSH 安装支持插件市场搜索 siyuan-codex-bridge(分类 Memory)或命令行 dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge,亦可走 npm 源 dsh-siyuan-notes 免 allowBuilds 批准;Codex 端把 mcp_servers.siyuan 写入 ~/.codex/config.toml 即可启用。
桥接默认只与 127.0.0.1:6806/mcp 通信,宿主启动不会拉起思源,工具目录优先级为实时目录 → 本机缓存 → 包内快照,即使全新安装工具也不会显示为空;~/.config/dsh-siyuan/config.json 中设 launchOnCall: true 后,首次真正 tools/call 会以 macOS 后台方式启动思源,并剔除 __CFBundleIdentifier、ELECTRON_*、NODE_* 等会破坏 Electron 应用的键。操作级别 readonly / authoring(默认)/ full 在每次 tools/call 重新校验,可通过 SIYUAN_MCP_PROFILE 环境变量或 ~/.config/dsh-siyuan/config.json 切换,桥接还会把思源内置 AI 以 ai 工具形式暴露给 MCP,涵盖 capabilities、chat、action、agent、status、confirm、answer、permission 等动作。
依赖仅为 Node 18+(DSH 侧)和 Python 3(Codex 侧),无第三方 npm 包,Token 顺序从 SIYUAN_API_TOKEN、~/.config/dsh-siyuan/config.json 解析到思源工作区 conf.json 的 api.token,多数情况开箱即用;审计写入 audit/operations.jsonl,仅含时间、级别、工具、action、决策,权限 600,不记笔记正文。许可证 MIT,首次使用前需先打开思源桌面端并启用官方 MCP,思源限流时桥接会把 Retry-After 一并返回。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:siyuan-codex-bridge(greyoak111/siyuan-codex-bridge)
仓库:https://github.com/greyoak111/siyuan-codex-bridge
本站详情页:https://www.yhbd.top/plugins/greyoak111-siyuan-codex-bridge/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证 MIT · ⭐ 2 · 最近提交 2026-09-15 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge
把 greyoak111/siyuan-codex-bridge 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
SiYuan MCP 桥接:Codex 与 DeepSeek Harness
完整的当前操作说明(覆盖官方 29 个能力组)见《思源官方 MCP 使用说明》。
本项目采用 MIT License。
这个本地桥接把 Codex Desktop、Codex CLI 和 IDE 连接到思源笔记内置的官方 MCP。STDIO 代理只把 MCP 请求转发到 http://127.0.0.1:6806/mcp,并在请求头中补充 API Token;它不解析或改写 .sy 文件,也不直接操作 siyuan.db。
同一个仓库还是一个 DSH(DeepSeek Harness)插件:package.json 里的 dsh.bundle 指向 cordis.patch.yml,把同样的官方工具注册成 mcp__siyuan__*,并附带一个 siyuan 使用技能。两侧互不影响——Codex 走 bin/(Python 代理),DSH 走 bridge/(Node 代理),各自的 token、策略与审计彼此独立。
在 DSH 里使用
安装(二选一):
- DSH 桌面端 → 插件市场搜索
siyuan-codex-bridge(分类 Memory); - 命令行(GitHub 源):
dsh plugin --profile web add github:greyoak111/siyuan-codex-bridge - 命令行(npm 源,预构建、免 allowBuilds 批准):
dsh plugin --profile web add dsh-siyuan-notes
宿主启动不会连带打开思源。 桥接只通过网络跟 127.0.0.1:6806 说话,握手和工具目录都在本地应答,
所以打开编辑器、或客户端来问“有哪些工具”,都不会启动任何桌面应用。
思源没开时,桥接仍会本地应答 MCP 握手、并提供上一次见到的工具目录,所以工具不会在会话里凭空消失;
此时调用会明确返回"SiYuan is not reachable",你打开思源后下一次调用即恢复(会话失效会自动重新握手)。
可以让"真正调用"顺手把思源拉起来(默认关闭,需要你显式打开):在 ~/.config/dsh-siyuan/config.json 里加
{"launchOnCall": true}(或设 SIYUAN_LAUNCH_ON_CALL=1)。打开后只有一次真正的 tools/call 会去启动思源——
握手、列目录、宿主启动都不会,这正是"agent 伸手去拿笔记应用"和"我一开编辑器笔记应用自己弹出来了"的区别。
这个开关和操作级别一样是每次调用现读的:改完 config.json,下一次调用即生效,不用重启桥接或 harness。
启动命令默认是 /Applications/SiYuan.app/Contents/MacOS/SiYuan(可用 SIYUAN_APP 换 App 路径,或用
launchCommand / SIYUAN_LAUNCH_COMMAND 完全自定义),等待上限默认 60 秒(launchTimeoutMs / SIYUAN_LAUNCH_TIMEOUT_MS)。
拉起时会把环境里会弄坏 Mac 应用的键摘掉后交给它:__CFBundleIdentifier(agent shell 会导出它,
Electron 应用继承后会误判自己的 bundle,约 80 毫秒后静默退出、退出码 0、日志空白)、ELECTRON_*
(尤其 ELECTRON_RUN_AS_NODE 会让 App 变成一个 node 进程)、NODE_*、以及本桥接自己的 DSH_*/SIYUAN_*;
其余(HOME、PATH、区域设置等)原样保留,所以你自定义的启动脚本仍然可用。
桥接还会追加一个自己的 ai 工具,把思源内置 AI(用你在思源里配的那把 API key)接到 MCP 上——
思源自己的 MCP 端点只发布笔记工具,AI 与它的 agent 回路原本对客户端不可见:
ai 的 action |
做什么 | 档位 |
|---|---|---|
capabilities |
列出 agent 能力(32 项,带 localWrite 标注) | readonly |
chat |
普通问答(msg,可选 model) |
readonly |
action |
按块 ID 执行已配置的编辑器动作(ids + name) |
authoring |
editor |
编辑器式对话(input,可选 ids/history) |
authoring |
agent |
启动一次内置 agent 回合(流式聚合;可暂停等审批) | full |
status / confirm / answer / permission |
读取回合、批准工具调用、回答反问、设会话权限 | full |
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
xmanrui/dsh-im
tencent-connect/dsh-qqbot
flymysql/dsh-remote
whiteguo233/dsh-openbiliclaw
omdsh-dev/dsh-lark
hanshanyike/dsh-yolo
THEWOLFWALKER/dsh-notifier