siyuan-mcp
MCP server for SiYuan Note, enabling AI tools to search, read, create, and organize notes with 66 tools.
README
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 # optional
Configure 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.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Tools
| Category | Tool | Description |
|---|---|---|
| 🔍 Search | unified_search |
Search by content/filename/tag or combined filters |
| 📄 Documents | get_document_content |
Read document content (paginated) |
create_document |
Create a new document | |
append_to_document |
Append content | |
update_document |
Replace content | |
remove_document |
Remove a document | |
rename_document |
Rename a document | |
move_documents |
Move documents | |
get_document_tree |
Get document tree by depth | |
get_human_path_by_id |
Human-readable path by document ID | |
get_human_path_by_path |
Human-readable path by storage path | |
get_path_by_id |
Storage path by document ID | |
get_ids_by_hpath |
Document IDs by human-readable path | |
| 📅 Daily Notes | append_to_daily_note |
Append to today’s note |
| 📚 Notebooks | list_notebooks |
List notebooks |
get_recently_updated_documents |
Recently updated documents | |
create_notebook |
Create a notebook | |
open_notebook |
Open a notebook | |
close_notebook |
Close a notebook | |
rename_notebook |
Rename a notebook | |
remove_notebook |
Remove a notebook | |
get_notebook_conf |
Get notebook configuration | |
set_notebook_conf |
Update notebook configuration | |
| 🧱 Blocks | delete_block |
Delete a block |
move_block |
Move a block | |
fold_block |
Fold a block | |
unfold_block |
Unfold a block | |
get_child_blocks |
Get child blocks | |
transfer_block_ref |
Transfer block reference | |
| 🧱 Blocks | delete_block |
Delete a block |
move_block |
Move a block | |
fold_block |
Fold a block | |
unfold_block |
Unfold a block | |
get_child_blocks |
Get child blocks | |
transfer_block_ref |
Transfer block reference | |
| 🧩 Attributes | get_block_attrs |
Get block attributes |
set_block_attrs |
Set block attributes | |
| 🧮 SQL | execute_sql |
Execute SQL query |
flush_transaction |
Flush SQL transaction | |
| 🧾 Templates | render_template |
Render template by ID |
render_sprig |
Render sprig template | |
| 📦 Assets | upload_asset_base64 |
Upload asset (base64) |
| 📁 Files | get_file |
Get file by path |
put_file |
Write file by path | |
remove_file |
Remove file by path | |
rename_file |
Rename/move file | |
list_files |
List files under path | |
| 📤 Export | export_markdown |
Export markdown |
export_files |
Export files/folders | |
| 🔔 Notification | push_message |
Push message |
push_error_message |
Push error message | |
| 🖥️ System | get_boot_progress |
Get boot progress |
get_system_version |
Get system version | |
get_system_time |
Get system time | |
| 📸 Snapshots | create_snapshot |
Create snapshot |
list_snapshots |
List snapshots | |
rollback_to_snapshot |
Rollback snapshot | |
| 🏷️ Tags | list_all_tags |
List all tags (prefix/depth supported) |
batch_replace_tag |
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:6806
Project 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 output
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。