SiYuan MCP Server
Enables AI assistants to create, read, update, and manage SiYuan notes, supporting notebook management, document operations, block editing, database attribute views, search, file operations, and export.
README
SiYuan MCP Server
English | 简体中文
Model Context Protocol (MCP) server for SiYuan Note.
Enable AI assistants to create, read, update, and manage your SiYuan notes directly.
Features
- Notebook Management — Create, rename, open/close, and organize notebooks
- Document Operations — List, create, edit, move, and delete documents
- Block-level Editing — Insert, prepend, append, update, delete, move, fold/unfold, and query content blocks
- Database (Attribute View) — Create tables, add/update/delete rows and columns
- Search & Query — Full-text search and SQL queries
- File Operations — Upload, download, list, and manage assets
- Export & Conversion — Export Markdown, Pandoc conversion
Installation
Requirements
- Node.js >= 18
- SiYuan Note running with API enabled
- SiYuan API Token (Settings → About → API Token)
NPM
npm install -g siyuan-mcp-server
NPX (no install)
npx siyuan-mcp-server
Configuration
Set the SIYUAN_TOKEN environment variable to your SiYuan API token.
Optional: set SIYUAN_API_URL (default: http://localhost:6806).
Claude Desktop
Add to your Claude Desktop config:
{
"mcpServers": {
"siyuan": {
"command": "npx",
"args": ["-y", "siyuan-mcp-server"],
"env": {
"SIYUAN_TOKEN": "your-api-token"
}
}
}
}
Available Commands
All commands are exposed both as standalone MCP tools and via the executeCommand dispatcher.
| Namespace | Description |
|---|---|
av.* |
Database (Attribute View) operations |
block.* |
Block-level CRUD, move, fold/unfold, query children |
filetree.* |
Document list/create/rename/remove/move |
notebook.* |
Notebook management |
file.* |
File read/write/list |
search.* |
Full-text search |
query.* |
SQL queries and block lookup |
attr.* |
Block attributes |
assets.* |
Asset upload |
export.* |
Export notebook / document |
convert.* |
Pandoc conversion |
system.* |
System info |
notification.* |
Push messages |
template.* |
Template rendering |
sql.* |
SQL queries |
network.* |
Forward proxy |
Notebook Commands
| Command | Description |
|---|---|
notebook.lsNotebooks |
List all notebooks |
notebook.openNotebook |
Open a closed notebook |
notebook.closeNotebook |
Close a notebook |
notebook.renameNotebook |
Rename a notebook |
notebook.createNotebook |
Create a new notebook |
notebook.removeNotebook |
Remove a notebook |
notebook.getNotebookConf |
Get notebook configuration |
notebook.setNotebookConf |
Set notebook configuration |
Document Commands
| Command | Description |
|---|---|
filetree.listDocsByPath |
List documents in a notebook by path |
filetree.createDocWithMd |
Create a document with Markdown content |
filetree.renameDoc |
Rename a document |
filetree.renameDocByID |
Rename a document by ID |
filetree.removeDoc |
Remove a document |
filetree.removeDocByID |
Remove a document by ID |
filetree.moveDocs |
Move documents |
filetree.moveDocsByID |
Move documents by ID |
filetree.getHPathByPath |
Get human-readable path by path |
filetree.getHPathByID |
Get human-readable path by ID |
Block Commands
| Command | Description |
|---|---|
block.insertBlock |
Insert a block after a specific block |
block.prependBlock |
Prepend blocks to a parent block |
block.appendBlock |
Append blocks to a parent block |
block.updateBlock |
Update block content |
block.deleteBlock |
Delete a block |
block.moveBlock |
Move a block |
block.getBlockKramdown |
Get block Kramdown content |
block.getChildBlocks |
Get child blocks of a parent block |
block.foldBlock |
Fold a block |
block.unfoldBlock |
Unfold a block |
Database Operations (Attribute View)
| Command | Description |
|---|---|
av.createAttributeView |
Create a new database table |
av.getAttributeView |
View database structure and rows |
av.addRow |
Add rows to a database |
av.updateRow |
Update row values |
av.deleteRow |
Delete rows |
av.addColumn |
Add a column |
av.removeColumn |
Remove a column |
av.updateCell |
Update a single cell |
Search & Query
| Command | Description |
|---|---|
search.fullTextSearch |
Full-text search across notes |
query.sql |
Execute SQL query on the database |
query.block |
Query a single block by ID |
File & Asset Commands
| Command | Description |
|---|---|
file.getFile |
Get file content |
file.putFile |
Upload/write a file |
file.removeFile |
Remove a file |
file.readDir |
List files in a directory |
assets.uploadAssets |
Upload asset files |
Other Commands
| Command | Description |
|---|---|
attr.setBlockAttrs |
Set block attributes |
attr.getBlockAttrs |
Get block attributes |
export.exportNotebook |
Export notebook |
export.exportDoc |
Export document |
convert.pandoc |
Convert files via Pandoc |
system.getBootProgress |
Get boot progress |
system.getVersion |
Get SiYuan version |
system.getCurrentTime |
Get server current time |
notification.pushMsg |
Push a notification message |
notification.pushErrMsg |
Push an error message |
template.renderTemplate |
Render a template |
template.renderSprig |
Render a Sprig template |
sql.sql |
Execute SQL query |
network.forwardProxy |
Forward HTTP request via proxy |
MCP Tools
In addition to executeCommand, the following standalone MCP tools are registered for direct LLM discoverability:
queryCommands— List available commandsexecuteCommand— Execute any command by namehelp— Get detailed help for a specific commandav_createAttributeView/av_getAttributeView/av_addRow/av_updateRow/av_deleteRow/av_addColumn/av_removeColumn/av_updateCell
Development
npm install
npm run build
npm test
npm run dev
Reinstalling after updates
- NPX users: No action needed —
npxalways fetches the latest published version. - NPM global install: Run
npm install -g siyuan-mcp-serveragain to upgrade. - Local source / development: Run
npm run buildafter pulling changes.
Attribution
This project is based on the original siyuan-mcp-server by Fromsko, which in turn builds upon earlier work by onigeya.
Significant modifications and enhancements have been made, including:
- Database (Attribute View) creation and full CRUD support
- Fixed
file.getFileandfile.putFilecommands - Independent MCP tool registration for better LLM discoverability
- Added
filetree.listDocsByPath,block.prependBlock,block.appendBlock,block.getChildBlocks,block.foldBlock,block.unfoldBlock - Added
filetree.removeDocByID,filetree.renameDocByID,filetree.moveDocsByID - Added
export.exportNotebook,system.getBootProgress,notification.pushErrMsg,template.renderSprig - AV blockID-to-avID auto-resolution and SQL fallback for robust database access
Known API Behaviors
filetree.createDocWithMd: Does not overwrite existing documents when the samepathis used repeatedly.block.updateBlock: Replaces the content of a single block, not the entire document. To rewrite a whole document, delete its child blocks and append new content.filetree.removeDoc: May return success while the document remains visible due to SiYuan's internal index/cache. Usefiletree.removeDocByIDas a more reliable alternative when you have the document ID.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。