Skip to main content

CLI tool + MCP server + Agent Skills for SiYuan Note (思源笔记) — zero deps, permission system, workspace management

Project description

SiYuan Agent Tools

PyPI CI Python License Tests

中文

CLI tool, MCP server, and AI Agent Skills for SiYuan Note. Pure Python, zero dependencies. Compatible with Claude Code, Codex, OpenCode, and Hermes.


Install

pip install siyuan-cli

Or the one-command installer:

curl -fsSL https://raw.githubusercontent.com/xingrove/siyuan-skills/main/scripts/install.sh | bash

Quick Start

siyuan config url http://127.0.0.1:6806
siyuan config token your-api-token

siyuan stats          # verify connectivity

Token location: SiYuan Desktop → Settings → API; for Docker, in conf.json.


CLI Reference

Documents & Blocks

Command Description
siyuan create /path [content] Create a note (--file / --stdin supported)
siyuan read /path Read document content
siyuan delete /path [--id] Delete a note
siyuan tree [notebook] Document tree
siyuan doc rename <title> Rename document
siyuan doc move <paths...> [--to-notebook] Move documents
siyuan doc export /path [--id] Export as Markdown
siyuan doc get-path <id> Resolve ID to path

Block Operations

Command Description
siyuan block get <id> Block info
siyuan block children <id> Child blocks
siyuan block append <id> -c <content> Append child block
siyuan block prepend <id> -c <content> Prepend child block
siyuan block insert <id> -c <content> Insert block after sibling
siyuan block update <id> -c <content> Update block
siyuan block delete <id> Delete block
siyuan block move <id> --parent <pid> Move block
siyuan block fold <id> Fold heading
siyuan block unfold <id> Unfold

Block References & Embeds

Command Output Description
siyuan block ref <id> ((id 'title')) Block reference markup
siyuan block embed <id> {{embed ((id 'title'))}} Block embed markup
siyuan block link <id> siyuan://blocks/id SiYuan internal link
REF=$(siyuan block ref 20200812220555-lj3enxa)
siyuan create "/article" "As mentioned in $REF..."

Notebooks, Search & Daily Notes

Command Description
siyuan notebook list List notebooks
siyuan notebook create <name> Create notebook
siyuan notebook remove <id> Remove notebook
siyuan notebook rename <id> <name> Rename
siyuan notebook conf <id> Notebook config
siyuan search <query> Full-text search
siyuan sql <statement> SQL query (SELECT only)
siyuan daily-note note Get or create today's note
siyuan daily-note append <content> Append to today's note

Tags, Attributes & Assets

Command Description
siyuan tag list All tags
siyuan tag blocks <tag> Find tagged blocks
siyuan attr get <id> Block attributes
siyuan attr set <id> <key> <val> Set attribute
siyuan asset upload <file> Upload asset
siyuan file list /data/ List workspace files
siyuan file put <local> <remote> Upload file

Batch & Utilities

Command Description
siyuan batch create <file> Batch create notes
siyuan batch delete <file> Batch delete notes
siyuan stats Workspace statistics
siyuan overview Workspace overview
siyuan health Diagnostic health check
siyuan backlinks get <id> Block backlinks
siyuan notify push <msg> Push notification to UI
siyuan mcp Start MCP server

Global Options

Option Description
--format pretty|json|compact Output format
--verbose Detailed logging
--no-color Disable colored output
--version Show version
--yes Skip confirmation on destructive ops
--dry-run Preview without applying
@file:/path Read content from file
@stdin Read content from stdin

Read-only mode: SIYUAN_READ_ONLY=true siyuan <cmd> blocks all writes.


Multi-Server

siyuan workspace add hk --url http://server:6806 --token xxx
siyuan workspace use hk
siyuan workspace list

Permission System

siyuan permission deny --endpoint "*remove*"   # Block all deletes
siyuan permission ask --endpoint "*delete*"    # Ask before delete
siyuan permission list                          # Show rules

MCP Server

siyuan-mcp

23 tools: CRUD, search, SQL, block refs/embeds, tags, attributes, health checks. Works with Claude Desktop, Cursor, and any MCP client.


Agent Skills

Agent Install
OpenCode git clone https://github.com/xingrove/siyuan-skills.git ~/.opencode/skills/siyuan-skills
Codex CLI cp -r skills/* ~/.codex/skills/
Hermes cp -r skills/* ~/.hermes/skills/
npx npx skills add https://github.com/xingrove/siyuan-skills
Skill Description
siyuan-cli Operate SiYuan via CLI
siyuan-api Direct REST API calls
siyuan-markdown SiYuan-flavored Markdown reference

Configuration

Priority: SIYUAN_URL / SIYUAN_TOKEN env vars > active workspace > ~/.siyuan/config.json

{"url": "http://127.0.0.1:6806", "token": "your-token"}

Optional keyring storage:

pip install keyring
siyuan keyring-set your-token
siyuan keyring-unset

Community project, not official.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

siyuan_cli-1.1.0.tar.gz (72.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

siyuan_cli-1.1.0-py3-none-any.whl (66.7 kB view details)

Uploaded Python 3

File details

Details for the file siyuan_cli-1.1.0.tar.gz.

File metadata

  • Download URL: siyuan_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 72.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for siyuan_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c16b8db732f28dd078ef3b7ed519a722c8ff134bd85132c1f39140329dc1088f
MD5 1a4f9670ae739411c5616c46e05ccdf0
BLAKE2b-256 9d9ef103d07cea454665b2eebd0c6f2f5b6bcaa9d85580216374503a50f384e0

See more details on using hashes here.

File details

Details for the file siyuan_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: siyuan_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for siyuan_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebcf20affa6befbaf1e3235af7381f725e41b709b5c939d1d1cc15266958cc3c
MD5 aae2a1676c3238f06d773b79ca50ed65
BLAKE2b-256 4e67eb8513935c6946c88d6717445c99fd893c93d7ebd20be7b71117b9ef2d89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page