@rickydata/siyuan-mcp
v0.2.3
Published
MCP server for driving a deployed SiYuan instance (notebooks, docs, SQL, RDM cells).
Readme
@rickydata/siyuan-mcp
MCP server for driving a deployed SiYuan instance.
Exposes HTTP tools (notebooks, docs, SQL, KFDB sync/backlinks) and a WebSocket-driven RDM cell runner (create / run / read output) so Claude can author and execute Python / R / API / KF / AI cells end-to-end.
Auth
All three auth sources below are alternatives — any one suffices. The MCP server boots without requiring any of them; auth is resolved lazily on the first tool call. Token resolution priority:
SIYUAN_KFDB_TOKENenv — raw KFDB API key, used as?kfdb_token=<value>.SIYUAN_KFDB_JWTenv — KnowledgeFlow Google-OAuth JWT, exchanged once viaPOST /api/auth/kfdb/token. Derived key is in-memory only — never persisted to disk.- Local credential at
~/.siyuan-mcp/credentials.json— paste-back token fromsiyuan-mcp login. Stored with0600permissions, atomic write. Token format issiymcp_v1_<kfdb_api_key>; the prefix is stripped before use. This is a local disk fallback, not a gateway-managed secret — it does not appear in anysecrets_requiredmanifest.
Default base URL is https://siyuan.rickydata.org (override with SIYUAN_URL).
Development
npm install
npm run devBuild + test
npm run build
npm testCLI
npx siyuan-mcp login # opens browser paste-back flow
npx siyuan-mcp login --token <siymcp_v1_...>
npx siyuan-mcp whoami
npx siyuan-mcp logoutDocker
docker build -t siyuan-mcp .
docker run -p 8080:8080 -e SIYUAN_KFDB_TOKEN=... siyuan-mcpChangelog
0.2.3 (2026-04-19)
- Fix (FU-3):
siyuan_create_cellnow persists the cell as a real SiYuan block viaPOST /api/block/appendBlockimmediately after the WSAddCellhandshake. Previously the cell only existed in the rdm-engine sidecar's ephemeral in-memory notebook session, so the doc'sblock_countnever increased and the cell was lost on sidecar restart. The response now includespersisted: trueto confirm the HTTP write succeeded.
0.2.2
siyuan_create_cellforwardsoptionsfor ai/mcp/api cells viaAddCell.optionson the WS wire.
0.2.1
- CLI
login/logout/whoami. Credential file atomicity.emit-toolsscript.
0.2.0
- Initial public release: 12 tools (9 HTTP + 3 WS cell tools). Dual-transport (stdio/HTTP). JWT-exchange auth.
