SiYuan Note MCP Server is an implementation that bridges AI models with the SiYuan Note system, allowing models to interact with and manipulate your notes data. This server provides a comprehensive set of commands for managing notebooks, documents, content blocks, and more through the Model Context Protocol (MCP).
You can run the server directly with npx:
npx -y @onigeya/siyuan-mcp-server
Make sure to set the required environment variable:
# Windows
set SIYUAN_TOKEN=your-siyuan-token
# Linux/macOS
export SIYUAN_TOKEN=your-siyuan-token
pnpm install
# Windows
set SIYUAN_TOKEN=your-siyuan-token
# Linux/macOS
export SIYUAN_TOKEN=your-siyuan-token
pnpm start
docker run --rm -i \
-e SIYUAN_TOKEN=your-siyuan-token \
mcp/siyuan
Add the following configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"siyuan": {
"command": "npx",
"args": [
"-y",
"@onigeya/siyuan-mcp-server"
],
"env": {
"SIYUAN_TOKEN": "your-siyuan-token"
}
}
}
}
The MCP server provides various commands to interact with SiYuan Note. All commands support detailed documentation through the help
command.
You can get detailed information about any command using:
{
"type": "help",
"params": {
"type": "command.name"
}
}
For example:
{
"type": "help",
"params": {
"type": "block.insertBlock"
}
}
notebook.lsNotebooks
- List all notebooksnotebook.openNotebook
- Open a notebooknotebook.closeNotebook
- Close a notebooknotebook.createNotebook
- Create a new notebooknotebook.removeNotebook
- Remove a notebooknotebook.renameNotebook
- Rename a notebooknotebook.getNotebookConf
- Get notebook configurationnotebook.setNotebookConf
- Set notebook configurationfiletree.createDocWithMd
- Create document with Markdownfiletree.renameDoc
- Rename documentfiletree.removeDoc
- Remove documentfiletree.moveDocs
- Move documentsfiletree.getHPathByPath
- Get document HPath by pathfiletree.getHPathByID
- Get document HPath by IDexport.exportDoc
- Export documentexport.exportNotebook
- Export notebookblock.insertBlock
- Insert a new blockblock.updateBlock
- Update block contentblock.deleteBlock
- Delete a blockblock.moveBlock
- Move a blockblock.getBlockKramdown
- Get block Kramdown contentquery.block
- Query block by IDassets.uploadAssets
- Upload assetsfile.getFile
- Get file contentfile.putFile
- Put file contentfile.removeFile
- Remove a filefile.readDir
- List files in directoryquery.sql
- Execute SQL querysql.sql
- Execute SQL query (alternative)search.fullTextSearch
- Full text searchattr.setBlockAttrs
- Set block attributesattr.getBlockAttrs
- Get block attributesconvert.pandoc
- Convert content using Pandoctemplate.renderTemplate
- Render templatetemplate.renderSprig
- Render Sprig templatesystem.getBootProgress
- Get boot progresssystem.getVersion
- Get system versionsystem.getCurrentTime
- Get current timenotification.pushMsg
- Push message notificationnotification.pushErrMsg
- Push error message notificationnetwork.forwardProxy
- Forward proxy requestThe server requires the following environment variable:
SIYUAN_TOKEN
- SiYuan Note API token (required)
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "siyuan" '{"command":"npx","args":["-y","@onigeya/siyuan-mcp-server"],"env":{"SIYUAN_TOKEN":"your-siyuan-token"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"siyuan": {
"command": "npx",
"args": [
"-y",
"@onigeya/siyuan-mcp-server"
],
"env": {
"SIYUAN_TOKEN": "your-siyuan-token"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"siyuan": {
"command": "npx",
"args": [
"-y",
"@onigeya/siyuan-mcp-server"
],
"env": {
"SIYUAN_TOKEN": "your-siyuan-token"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect