Seafile文件操作
seafile-skill
by andrewreid
Search, download, and upload files in a single Seafile library using a repo token. Use when an agent needs library-scoped filename or path search, exact-path downloads, or uploads into a Seafile library via the repo-token API.
安装
claude skill add --url https://github.com/openclaw/skills文档
Seafile Skill
Overview
Use this skill to interact with one Seafile library through the repo-token API. It is designed for three tasks only:
- Search for files or folders by filename or path fragment inside the token's library scope
- Download a file by exact Seafile path
- Upload a local file into an existing Seafile directory
This skill does not cover full-text content search, cross-library discovery, deletes, renames, moves, or share-link management.
For endpoint details, see references/seafile-api.md. For reusable shell patterns, see references/command-patterns.md.
Prerequisites
Required:
curljq- Network access to the Seafile server
SEAFILE_BASE_URLSEAFILE_REPO_TOKENwith access to the target library
Optional with defaults:
SEAFILE_LIBRARY_ROOT, which defaults to/SEAFILE_OUTPUT_DIR, which is only needed when saving downloaded files locally
Export the required variables before running commands. The optional variables below are shown with their recommended defaults:
export SEAFILE_BASE_URL="https://seafile.example.com"
export SEAFILE_REPO_TOKEN="<repo-token>"
export SEAFILE_LIBRARY_ROOT="/" # optional
export SEAFILE_OUTPUT_DIR="$PWD/downloads" # optional, used for downloads
mkdir -p "$SEAFILE_OUTPUT_DIR"
Defaults and expectations:
SEAFILE_BASE_URLshould be the server origin without a trailing slashSEAFILE_LIBRARY_ROOTdefaults to/if you do not override itSEAFILE_OUTPUT_DIRis only needed for downloads- All Seafile paths in this skill are absolute library paths such as
/,/docs, or/docs/report.pdf
Authentication
The repo-token endpoints use the repo token in the Authorization header.
Use this default form unless your deployment documents a different token scheme:
AUTH_HEADER="Authorization: Token $SEAFILE_REPO_TOKEN"
API_BASE="${SEAFILE_BASE_URL%/}/api/v2.1/via-repo-token"
Before doing search, download, or upload, verify the token and library scope:
curl --fail --silent --show-error \
-H "$AUTH_HEADER" \
"$API_BASE/repo-info/" | jq
If this fails with 401 or 403, stop and fix the token, permissions, or server URL before continuing.
Search Workflow
Use repo-token directory listing and filter locally with jq. This is filename and path search, not full-text search.
1. List items from a starting path
START_PATH="${SEAFILE_LIBRARY_ROOT:-/}"
curl --fail --silent --show-error \
-G \
-H "$AUTH_HEADER" \
--data-urlencode "path=$START_PATH" \
--data-urlencode "recursive=1" \
"$API_BASE/dir/"
Useful query parameters:
path: directory to inspect, default/recursive=1: walk the subtree recursivelytype=f: files onlytype=d: directories only
2. Filter by filename fragment
NEEDLE="report"
START_PATH="${SEAFILE_LIBRARY_ROOT:-/}"
curl --fail --silent --show-error \
-G \
-H "$AUTH_HEADER" \
--data-urlencode "path=$START_PATH" \
--data-urlencode "recursive=1" \
"$API_BASE/dir/" |
jq -r --arg needle "$NEEDLE" '
.dirent_list[]
| select((.name // "") | ascii_downcase | contains($needle | ascii_downcase))
| [.type, .parent_dir, .name]
| @tsv
'
3. Filter by full path fragment
PATH_FRAGMENT="2026/q2"
START_PATH="${SEAFILE_LIBRARY_ROOT:-/}"
curl --fail --silent --show-error \
-G \
-H "$AUTH_HEADER" \
--data-urlencode "path=$START_PATH" \
--data-urlencode "recursive=1" \
"$API_BASE/dir/" |
jq -r --arg needle "$PATH_FRAGMENT" '
.dirent_list[]
| (.parent_dir + "/" + .name | gsub("//+"; "/")) as $full_path
| select($full_path | ascii_downcase | contains($needle | ascii_downcase))
| [$full_path, .type]
| @tsv
'
When you need exact metadata for one known file path, consult the repo-token file-info section in references/seafile-api.md and confirm the route shape against the target deployment if needed.
Download Workflow
Downloads are exact-path only.
SEAFILE_OUTPUT_DIR is optional overall and only matters if you want this skill to save the downloaded file to a local directory.
1. Request a one-time download link
REMOTE_FILE="/docs/report.pdf"
DOWNLOAD_LINK=$(curl --fail --silent --show-error \
-G \
-H "$AUTH_HEADER" \
--data-urlencode "path=$REMOTE_FILE" \
"$API_BASE/download-link/" |
jq -r '.')
2. Download the file to a local path
LOCAL_FILE="$SEAFILE_OUTPUT_DIR/$(basename "$REMOTE_FILE")"
curl --fail --silent --show-error --location \
"$DOWNLOAD_LINK" \
-o "$LOCAL_FILE"
Notes:
download-link/returns a URL string, not a JSON object- Use
--locationbecause the returned URL may redirect - Keep the remote path exact, including spaces, case, and file extension
Upload Workflow
Uploads send a local file into an existing Seafile directory.
1. Request an upload link
UPLOAD_LINK=$(curl --fail --silent --show-error \
-H "$AUTH_HEADER" \
"$API_BASE/upload-link/" |
jq -r '.')
2. Upload one local file
LOCAL_FILE="./artifact.zip"
TARGET_DIR="/incoming"
curl --fail --silent --show-error \
-F "file=@${LOCAL_FILE}" \
-F "parent_dir=${TARGET_DIR}" \
-F "replace=0" \
"${UPLOAD_LINK}?ret-json=1" |
jq
Upload behavior:
parent_dirmust be an absolute library path like/incomingreplace=1overwrites an existing file with the same namereplace=0preserves the existing file and lets Seafile rename the new upload if needed?ret-json=1returns structured JSON and should be used by default
If you need Seafile to create nested folders beneath an existing parent, add -F "relative_path=subdir1/subdir2/" to the upload request.
Error Handling
Check failures in this order:
401or403The token is missing, expired, malformed, or does not allow the requested action.404The base URL or endpoint is wrong, or the server is not exposing that API path.440or similar upload validation errors The filename is invalid for the target server.442or443The file is too large or the library is out of quota.- Directory listing or download returns no match Re-check the starting directory, exact remote path, and case sensitivity.
- Upload succeeds but lands in the wrong place
Re-check
parent_dirand anyrelative_pathvalue.
When a request is failing and the server output is unclear, remove --silent temporarily and inspect headers with curl -i.
Examples
Find files matching a name fragment
NEEDLE="invoice"
START_PATH="/finance"
curl --fail --silent --show-error \
-G \
-H "Authorization: Token $SEAFILE_REPO_TOKEN" \
--data-urlencode "path=$START_PATH" \
--data-urlencode "recursive=1" \
--data-urlencode "type=f" \
"${SEAFILE_BASE_URL%/}/api/v2.1/via-repo-token/dir/" |
jq -r --arg needle "$NEEDLE" '
.dirent_list[]
| select((.name // "") | ascii_downcase | contains($needle | ascii_downcase))
| (.parent_dir + "/" + .name | gsub("//+"; "/"))
'
Download one file by exact path
REMOTE_FILE="/finance/invoices/april-2026.pdf"
DOWNLOAD_LINK=$(curl --fail --silent --show-error \
-G \
-H "Authorization: Token $SEAFILE_REPO_TOKEN" \
--data-urlencode "path=$REMOTE_FILE" \
"${SEAFILE_BASE_URL%/}/api/v2.1/via-repo-token/download-link/" |
jq -r '.')
curl --fail --silent --show-error --location \
"$DOWNLOAD_LINK" \
-o "$SEAFILE_OUTPUT_DIR/april-2026.pdf"
Upload one local file into a target folder
TARGET_DIR="/incoming/reports"
LOCAL_FILE="./build/report.csv"
UPLOAD_LINK=$(curl --fail --silent --show-error \
-H "Authorization: Token $SEAFILE_REPO_TOKEN" \
"${SEAFILE_BASE_URL%/}/api/v2.1/via-repo-token/upload-link/" |
jq -r '.')
curl --fail --silent --show-error \
-F "file=@${LOCAL_FILE}" \
-F "parent_dir=${TARGET_DIR}" \
-F "replace=1" \
"${UPLOAD_LINK}?ret-json=1" |
jq
相关 Skills
技能工坊
by anthropics
覆盖 Skill 从创建到迭代优化全流程:起草能力、补测试提示、跑评测与基准方差分析,并持续改写内容和描述,提升效果与触发准确率。
✎ 技能工坊把技能从创建、迭代到评测串成闭环,方差分析加描述优化,特别适合把触发准确率打磨得更稳。
PPT处理
by anthropics
处理 .pptx 全流程:创建演示文稿、提取和解析幻灯片内容、批量修改现有文件,支持模板套用、合并拆分、备注评论与版式调整。
✎ 涉及PPTX的创建、解析、修改到合并拆分都能一站搞定,连备注、模板和评论也能处理,做演示文稿特别省心。
PDF处理
by anthropics
遇到 PDF 读写、文本表格提取、合并拆分、旋转加水印、表单填写或加解密时直接用它,也能提取图片、生成新 PDF,并把扫描件通过 OCR 变成可搜索文档。
✎ PDF杂活别再来回切工具了,文本表格提取、合并拆分到OCR识别一次搞定,连扫描件也能变可搜索。
相关 MCP 服务
文件系统
编辑精选by Anthropic
Filesystem 是 MCP 官方参考服务器,让 LLM 安全读写本地文件系统。
✎ 这个服务器解决了让 Claude 直接操作本地文件的痛点,比如自动整理文档或生成代码文件。适合需要自动化文件处理的开发者,但注意它只是参考实现,生产环境需自行加固安全。
by wonderwhy-er
Desktop Commander 是让 AI 直接执行终端命令、管理文件和进程的 MCP 服务器。
✎ 这工具解决了 AI 无法直接操作本地环境的痛点,适合需要自动化脚本调试或文件批量处理的开发者。它能让你用自然语言指挥终端,但权限控制需谨慎,毕竟让 AI 执行 rm -rf 可不是闹着玩的。
EdgarTools
编辑精选by dgunning
EdgarTools 是无需 API 密钥即可解析 SEC EDGAR 财报的开源 Python 库。
✎ 这个工具解决了金融数据获取的痛点——直接让 AI 读取结构化财报,比如让 Claude 分析苹果的 10-K 文件。适合量化分析师或金融开发者快速构建数据管道。但注意,它依赖 SEC 网站稳定性,高峰期可能延迟。