loading…
Search for a command to run...
loading…
Enables interaction with the WhkerDB shared PDF editor to manage collaborative rooms, file structures, and real-time annotations. It allows users to upload PDFs
Enables interaction with the WhkerDB shared PDF editor to manage collaborative rooms, file structures, and real-time annotations. It allows users to upload PDFs and images, manage note trees, and sync data across platforms through natural language.
讲了么(WhkerDB)的 MCP(Model Context Protocol)服务器实现,为 AI 助手和第三方应用提供讲了么共享 PDF 编辑器的完整功能访问能力。
# 克隆仓库
git clone https://github.com/A-Quark2005/whkerdb-mcp.git
cd whkerdb-mcp
# 安装依赖
pnpm install
# 构建项目
pnpm build
# 设置服务器地址(可选,默认 https://share.whkerdb.top)
export WHKERDB_SERVER_URL=https://share.whkerdb.top
# 启动 MCP 服务器
pnpm start
npx @modelcontextprotocol/inspector stdio node dist/index.js
在 Claude Desktop 配置文件中添加以下配置:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"whkerdb": {
"command": "node",
"args": ["/absolute/path/to/whkerdb-mcp/dist/index.js"],
"env": {
"WHKERDB_SERVER_URL": "https://share.whkerdb.top"
}
}
}
}
使用命令行添加项目级配置(配置会写入项目根目录的 .mcp.json):
# Windows PowerShell
claude mcp add -s project whkerdb node C:\path\to\whkerdb-mcp\dist\index.js -e WHKERDB_SERVER_URL=https://share.whkerdb.top
# macOS/Linux
claude mcp add -s project whkerdb node /path/to/whkerdb-mcp/dist/index.js -e WHKERDB_SERVER_URL=https://share.whkerdb.top
命令行方式:
# Windows PowerShell
codex mcp add whkerdb --env WHKERDB_SERVER_URL=https://share.whkerdb.top -- node C:\path\to\whkerdb-mcp\dist\index.js
# macOS/Linux
codex mcp add whkerdb --env WHKERDB_SERVER_URL=https://share.whkerdb.top -- node /path/to/whkerdb-mcp/dist/index.js
配置文件方式(~/.codex/config.toml):
[mcp_servers.whkerdb]
command = "node"
args = ['/path/to/whkerdb-mcp/dist/index.js']
[mcp_servers.whkerdb.env]
WHKERDB_SERVER_URL = "https://share.whkerdb.top"
使用 MCP Inspector 进行交互式测试和调试:
npx @modelcontextprotocol/inspector stdio node dist/index.js
| 工具 | 描述 |
|---|---|
whkerdb_create_room |
创建新房间 |
whkerdb_join_room |
加入房间(支持房间 ID 或邀请码) |
whkerdb_get_room_info |
获取房间信息 |
whkerdb_list_rooms |
列出已加入的房间 |
whkerdb_export_snapshot |
导出房间快照 |
whkerdb_leave_room |
离开房间 |
| 工具 | 描述 |
|---|---|
whkerdb_get_note_tree |
获取笔记树结构 |
whkerdb_add_file |
添加文件节点 |
whkerdb_add_page |
添加页面节点 |
whkerdb_delete_node |
删除节点 |
whkerdb_move_node |
移动节点 |
whkerdb_update_node |
更新节点属性 |
whkerdb_get_node |
获取节点详情 |
| 工具 | 描述 |
|---|---|
whkerdb_get_page_objects |
获取页面对象 |
whkerdb_add_text |
添加文本标注 |
whkerdb_add_path |
添加路径(画笔/高亮笔) |
whkerdb_add_image |
添加图片 |
whkerdb_update_object |
更新对象属性 |
whkerdb_delete_object |
删除对象 |
| 工具 | 描述 |
|---|---|
whkerdb_upload_pdf |
上传 PDF 文件 |
whkerdb_list_pdfs |
列出房间内 PDF |
whkerdb_get_pdf_info |
获取 PDF 信息 |
| 工具 | 描述 |
|---|---|
whkerdb_upload_image |
上传图片 |
whkerdb_list_images |
列出房间内图片 |
说明:带 {} 的为资源模板(resources/templates/list);加入房间后也可以通过 resources/list 获取当前房间的实际资源 URI。
| URI | 描述 |
|---|---|
whkerdb://rooms |
房间列表 |
whkerdb://rooms/{roomId} |
房间详情 |
whkerdb://rooms/{roomId}/tree |
笔记树结构 |
whkerdb://rooms/{roomId}/pages/{nodeId} |
页面内容 |
whkerdb://pdfs/{pdfId}/info |
PDF 信息 |
// 1. 创建房间
whkerdb_create_room({ name: "我的项目" })
// 2. 加入房间
whkerdb_join_room({ roomId: "room-id" })
// 3. 创建文件节点
whkerdb_add_file({
parentId: "root",
name: "文档.pdf"
})
// 4. 添加页面
whkerdb_add_page({
parentId: "file-id",
name: "第1页"
})
// 5. 添加文本标注
whkerdb_add_text({
pageId: "page-id",
content: "这是重要注释",
x: 100,
y: 200
})
// 1. 加入房间
whkerdb_join_room({ roomId: "room-id" })
// 2. 上传 PDF(自动创建节点)
whkerdb_upload_pdf({
filePath: "/path/to/document.pdf",
name: "文档.pdf"
})
// 3. 查看树结构
whkerdb_get_note_tree({ roomId: "room-id" })
// 4. 在页面上添加标注
whkerdb_add_text({
pageId: "page-id",
content: "需要重点注意",
x: 150,
y: 300
})
whkerdb-mcp/
├── src/
│ ├── client/ # 讲了么MCP客户端实现
│ ├── resources/ # MCP 资源定义
│ ├── tools/ # MCP 工具实现
│ │ ├── roomTools.ts
│ │ ├── treeTools.ts
│ │ ├── objectTools.ts
│ │ ├── pdfTools.ts
│ │ └── imageTools.ts
│ ├── server.ts # MCP 服务器配置
│ └── index.ts # 入口文件
├── dist/ # 编译输出
├── bin/ # 可执行文件
└── package.json
# 开发模式(监听文件变化)
pnpm dev
# 构建项目
pnpm build
# 启动服务器
pnpm start
# 启动 stdio 模式
pnpm start:stdio
| 变量 | 描述 | 默认值 |
|---|---|---|
WHKERDB_SERVER_URL |
讲了么(WhkerDB)服务器地址 | https://share.whkerdb.top |
https://share.whkerdb.top,也可配置本地服务器)whkerdb_join_room)欢迎提交 Issue 和 Pull Request!
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"whkerdb-mcp-server": {
"command": "npx",
"args": []
}
}
}