思源笔记 MCP (Model Context Protocol) 服务,提供与思源笔记 API 的交互接口。
克隆项目
git clone https://github.com/your-username/siyuan-mcp-wingman.git
cd siyuan-mcp-wingman
安装依赖
# 使用 uv 包管理器
pip install uv
uv pip install -e .
运行服务
# 设置环境变量
export SIYUAN_URL=http://localhost:6806
export SIYUAN_TOKEN=your-token-here
# 启动服务
python server.py
docker run -d --name siyuan-mcp -p 8000:8000 \
-e SIYUAN_URL=http://your-siyuan-server:6806 \
-e SIYUAN_TOKEN=your-actual-token \
brantwang/siyuan-mcp-wingman:v0.0.7
| 环境变量 | 描述 | 默认值 |
|---|---|---|
| SIYUAN_URL | 思源服务器地址 | http://127.0.0.1:6806 |
| SIYUAN_TOKEN | 认证令牌 | isbpqifdo2jv0cbc |
服务启动后,MCP 端点地址为:http://localhost:8000/mcp
笔记本管理
list_notebooks() - 获取笔记本列表get_notebook_conf(notebook_id: str) - 获取笔记本配置get_notebook_by_name(name: str) - 根据名称获取笔记本文档操作
create_doc_with_md(notebook_id: str, path: str, markdown: str) - 使用 Markdown 创建文档搜索功能
full_text_search_block(query: str, page_size: int = 50, notebook_id: Optional[str] = None, method: int = 0, orderBy: int = 0, types: Optional[dict] = None, path: Optional[str] = None) - 全文搜索块search_block(query: str, notebook_id: Optional[str] = None) - 搜索块search_tag(keyword: str = "") - 搜索标签search_ref_block(id: str, root_id: str, keyword: str, before_len: int, req_id: Optional[str] = None, is_square_brackets: bool = False, is_database: bool = False) - 搜索引用块search_template(keyword: str = "") - 搜索模板search_widget(keyword: str = "") - 搜索小部件search_embed_block(embed_block_id: str, stmt: str, exclude_ids: Optional[List[str]] = None, heading_mode: int = 0, breadcrumb: bool = False) - 搜索嵌入块get_embed_block(embed_block_id: str, include_ids: List[str], heading_mode: int = 0, breadcrumb: bool = False) - 获取嵌入块导出功能
export_md_content(doc_id: str) - 导出 Markdown 内容export_preview_html(doc_id: str, keep_lazy_load: bool = False) - 导出预览 HTML系统管理
version() - 获取思源版本号get_current_time() - 获取思源服务器当前时间get_workspace_dir() - 获取工作空间目录get_conf() - 获取配置大纲管理
get_doc_outline(doc_id: str) - 获取文档大纲同步管理
get_sync_info() - 获取同步信息perform_sync(mode: str = "0") - 执行同步MIT License
Content type
Image
Digest
sha256:652f7926e…
Size
91.3 MB
Last updated
7 months ago
docker pull brantwang/siyuan-mcp-wingman