Provides comprehensive tools for interacting with SiYuan Note API, enabling document creation, content search, file operations, daily note management, and notebook operations through a complete TypeScript interface.
SiYuan MCP Server
中文文档 | English
A Model Context Protocol (MCP) server for SiYuan Note, enabling AI assistants like Claude, Cursor, and other MCP-compatible tools to interact with your SiYuan notes seamlessly.
⚠️ Important Notice | 重要声明
English:
The code in this project is primarily developed with AI assistance. While functional testing has been performed, comprehensive code review has not been completed. Before using this project, please be aware of and accept the following:
The code may contain undiscovered issues or potential risks
Conduct necessary code reviews and testing before use
Users assume all risks and responsibilities arising from the use of this project
Thorough validation is recommended before production use
Use with caution and at your own risk.
中文:
本项目代码主要由 AI 辅助开发,仅进行了功能性测试,未对所有代码进行完整审查。使用本项目前,请充分了解并接受以下内容:
代码可能存在未发现的问题或潜在风险
请在使用前进行必要的代码审查和测试
使用者需自行承担使用本项目所产生的风险和责任
建议在生产环境使用前进行充分的验证
请谨慎使用,并对自己的选择负责。
✨ Features
🚀 Full MCP (Model Context Protocol) implementation
📝 15 essential tools for comprehensive SiYuan Note operations
🔍 Unified search (content, filename, tag, and combinations)
📁 Document management (create, read, update, move, tree)
📅 Daily note support with auto-creation
📚 Notebook operations
📸 Snapshot management (backup & restore)
🏷️ Tag management (list, replace)
💻 Written in TypeScript with full type definitions
🌐 Works with Claude Desktop, Cursor, and any MCP-compatible client
📦 Installation
Option 1: Install from Source (Recommended)
Option 2: Install from npm
After global installation, the siyuan-mcp command will be available globally.
🔧 Configuration
Prerequisites
Get your SiYuan API Token:
Open SiYuan Note
Go to Settings → About → API Token
Copy the token
Ensure SiYuan is running:
Default URL:
http://127.0.0.1:6806If using a different port, adjust the
baseUrlaccordingly
Configure for Cursor
Edit your MCP configuration file at ~/.cursor/mcp.json:
Note: If you installed globally, you can use "command": "siyuan-mcp" instead of "command": "npx".
Configure for Claude Desktop
Edit the configuration file at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Note: If you installed globally, you can use "command": "siyuan-mcp" instead of "command": "npx".
Verify Installation
After configuration, restart your MCP client (Cursor/Claude Desktop) and try:
"List all my SiYuan notebooks"
"Search for documents containing 'project plan'"
"Create a new meeting note in my work notebook"
"Show me the 5 most recently modified documents"
🛠️ Available MCP Tools
Once configured, you can interact with SiYuan through natural language. The server provides 15 essential tools:
🔍 Search
unified_search - Unified search tool: search by content, filename, tag, or any combination
📄 Document Operations
get_document_content - Get the markdown content of a document
create_document - Create a new document
append_to_document - Append content to an existing document
update_document - Update (overwrite) document content
move_documents - Move one or more documents to a new location
get_document_tree - Get document tree structure with specified depth
📅 Daily Note
append_to_daily_note - Append to today's daily note (auto-creates if needed)
📚 Notebook Management
list_notebooks - List all notebooks
get_recently_updated_documents - Get recently updated documents
📸 Snapshot Management
create_snapshot - Create a data snapshot for backup
list_snapshots - List available snapshots
rollback_to_snapshot - Rollback to a specific snapshot
🏷️ Tag Management
list_all_tags - List all unique tags in workspace
Supports filtering by prefix (
prefixparameter)Supports limiting by depth level (
depthparameter, starts from 1, tags separated by/)
batch_replace_tag - Batch replace or remove tags across all documents
Usage Examples
Ask your AI assistant naturally:
📖 Tool Parameters Reference
move_documents
Move one or more documents to a new location.
Parameters:
from_ids(string[]) - Required. Array of document IDs to moveFor a single document, use an array with one element:
["20210101000000-abc1234"]For multiple documents:
["20210101000000-abc1234", "20210102000000-def5678"]
to_parent_id(string) - OPTION 1: Target parent document ID. Documents will be moved under this document as children. Cannot be used together withto_notebook_root.to_notebook_root(string) - OPTION 2: Target notebook ID. Documents will be moved to the root (top level) of this notebook. Cannot be used together withto_parent_id.
Important: You must provide EXACTLY ONE destination: either to_parent_id OR to_notebook_root.
Examples:
batch_replace_tag
Batch replace all occurrences of a tag across all documents.
Parameters:
old_tag(string) - Required. Tag name to replace (without # symbol)new_tag(string) - Required. New tag name (without # symbol, use empty string to remove)
Examples:
🔧 Advanced: Using as TypeScript Library
While primarily designed as an MCP server, you can also use this package as a TypeScript library in your own projects:
Type Definitions
Full TypeScript types are included:
💻 Development
Setup
Manual Testing
🏗️ Architecture
🔧 Tech Stack
Language: TypeScript 5.3+
Runtime: Node.js 18+
Module System: ES Modules
MCP SDK: @modelcontextprotocol/sdk
Protocol: MCP (Model Context Protocol)
❓ FAQ
How do I get my SiYuan API Token?
Open SiYuan Note
Go to Settings → About → API Token
Copy the token
How do I find my notebook ID?
Ask your MCP client: "List all my SiYuan notebooks" and it will show IDs.
Or programmatically:
The server isn't working, what should I check?
Is SiYuan running? (default: http://127.0.0.1:6806)
Is your API token correct?
Did you restart your MCP client after configuration?
Check the logs in your MCP client
Can I use a different SiYuan port?
Yes! Just update the baseUrl parameter:
Does this work with remote SiYuan instances?
Yes! Point baseUrl to your remote instance:
🤝 Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
📄 License
Apache-2.0
🔗 Related Projects
SiYuan Note - Official SiYuan Note repository
Model Context Protocol - MCP documentation
MCP TypeScript SDK - Official MCP SDK
🙏 Acknowledgments
This project is primarily developed with AI assistance and built on top of the excellent SiYuan Note project.
This server cannot be installed