Nextcloud:文件管理与 WebDAV 自动化 - Openclaw Skills
作者:互联网
2026-03-30
什么是 Nextcloud?
Openclaw Skills 的 Nextcloud 技能提供了一个与自托管云存储交互的强大接口。它利用 WebDAV 进行创建、读取和移动文档等核心文件操作,同时利用 OCS API 管理系统标签、收藏夹和存储配额。该技能的设计注重简单性和安全性,使用 Python 标准库以避免外部依赖,使其成为任何代理工作流的轻量级补充。
此工具允许开发人员扩展其 AI 代理的能力,为他们提供云中的持久文件系统。通过与 Openclaw Skills 集成,用户可以自动组织文档,将活动直接记录到其私有服务器,并在其本地代理和远程数据存储之间维护安全的桥梁。
下载入口:https://github.com/openclaw/skills/tree/main/skills/romain-grosos/nextcloud-files
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install nextcloud-files
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 nextcloud-files。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Nextcloud 应用场景
- 在 Nextcloud 实例中上传文档、读取文件内容和移动文件。
- 为自动化项目组织创建和管理目录结构。
- 搜索特定文件或列出文件夹内容以检索代理的上下文。
- 监控存储配额以确保云资源得到有效管理。
- 为文件添加标签以实现更好的分类,或将关键文档标记为收藏。
- 该技能使用通过环境变量或机密文件提供的应用程序特定密码和 URL 向 Nextcloud 实例进行身份验证。
- 触发命令时,该技能使用标准的 urllib 库向服务器发送 WebDAV 或 OCS 请求。
- 该技能评估本地配置设置(如 base_path 和写入权限),以确保操作保持在定义的安全边界内。
- 服务器响应被解析并转换为结构化数据,供代理理解或向用户显示。
- 贴标签等高级操作使用 OCS API 与文件 ID 和基础文件系统属性之外的元数据进行交互。
Nextcloud 配置指南
要在 Openclaw Skills 生态系统中使用此技能,请遵循交互式设置过程:
python3 scripts/setup.py
python3 scripts/init.py
或者,您可以手动在 ~/.openclaw/secrets/nextcloud_creds 中配置您的凭据,格式如下:
NC_URL=https://cloud.example.com
NC_USER=username
NC_APP_KEY=app-password
请确保在 Nextcloud 设置的“安全”选项卡下生成应用程序密码。
Nextcloud 数据架构与分类体系
该技能通过两个主要的本地文件管理其操作数据和安全设置:
| 路径 | 用途 |
|---|---|
~/.openclaw/secrets/nextcloud_creds |
存储敏感的访问凭据(URL、用户、应用程序密钥),权限为 chmod 600。 |
~/.openclaw/config/nextcloud/config.json |
存储行为标志,如沙箱化的 base_path、allow_write 和 allow_delete。 |
config.json 文件允许用户将代理限制在特定的子目录中,确保其仅与授权数据进行交互。
name: nextcloud
description: "Nextcloud file and folder management via WebDAV + OCS API. Use when: (1) creating, reading, writing, renaming, moving, copying, or deleting files/folders, (2) listing or searching directory contents, (3) toggling favorites or managing system tags, (4) checking storage quota. NOT for: Nextcloud Talk, Calendar/Contacts (use CalDAV), app management (requires admin), large binary transfers, or creating share links (share capability not included by default - see README)."
homepage: https://github.com/rwx-g/openclaw-skill-nextcloud
compatibility: Python 3.9+ · no external dependencies · network access to Nextcloud instance
metadata:
{
"openclaw": {
"emoji": "??",
"requires": { "env": ["NC_URL", "NC_USER", "NC_APP_KEY"] },
"primaryEnv": "NC_APP_KEY"
}
}
ontology:
reads: [files, folders, user, quota, capabilities]
writes: [files, folders, tags, favorites]
Nextcloud Skill
Full Nextcloud client: WebDAV (files/folders) + OCS (tags, user info). Zero external dependencies - stdlib only (urllib). Credentials: ~/.openclaw/secrets/nextcloud_creds · Config: ~/.openclaw/config/nextcloud/config.json
Trigger phrases
Load this skill immediately when the user says anything like:
- "upload / save / write this file on Nextcloud / NC / cloud"
- "create a folder on Nextcloud", "mkdir in NC"
- "list / browse / show what's in [folder] on Nextcloud"
- "search for [file] in NC", "find [file] on Nextcloud"
- "read / get / download [file] from Nextcloud"
- "rename / move / copy [file] on Nextcloud"
- "check my storage quota", "how much space on NC"
- "tag this file", "mark as favorite on Nextcloud"
Quick Start
python3 scripts/nextcloud.py config # verify credentials + active config
python3 scripts/nextcloud.py quota # test connection + show storage
python3 scripts/nextcloud.py ls / # list root directory
Setup
python3 scripts/setup.py # interactive: credentials + permissions + connection test
python3 scripts/init.py # validate all configured permissions against live instance
init.py only runs write/delete tests when both
allow_write=trueandallow_delete=true. Whenallow_delete=false, write tests are skipped - no test artifacts are created or left behind.
Manual - ~/.openclaw/secrets/nextcloud_creds (chmod 600):
NC_URL=https://cloud.example.com
NC_USER=username
NC_APP_KEY=app-password
App password: Nextcloud → Settings → Security → App passwords.
config.json - behavior restrictions:
| Key | Default | Effect |
|---|---|---|
base_path |
"/" |
Restrict agent to subtree (e.g. "/Jarvis") |
allow_write |
false |
mkdir, write, rename, copy (enable explicitly) |
allow_delete |
false |
delete files and folders (enable explicitly) |
readonly_mode |
false |
override: block all writes regardless of above |
Safe defaults: both
allow_writeandallow_deletearefalseby default. Enable each explicitly only when needed. Combine with a restrictedbase_path(e.g."/Jarvis") to limit the agent's scope. Share capability is not included by default. See README for instructions on how to restore it if needed.
Storage & credentials
The skill reads and writes the following paths. All usage is intentional and documented:
| Path | Written by | Purpose |
|---|---|---|
~/.openclaw/secrets/nextcloud_creds |
setup.py |
Nextcloud credentials (NC_URL, NC_USER, NC_APP_KEY). chmod 600. Never committed. |
~/.openclaw/config/nextcloud/config.json |
setup.py |
Behavior restrictions (base_path, allow_write, allow_delete, readonly_mode). No secrets. Not in skill dir - survives clawhub updates. |
Credentials can also be provided via environment variables (NC_URL, NC_USER, NC_APP_KEY) instead of the creds file. The skill checks env vars first.
Cleanup on uninstall: clawhub uninstall nextcloud-files removes the skill directory. To also remove credentials and config:
python3 scripts/setup.py --cleanup
On reinstall, any existing config at ~/.openclaw/config/nextcloud/config.json is picked up automatically.
Module usage
from scripts.nextcloud import NextcloudClient
nc = NextcloudClient()
nc.write_file("/Jarvis/notes.md", "# Notes
...")
nc.mkdir("/Jarvis/Articles")
items = nc.list_dir("/Jarvis")
CLI reference
# Files & folders
python3 scripts/nextcloud.py mkdir /path/folder
python3 scripts/nextcloud.py write /path/file.md --content "# Title"
python3 scripts/nextcloud.py write /path/file.md --file local.md
python3 scripts/nextcloud.py write /path/file.md --content "new entry" --append
python3 scripts/nextcloud.py read /path/file.md
python3 scripts/nextcloud.py rename /old /new
python3 scripts/nextcloud.py copy /src /dst
python3 scripts/nextcloud.py delete /path
python3 scripts/nextcloud.py exists /path # exit 0/1
# Listing & search
python3 scripts/nextcloud.py ls /path --depth 2 --json
python3 scripts/nextcloud.py search "keyword" --path /folder --limit 20
# Favorites & tags
python3 scripts/nextcloud.py favorite /path/file.md
python3 scripts/nextcloud.py tags
python3 scripts/nextcloud.py tag-create "research"
python3 scripts/nextcloud.py tag-assign
# Account
python3 scripts/nextcloud.py quota
python3 scripts/nextcloud.py config
Templates
Structured workspace setup
python3 scripts/nc_setup.py --root Jarvis --folders Articles,LinkedIn,Recherche,Veille
Append to a running log
nc.append_to_file("/Jarvis/log.md", f"
## {today}
{entry}
")
Read and update a JSON list
items = nc.read_json("/Jarvis/Veille/articles.json")
items["articles"].append(new_article)
nc.write_json("/Jarvis/Veille/articles.json", items)
Tag a file after creation
ls = nc.list_dir("/Jarvis/Articles", depth=1)
file_id = next(f["file_id"] for f in ls if f["name"] == "article.md")
tags = nc.get_tags()
tag_id = next(t["id"] for t in tags if t["name"] == "published")
nc.assign_tag(file_id, tag_id)
Ideas
- Sandbox the agent with
base_path: "/Jarvis"- it can't touch anything else - Store agent-produced Markdown files and auto-share a read-only link in the reply
- Use
append_to_filefor rolling logs or changelogs - Use
write_json+read_jsonfor persistent state between sessions - Auto-tag files by category (research / draft / published)
Combine with
| Skill | Workflow |
|---|---|
| ghost | Write a post → save Markdown draft to NC → publish to Ghost |
| summarize | Summarize a URL → save summary as .md to NC |
| gmail | Receive an attachment → save to NC for archiving |
| obsidian | Sync Obsidian vault notes to NC for remote backup |
| self-improving-agent | Log agent learnings to NC for persistent, searchable history |
API reference
See references/api.md for WebDAV/OCS endpoint details, PROPFIND properties, and error codes.
Troubleshooting
See references/troubleshooting.md for common errors and fixes.
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
