home / mcp / siyuan mcp server
Provides an MCP server to interact with SiYuan Note, enabling unified search, document operations, daily notes, snapshots, and tag management.
Configuration
View docs{
"mcpServers": {
"porkll-siyuan-mcp": {
"command": "npx",
"args": [
"-y",
"@porkll/siyuan-mcp",
"stdio",
"--token",
"YOUR_API_TOKEN_HERE",
"--baseUrl",
"http://127.0.0.1:6806"
]
}
}
}You can run a complete MCP server for SiYuan Note that lets AI assistants like Claude or Cursor interact with your notes. This server implements the Model Context Protocol, enabling powerful, natural-language access to notebooks, documents, daily notes, and more while keeping actions organized through standard MCP tooling.
Install and run the MCP server, then connect your MCP client to it. With the server active, you can ask your AI assistant to search across content, read or create documents, manage notebooks and daily notes, handle tags, and create or restore snapshots. Use straightforward prompts like listing notebooks, searching for documents, creating or moving notes, and appending to the daily note. The MCP server exposes a set of practical tools that translate your natural-language requests into SiYuan operations.
Follow these concrete steps to prepare and run the MCP server so your AI assistant can work with SiYuan notes.
Prerequisites you need to satisfy before starting the MCP server:
# Clone the project
# (Use the exact repository name shown in your source tree)
# Then install dependencies and build as described in the configuration stepsObtain your SiYuan API Token from SiYuan Note under Settings → About → API Token. This token is used to authorize MCP operations.
Ensure SiYuan is running locally. The default base URL is http://127.0.0.1:6806. If you run SiYuan on a different port, adjust the baseUrl accordingly in the configuration.
Configure the MCP client to connect to the Siyuan MCP server. Create or edit the MCP configuration file for Cursor or Claude Desktop as shown below. The configuration uses an MCP stdio transport that launches the MCP server via npx with your token and baseUrl.
{
"mcpServers": {
"siyuan-mcp": {
"command": "npx",
"args": [
"-y",
"@porkll/siyuan-mcp",
"stdio",
"--token",
"YOUR_API_TOKEN_HERE",
"--baseUrl",
"http://127.0.0.1:6806"
]
}
}
}If you installed globally, you can substitute the command with "command": "siyuan-mcp" in place of "npx".
For Claude Desktop or Cursor, place a matching configuration in the platform’s MCP section. The same JSON snippet above applies; adjust it if your client requires a slightly different placement or file path.
After configuring, restart your MCP client to apply changes. Then test with simple requests such as listing notebooks, searching documents, creating new notes, or showing recently modified documents.
If you encounter issues, verify the following common causes: SiYuan is running on the expected URL, the API token is correct, and you have restarted the MCP client after applying changes. Check logs in your MCP client for error messages.
You can adapt the setup to remote SiYuan instances by changing the baseUrl parameter in the configuration to the remote address, such as http://your-server.com:6806. Ensure your network allows access to the specified port.
Once connected, you can perform common operations via natural language prompts, such as listing notebooks, searching by keywords, creating documents in a specific notebook, moving documents under a parent, or appending to today’s daily note. You can also create and manage snapshots to safeguard your data before large changes.
Treat your API token as a secret and do not expose it in shared environments. Regularly rotate credentials and limit access to trusted clients. Validate all actions in a test environment before applying changes to your production SiYuan data.
Unified search across content, filename, tag, and combinations.
Retrieve the markdown content of a document.
Create a new document in a specified notebook.
Append content to an existing document.
Overwrite content of a document.
Move one or more documents to a new location within notebooks.
Fetch the document tree structure with a specified depth.
Append content to today’s daily note, auto-creating if needed.
List all notebooks in the workspace.
Retrieve documents recently modified.
Create a data snapshot for backup.
List available snapshots.
Rollback to a selected snapshot.
List all unique tags in the workspace with optional filtering by prefix and depth.
Batch replace or remove tags across all documents.