siyuan-mcp
Provides tools for managing SiYuan notes, including search, document operations, daily notes, notebooks, blocks, attributes, SQL queries, templates, assets, files, export, notifications, system info, snapshots, and tags.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@siyuan-mcpSearch notes about kubernetes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SiYuan MCP Server
English | 繁體中文
A SiYuan MCP server maintained by PurpleLiu. It connects AI tools to SiYuan Note through the Model Context Protocol (MCP) for safe search, reading, creation, and organization of your notes.
Compatible with Claude Desktop, Cursor, OpenClaw, and any MCP-compatible client.
Features
66 tools covering search, documents, blocks, notebooks, daily notes, snapshots, and tags
Unified search — content, filename, tag, or combined filters
Document tree — browse notebook hierarchy by depth
Daily notes — auto-create today’s note if it doesn’t exist
Snapshot management — create/list/rollback
Stdio & HTTP transports
TypeScript full type definitions
Quick Start
Install
git clone https://github.com/PurpleLiu/siyuan-mcp.git
cd siyuan-mcp
npm install && npm run build
npm install -g .Get Your SiYuan API Token
SiYuan → Settings → About → API Token
Environment Variables (optional)
export SIYUAN_TOKEN=your-token
export SIYUAN_BASE_URL=http://127.0.0.1:6806
export SIYUAN_VERBOSE=1 # optionalConfigure Your MCP Client
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"siyuan": {
"command": "siyuan-mcp",
"args": ["stdio", "--token", "YOUR_TOKEN", "--baseUrl", "http://127.0.0.1:6806"]
}
}
}Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"siyuan": {
"command": "siyuan-mcp",
"args": ["stdio", "--token", "YOUR_TOKEN", "--baseUrl", "http://127.0.0.1:6806"]
}
}
}Config locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Tools
Category | Tool | Description |
🔍 Search |
| Search by content/filename/tag or combined filters |
📄 Documents |
| Read document content (paginated) |
| Create a new document | |
| Append content | |
| Replace content | |
| Remove a document | |
| Rename a document | |
| Move documents | |
| Get document tree by depth | |
| Human-readable path by document ID | |
| Human-readable path by storage path | |
| Storage path by document ID | |
| Document IDs by human-readable path | |
📅 Daily Notes |
| Append to today’s note |
📚 Notebooks |
| List notebooks |
| Recently updated documents | |
| Create a notebook | |
| Open a notebook | |
| Close a notebook | |
| Rename a notebook | |
| Remove a notebook | |
| Get notebook configuration | |
| Update notebook configuration | |
🧱 Blocks |
| Delete a block |
| Move a block | |
| Fold a block | |
| Unfold a block | |
| Get child blocks | |
| Transfer block reference | |
🧱 Blocks |
| Delete a block |
| Move a block | |
| Fold a block | |
| Unfold a block | |
| Get child blocks | |
| Transfer block reference | |
🧩 Attributes |
| Get block attributes |
| Set block attributes | |
🧮 SQL |
| Execute SQL query |
| Flush SQL transaction | |
🧾 Templates |
| Render template by ID |
| Render sprig template | |
📦 Assets |
| Upload asset (base64) |
📁 Files |
| Get file by path |
| Write file by path | |
| Remove file by path | |
| Rename/move file | |
| List files under path | |
📤 Export |
| Export markdown |
| Export files/folders | |
🔔 Notification |
| Push message |
| Push error message | |
🖥️ System |
| Get boot progress |
| Get system version | |
| Get system time | |
📸 Snapshots |
| Create snapshot |
| List snapshots | |
| Rollback snapshot | |
🏷️ Tags |
| List all tags (prefix/depth supported) |
| Batch replace/remove tags |
Usage Examples
"List all notebooks"
"Search notes about kubernetes"
"Show the Work notebook tree with 3 levels"
"Create a meeting note under Projects/2026"
"Append today’s standup notes to my daily note"
"Move these three documents into Archive"
"What tags do I have under 'project/'?"
"Get block attributes for this note"
"Set a custom attribute on a block"
"Run an SQL query to find recently updated notes"
"Render a template with variables"
"Upload an image asset"
"Export this document to markdown"
"List files under /data"
"Push a notification message"
"Check SiYuan system version"Using as a Library
import { createSiyuanTools } from '@purpleliu/siyuan-mcp';
const siyuan = createSiyuanTools('http://127.0.0.1:6806', 'your-token');
const notebooks = await siyuan.listNotebooks();
const content = await siyuan.getFileContent(documentId);
const results = await siyuan.search.query(
"SELECT * FROM blocks WHERE content LIKE '%keyword%'"
);Development
npm install # Install dependencies
npm run build # Build
npm run watch # Watch mode
npm run lint # Lint
npm run format # Format
# Manual testing
npm run mcp:stdio -- --token YOUR_TOKEN --baseUrl http://127.0.0.1:6806
npm run mcp:http -- --token YOUR_TOKEN --port 3000 --baseUrl http://127.0.0.1:6806Project Structure
├── src/ # Core library
│ ├── api/ # SiYuan API client
│ ├── types/ # TypeScript types
│ └── utils/ # Helpers
├── mcp-server/ # MCP server
│ ├── bin/ # CLI entry (stdio/http)
│ ├── core/ # Server core & registry
│ └── handlers/ # Tool handlers
└── dist/ # Build outputLicense
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PurpleLiu/siyuan-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server