知识库连接协议

通过模型上下文协议(MCP)将AI代理连接到Wolai知识库,实现页面读写、搜索和导航功能。

  • by WuChaoli
  • TypeScript
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 WuChaoli/wolai-mcp

使用说明

沃莱MCP服务器🐺

英语 | 中文

将AI代理连接到您的 沃莱 知识库 通过模型上下文协议(MCP)。

读取、写入、搜索和导航您的Wolai页面——所有这些都来自Claude、Cursor、OpenCode或任何兼容MCP的AI代理。


✨ 特性

类别 工具 描述
📖 阅读 get_block, get_block_children, get_breadcrumbs 阅读页面、列出子项、浏览层次结构
✏️ 写 create_block, update_block, delete_block 创建、更新和删除块
📊 数据库 get_database, create_database_row, query_database_rows 查询和修改数据库表
🔍 搜索 search_pages 跨页面树的模糊标题搜索
📎 上传 upload_file 将文件附件上传到页面
🔑 Token create_token, refresh_token 管理API身份验证令牌
⚙️ 配置 get_config, update_config 运行时配置管理

共16个工具 --涵盖读、写、数据库、搜索、上传、令牌和配置。


🚀 快速开始

安装

npm install -g wolai-mcp
# or
npx wolai-mcp

获取凭据

  1. 首选 Wolai开发者控制台
  2. 创建应用程序→ get 应用ID 和 应用密钥
  3. 查找 根页面ID 从您的Wolai页面URL(后面的部分 wolai.com/)

交互式设置

npx wolai-mcp init

按照提示输入您的凭据。他们将被拯救 ~/.wolai-mcp/config.json.

环境变量

或者,设置环境变量:

export WOLAI_APP_ID="your_app_id"
export WOLAI_APP_SECRET="your_app_secret"
export WOLAI_ROOT_ID="your_root_page_id"  # optional, for search

📋 平台配置

OpenCode

添加到您的 opencode.json:

{
  "mcp": {
    "wolai-mcp": {
      "command": "npx",
      "args": ["wolai-mcp"],
      "env": {
        "WOLAI_APP_ID": "your_app_id",
        "WOLAI_APP_SECRET": "your_app_secret",
        "WOLAI_ROOT_ID": "your_root_page_id"
      }
    }
  }
}

克劳德桌面版

添加 claude_desktop_config.json:

{
  "mcpServers": {
    "wolai-mcp": {
      "command": "npx",
      "args": ["wolai-mcp"],
      "env": {
        "WOLAI_APP_ID": "your_app_id",
        "WOLAI_APP_SECRET": "your_app_secret",
        "WOLAI_ROOT_ID": "your_root_page_id"
      }
    }
  }
}

Cursor/CherryStudio/其他MCP客户端

{
  "wolai-mcp": {
    "command": "npx",
    "args": ["wolai-mcp"],
    "env": {
      "WOLAI_APP_ID": "your_app_id",
      "WOLAI_APP_SECRET": "your_app_secret",
      "WOLAI_ROOT_ID": "your_root_page_id"
    }
  }
}

💡 使用示例

配置后,询问您的AI代理:

  • "读取我 Wolai 知识库的首页内容"
  • "搜索标题包含'项目计划'的页面"
  • "在指定页面下创建一个新页面叫'会议纪要'"
  • "往指定页面添加一段代码"
  • "查询我的数据表格内容"
  • "显示当前 Wolai 配置状态"

🔧 工具参考

许可证管理

create_token

创建一个新的API令牌。

  • app_id (string):沃莱应用程序ID
  • app_secret (string):沃莱应用秘密

refresh_token

刷新当前API令牌。

区块操作

get_block

获取特定块或页面的详细信息。

  • id (string):块ID或页面ID

get_block_children

获取给定块或页面的子块。

  • id (字符串):父块ID
  • cursor (字符串,可选):分页光标
  • page_size (数字,可选):每页结果(默认值:100)

create_block

在父级下创建新块。

  • parent_id (string):父块或页面ID
  • type (字符串):块类型(文本、标题、项目符号、代码等)
  • content (字符串,可选):阻止内容文本
  • text_alignment (字符串,可选):左、中或右
  • level (数字,可选):标题级别1-3
  • language (字符串,可选):代码块的代码语言

update_block

更新现有块。

  • id (字符串):块ID
  • content (字符串,可选):新内容
  • text_alignment (字符串,可选):新对齐方式
  • level (数字,可选):新标题级别

delete_block

删除块。

  • id (字符串):块ID

get_breadcrumbs

获取块的面包屑路径。

  • id (字符串):块ID

数据库操作

get_database

获取数据库结构和数据。

  • id (string):数据库ID

create_database_row

向数据库添加行。

  • database_id (string):数据库ID
  • cells (string):单元格数据的JSON字符串

query_database_rows

使用分页查询数据库行。

  • database_id (string):数据库ID
  • cursor (字符串,可选):分页光标
  • page_size (数字,可选):每页结果

搜索

search_pages

按标题关键字搜索页面。

  • query (string):搜索关键字
  • root_id (字符串,可选):从根页面开始搜索

上传

upload_file

上传文件附件。

  • parent_id (string):父块或页面ID
  • file_path (string):本地文件路径

配置

get_config

获取当前配置(隐藏机密)。

update_config

更新配置。

  • app_id (字符串,可选):新应用ID
  • app_secret (字符串,可选):新应用密钥
  • root_id (字符串,可选):新根页面ID

📄 许可证

MIT许可证——见 许可证 了解详情。