Siyuan MCP Server

Safe, structured Model Context Protocol server for SiYuan Note

Local serverstdioTypeScript

What is the Siyuan MCP server?

Siyuan MCP server exists for a simple reason — assistants are far more useful when they can act on Siyuan directly instead of describing what you should do. Safe, structured Model Context Protocol server for SiYuan Note.

What you get

siyuan-mcp 是一个基于 Model Context Protocol 的思源笔记 MCP 服务器。它通过思源 Kernel API 提供笔记本、文档、内容块、全文搜索、原生数据库、资源文件和导出等能力,并针对 AI 自动化场景增加了结构化返回、安全注解与默认防护。

Setting it up

The server ships on npm as siyuan-mcp, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

What the assistant can call

Once Siyuan is connected, these are the calls the assistant has available:

  • command — npx
  • args — ["-y", "siyuan-mcp@latest"]
  • env — - SIYUAN_HOST
  • SIYUAN_PORT — SIYUAN_TOKEN
  • check_siyuan_status — list_notebooks
  • get_version — --
  • nextID — previousID
  • list_notebooks — 列出所有笔记本及打开状态
  • create_notebook — 创建笔记本
  • rename_notebook — 重命名笔记本
  • remove_notebook — 删除笔记本,属于危险操作
  • create_doc — 使用 Markdown 创建文档

Configuration and credentials

You will need 4 environment variables: SIYUAN_HOST, SIYUAN_PORT, SIYUAN_TOKEN, SIYUAN_URL. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Siyuan.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the siyuan mcp server does with a few real requests.

Choosing this one

This sits in the planning and project tracking group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Siyuan's toolset — command, args, env and 11 more — is a fair guide to whether it matches your workflow. It is maintained by xuguiqi; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Siyuan's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
commandnpx
args["-y", "siyuan-mcp@latest"]
env- SIYUAN_HOST
SIYUAN_PORTSIYUAN_TOKEN
check_siyuan_statuslist_notebooks
get_version--
nextIDpreviousID
list_notebooks列出所有笔记本及打开状态
create_notebook创建笔记本
rename_notebook重命名笔记本
remove_notebook删除笔记本,属于危险操作
create_doc使用 Markdown 创建文档
search_docs按标题搜索文档
list_docs浏览指定路径下的文档

How to install the Siyuan MCP server

### MCP 客户端配置

下面的配置用于连接运行在宿主机上的思源:

```json
{
  "mcpServers": {
    "siyuan_note": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--add-host",
        "host.docker.internal:host-gateway",
        "-e",
        "SIYUAN_HOST=host.docker.internal",
        "-e",
        "SIYUAN_PORT=6806",
        "-e",
        "SIYUAN_TOKEN",
        "zhizhiqq/siyuan-mcp:latest"
      ],
      "env": {
        "SIYUAN_TOKEN": "your-api-token-here"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
SIYUAN_HOSTEndpoint or connection string the server talks to.Optional
SIYUAN_PORTConfiguration value read at startup.Optional
SIYUAN_TOKENCredential the server authenticates with.Yes
SIYUAN_URLEndpoint or connection string the server talks to.Yes

Example prompts to try

  • Use Siyuan to command.
  • Use Siyuan to args.
  • Use Siyuan to env.

Frequently asked questions

It connects Siyuan to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (command, args, env, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Siyuan directly.