baidudisk-mcp
Use this skill to run Baidu Netdisk tools through mcporter.
1) Enable server in mcporter
Run:
CODEBLOCK0
This writes a baidudisk stdio server entry into config/mcporter.json with:
- - command: INLINECODE3
- args: INLINECODE4
- env: INLINECODE5
Check status:
CODEBLOCK1
2) Credential file and hot update
Credential file (local only):
INLINECODE6
Expected keys:
- -
access_token (required) - INLINECODE8 (recommended)
Example (do not commit real token):
CODEBLOCK2
The MCP server reads this file on every tool call.
So token rotation only needs editing this file; no server restart is required.
3) 2.0 tools
3.1 Official-aligned tools (主推)
四个基础列表接口与 MCP tool 对应关系:
- -
/rest/2.0/xpan/file?method=list → INLINECODE10 - INLINECODE11 → INLINECODE12
- INLINECODE13 → INLINECODE14
- INLINECODE15 → INLINECODE16
另保留一个历史兼容视频工具(非官方 videolist 参数模型):
- -
file_video_list(dir?, recursion?, start?, limit?, order?, desc?)(基于 xpanfilelistall 过滤视频)
其他工具:
- - INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22
- INLINECODE23
- INLINECODE24
- INLINECODE25
- INLINECODE26
- INLINECODE27
- INLINECODE28
- INLINECODE29
- INLINECODE30
- INLINECODE31
- INLINECODE32
- INLINECODE33
- INLINECODE34
- INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38 (当前
unsupported stub) - INLINECODE40 (当前
unsupported stub) - INLINECODE42
- INLINECODE43
3.2 Legacy aliases (兼容保留)
- - INLINECODE44
- INLINECODE45
- INLINECODE46
- INLINECODE47
- INLINECODE48
- INLINECODE49
- INLINECODE50
- INLINECODE51
4) mcporter examples
CODEBLOCK3
5) Batch return envelope(8.2)
INLINECODE52 统一返回:
- -
status, tool, dry_run, async_mode, ondup, INLINECODE58 - INLINECODE59 , INLINECODE60
- INLINECODE61 (
ok_chunks/failed_chunks/ok_items_est/failed_items_est) - INLINECODE63 (每个 chunk:
chunk_index/items/request_preview/response(errno/taskid/info)) - INLINECODE65 (失败 chunk 的
chunk_index/message/items_preview)
6) Minimal self-check(不含 delete)
请不要直接用 python3(容易缺 mcp 依赖)。
CODEBLOCK4
覆盖点:
- -
file_move_batch(10 条 + 分片降级) - INLINECODE70 (
ondup=fail 与 ondup=newcopy) - INLINECODE73
- INLINECODE74
- INLINECODE75
- 四个列表基础能力(只读):
-
file_list(dir='/', limit=3)
-
file_image_list(parent_path='/来自:iPhone', recursion=0, page=1, num=3, order='time', desc=1)
-
file_doc_list(parent_path='/Openclaw', recursion=1, page=1, num=3, order='time', desc=1)
-
file_video_list_api(parent_path='/', recursion=1, page=1, num=3, order='time', desc=1)(根目录为空时回退
/来自:iPhone /
/Openclaw)
7) Safety defaults
- - Never store
access_token in repo files. - Error messages sanitize
access_token patterns. - INLINECODE84 rejects by default unless
confirm="DELETE". - Batch move/copy restricts destination by
allow_dest_prefixes(默认 ['/Openclaw'])。 - INLINECODE88 默认
ondup=fail(不覆盖);file_copy_batch 默认 ondup=newcopy(冲突产出副本,不覆盖)。 - INLINECODE92 only allows
http(s) and rejects localhost / 内网 / 保留地址;并限制下载大小与超时。
baidudisk-mcp
使用此技能通过 mcporter 运行百度网盘工具。
1) 在 mcporter 中启用服务
运行:
bash
bash scripts/baidudisk_mcporter.sh register
这会将 baidudisk stdio 服务条目写入 config/mcporter.json,包含:
- - 命令:/home/linuxbrew/.linuxbrew/bin/uv
- 参数:--directory /skills/baidudisk-mcp/server run netdisk.py
- 环境变量:BAIDUNETDISKTOKEN_FILE=~/.openclaw/credentials/baidudisk.json
检查状态:
bash
bash scripts/baidudisk_mcporter.sh check
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json list baidudisk
2) 凭证文件与热更新
凭证文件(仅本地):
~/.openclaw/credentials/baidudisk.json
预期键值:
- - accesstoken(必填)
- defaultdir(推荐)
示例(请勿提交真实 token):
json
{
access_token: <已脱敏>,
default_dir: /Openclaw/baidudisk
}
MCP 服务器在每次工具调用时读取此文件。
因此 token 轮换只需编辑此文件,无需重启服务器。
3) 2.0 工具
3.1 官方对齐工具(主推)
四个基础列表接口与 MCP tool 对应关系:
- - /rest/2.0/xpan/file?method=list → filelist(dir?, limit?, order?, desc?, start?)
- /rest/2.0/xpan/file?method=imagelist → fileimagelist(parentpath?, recursion?, page?, num?, order?, desc?, web=1)
- /rest/2.0/xpan/file?method=doclist → filedoclist(parentpath?, recursion?, page?, num?, order?, desc?)
- /rest/2.0/xpan/file?method=videolist → filevideolistapi(parent_path?, recursion?, page?, num?, order?, desc?, web=1)
另保留一个历史兼容视频工具(非官方 videolist 参数模型):
- - filevideolist(dir?, recursion?, start?, limit?, order?, desc?)(基于 xpanfilelistall 过滤视频)
其他工具:
- - categoryinfo(category, parentpath=/, recursion=1)
- categoryinfomulti(categories, parentpath=/, recursion=1)
- imagegettags(type=1)
- imagegettagssummary(type=1, top=50)
- imagesearch(searchtype, keyword, start=0, limit=100, size?)
- recentlist(category=3, start=0, limit=100, sortby?, order?, stime?, etime?, resolution=off)
- filemeta(fsids, dlink?, thumb?, extra?, needmedia?, path?)
- makedir(path, parentdir?)
- filecopy(srcpath, destdir, newname?, ondup?)
- filecopybatch(items, ondup=newcopy, asyncmode=1, chunksize=100, dryrun=false, allowdestprefixes=[/Openclaw])
- filedel(path, confirm)
- filemove(srcpath, destdir, newname?, ondup?)
- filemovebatch(items, ondup=fail, asyncmode=1, chunksize=100, dryrun=false, allowdestprefixes=[/Openclaw])
- filerename(path, newname)
- filerenamebatch(items, asyncmode=1, chunksize=100, dryrun=false)
- fileuploadstdio(localfilepath, remotedir?, remotename?)
- fileuploadbyurl(url, remotedir?, remotename?, timeouts?, maxbytes?)
- fileuploadbytext(text, remotedir?, remotename?, maxchars?, maxbytes?)
- filekeywordsearch(keyword, dir?, recursion?, num?, page?)
- filesemanticssearch(...)(当前为 unsupported 桩)
- filesharelinkset(...)(当前为 unsupported 桩)
- userinfo()
- getquota(checkexpire?, checkfree?)
3.2 旧版别名(兼容保留)
- - list
- search
- mkdir
- move
- rename
- delete
- upload
- download
4) mcporter 示例
bash
对齐 list:/rest/2.0/xpan/file?method=list
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file_list dir=/ limit=3
对齐 imagelist:/rest/2.0/xpan/file?method=imagelist
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
imagelist parent_path=/来自:iPhone recursion=0 page=1 num=3 order=time desc=1
对齐 doclist:/rest/2.0/xpan/file?method=doclist
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
doclist parent_path=/Openclaw recursion=1 page=1 num=3 order=time desc=1
对齐 videolist:/rest/2.0/xpan/file?method=videolist
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
videolist
api parentpath=/ recursion=1 page=1 num=3 order=time desc=1
若根目录返回 count=0,可改 parent_path=/来自:iPhone 或 /Openclaw
官方同名:关键词搜索
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
keywordsearch keyword=invoice num=20
分类统计(单分类:图片=3)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.category
info category=3 parentpath=/ recursion=1
分类统计(多分类:JSON array)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.category
infomulti categories=[1,3,4,6] parent_path=/ recursion=1
图片智能标签
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image_gettags type=1
图片智能标签摘要(按 count 取前 20)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image
gettagssummary type=1 top=20
图片关键字检索(search_type=2 表示汉字)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.image_search \
search
type=2 keyword=截图 limit=20 size=c256u256,c512_u512
图片列表(imagelist,默认 web=1 返回缩略图字段)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
imagelist \
parent_path=/Openclaw recursion=1 page=1 num=10 order=time desc=1
按上传时间拉取最近图片
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.recent_list \
category=3 limit=20 resolution=off
官方同名:创建目录
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.make_dir path=reports/2026
批量移动(默认 ondup=fail,不覆盖;dest 限制在 /Openclaw)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
movebatch \
items=[{src
path:/Openclaw/inbox/a.txt,destdir:/Openclaw/archive},{src
path:/Openclaw/inbox/b.txt,destdir:/Openclaw/archive}] \
chunk
size=100 asyncmode=1
批量复制(显式冲突策略 newcopy:冲突时自动副本,不覆盖原文件)
mcporter --config /home/ubuntu/.openclaw/workspace/config/mcporter.json call baidudisk.file
copybatch \
items=[{src_path:/