nextcloud-mcp
Summary: This server gives an agent full read/write access to one Nextcloud account's files over WebDAV, plus public share links over OCS — all using an app password stored in environment variables.
Browse —
list_directoryshows the immediate children of a folder (non-recursive),statreturns metadata for one file or folder (name, size, type, etag, file id, modified time).Read —
read_filereturns UTF-8 text, or base64 for binary; refuses binary text mode and files over the read limit.Write —
write_filecreates small inline files (UTF-8 or base64), refusing to overwrite unlessoverwrite: true;mkdircreates folders with optionalparents: true.Move / rename —
moverelocates or renames a path,overwritedefaulting to false.Delete —
deleteremoves one path, requiringconfirm: trueand, for folders,recursive: true; it refuses the files root.Transfer large files —
upload_fileanddownload_filemove bytes directly between Nextcloud and an absolutelocalPathon the MCP host (no base64), size-checked against the write ceiling.Share —
create_share_linkmakes a public OCS link (shareType 3) with optional label, password, expiry date, and permission bit mask (default read-only).Search —
searchfinds filename substrings via WebDAV SEARCH under a folder scope, returning up to 100 results; it does not search file contents.
Provides tools for interacting with a Nextcloud account, enabling file and folder management over WebDAV (list, stat, read, write, create, move, delete), filename search via WebDAV SEARCH, and creation of public share links via the OCS Share API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nextcloud-mcp search for budget.xlsx and create a public share link for it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
nextcloud-mcp
MCP server for one Nextcloud account. Agents list, read, write, upload, download, create, move, and delete files over WebDAV, create public share links over the OCS Share API, and search file names with WebDAV SEARCH. File bytes travel over WebDAV. Large files already on the MCP host use upload_file and download_file with an absolute localPath instead of base64 in the tool call. Credentials stay in environment variables. This repository does not ship secrets.
Nextcloud auth is HTTP Basic with the user id and an app password (an app token). The server does not use browser login, session cookies, or Login Flow v2/OAuth.
Protocols
Work | Protocol | Endpoint |
List, stat, read, write, upload, download, mkdir, move, delete | WebDAV |
|
Filename search | WebDAV |
|
Public share link | OCS Share API |
|
OCS is used only for share links, which WebDAV does not create. File bytes and folders never go through the browser or the OCS files API. delete requires confirm: true (and recursive: true for a folder). Paths that contain .. are rejected before any request.
CI runs mocked WebDAV and OCS responses. It does not call a live Nextcloud, so a LAN-only instance is fine.
The server speaks stdio for Cursor and Grok Bot, and optional Streamable HTTP (JSON, with SSE when a response streams) for a remote client.
Related MCP server: nextcloud-mcp-server
Tools
Tool | What it does |
| Immediate children of a folder. Not recursive. |
| Metadata for one file or folder (file info). |
| UTF-8 text, or base64 when you ask. Refuses binary text and files over the read limit. |
| WebDAV GET into an absolute |
| Small inline upload (UTF-8 or base64). Refuses to replace an existing file unless |
| Read an absolute |
| Create a folder. |
| Move or rename. |
| Delete one path. Requires |
| Public link (OCS |
| Filename substring via WebDAV SEARCH. Not full-text content search. |
Paths are relative to the signed-in user's files. "" and "/" are the files root. .., encoded .., backslashes, and URLs are rejected.
delete never removes the files root. There is no multi-path delete and no account wipe. Nextcloud's own DELETE on a folder removes that folder's contents, so a folder delete stays gated behind recursive: true.
write_file, upload_file, and mkdir accept parents: true to create missing parent folders. They do not delete anything to do it.
localPath is on the computer running this MCP process (the Cursor host, or the Grok Bot computer, for stdio). It is not a Nextcloud path. upload_file and download_file refuse a relative path, any .. segment, and a path Node cannot resolve. download_file also refuses a symlink at the destination file and leaves no partial file behind when the download is refused. A remote HTTP deployment reads and writes files on that server, not on a different laptop.
Grok Bot / Cursor plugin
This is a community MCP for Nextcloud files. It is not a first-party Nextcloud or Cursor product.
Install Nextcloud from the marketplace once this repository is listed. In Cursor that is Customize. In Grok Bot that is SearchPlugins. The plugin starts the same stdio server as the nextcloud-mcp npm bin (npx runs github:wckdboy/nextcloud-mcp). Fill the three setup variables in the plugin configuration. Do not add a second custom MCP server for the same account.
Variable | What to enter |
| Instance base URL, no trailing slash. Example: |
| Nextcloud user id. |
| App token from Settings → Security → Devices & sessions. Not the account password. |
The plugin stores only ${NEXTCLOUD_URL}, ${NEXTCLOUD_USERNAME}, and ${NEXTCLOUD_APP_PASSWORD} placeholders. Values stay in the host configuration.
Tools, once those variables are set:
list_directoryandstatto inspect a folder or one pathread_fileandwrite_filefor small inline file contentsupload_fileanddownload_filewhen the bytes are already on the MCP host (localPath)mkdirandmoveto create folders and rename or movedeletewithconfirm: true(andrecursive: truefor a folder)searchfor a filename substringcreate_share_linkfor a public OCS link
Details are in Tools. skills/nextcloud-files/SKILL.md is the same guidance for the agent. Auth is the app token already configured on the server. The server does not start Login Flow v2.
Before the listing is public, test the plugin from a clone:
git clone https://github.com/wckdboy/nextcloud-mcp.git ~/.cursor/plugins/local/nextcloud-mcpReload the window, then install Nextcloud from Customize. A symlink in ~/.cursor/plugins/local that points outside that folder is ignored, so clone or copy the repo into that directory.
After this change is on main, submit the repository at cursor.com/marketplace/publish. Cursor reviews the listing before it appears in Customize and SearchPlugins. Pinning the repo in the Grok Build catalog is a separate step.
Requirements
Node.js 20 or newer
A Nextcloud account and an app password
Install and run locally
git clone https://github.com/wckdboy/nextcloud-mcp.git
cd nextcloud-mcp
npm ci
npm run build
cp .env.example .env
# edit .env — see below
npm run mcpnpm run mcp and npm start are the stdio server (node dist/index.js). A .env file in the working directory is loaded for local runs and does not override variables that are already set. MCP hosts should pass the variables themselves.
Check the project without a Nextcloud server:
npm run typecheck
npm test
npm run buildnpm test uses mocked WebDAV and OCS responses.
Environment
Required:
Name | Example | Purpose |
|
| Base URL. A trailing slash is removed. No user, password, query, or fragment. |
|
| Nextcloud user id. |
| (app token) | App password from Settings → Security → Devices & sessions. Not the account password. |
Optional:
Name | Default | Purpose |
|
| Inline |
|
| Upload ceiling for |
|
| Per-request timeout. |
|
| Bind address for |
|
| Bind port for |
| unset | If set, HTTP requests must send |
| unset | Comma-separated |
Copy .env.example. Do not commit .env.
If any of the three required variables is missing, the process exits before it listens. The error names the missing variables and does not ask for a password.
Authentication
Every WebDAV call (/remote.php/dav/files/<user>/…) and every OCS call sends:
Authorization: Basic base64(NEXTCLOUD_USERNAME:NEXTCLOUD_APP_PASSWORD)NEXTCLOUD_APP_PASSWORD is the app token Nextcloud shows once when you create an app password. The server never reads a session cookie, never starts Login Flow v2, and never performs an OAuth login. Redirects are not followed, so a login page cannot become a session.
Do not paste the Nextcloud account password or the app token into chat. Put the app token in the MCP server environment as NEXTCLOUD_APP_PASSWORD. Agents should ask only for that secret name if it is unset.
Create a Nextcloud app password
Sign in to Nextcloud in a browser.
Open the avatar menu and choose Personal settings (or Settings).
Open Security.
Find Devices & sessions (also labeled App passwords on some versions).
Type an app name such as
MCP.Choose Create new app password.
Copy that app token into
NEXTCLOUD_APP_PASSWORD. Nextcloud shows it once. This is not your account password.Set
NEXTCLOUD_USERNAMEto the account user id (the id used to sign in, not necessarily the display name).Set
NEXTCLOUD_URLto the site origin, for examplehttps://cloud.example.com. If Nextcloud lives in a subdirectory, include it:https://cloud.example.com/nextcloud.
WebDAV is then NEXTCLOUD_URL/remote.php/dav/files/NEXTCLOUD_USERNAME/. Share links use NEXTCLOUD_URL/ocs/v2.php/apps/files_sharing/api/v1/shares. Both use the same Basic header.
Cursor
The plugin install is the path for Customize. The block below is a manual stdio server when you are not using the plugin.
Put this in the user file ~/.cursor/mcp.json, or in the project file .cursor/mcp.json if that file is gitignored. Use an absolute path. Keep the password out of the repository.
{
"mcpServers": {
"nextcloud": {
"command": "node",
"args": ["/ABSOLUTE/PATH/nextcloud-mcp/dist/index.js"],
"env": {
"NEXTCLOUD_URL": "https://cloud.example.com",
"NEXTCLOUD_USERNAME": "your-user-id",
"NEXTCLOUD_APP_PASSWORD": "your-app-password"
}
}
}
}Secret names: NEXTCLOUD_URL, NEXTCLOUD_USERNAME, NEXTCLOUD_APP_PASSWORD.
Reload MCP servers in Cursor after saving. The stdio process is how Cursor launches the server. A URL on your laptop is not required.
From a machine that can npm install this public repo, the same server can be started without a local clone:
{
"mcpServers": {
"nextcloud": {
"command": "npx",
"args": ["-y", "--package", "github:wckdboy/nextcloud-mcp", "nextcloud-mcp"],
"env": {
"NEXTCLOUD_URL": "https://cloud.example.com",
"NEXTCLOUD_USERNAME": "your-user-id",
"NEXTCLOUD_APP_PASSWORD": "your-app-password"
}
}
}
}npm runs prepare, which compiles TypeScript, then runs the nextcloud-mcp binary.
Grok Bot
SearchPlugins installs the Nextcloud plugin after it is listed. Until then, add a custom stdio server. Grok Bot runs that process on its cloud computer and cannot reach localhost on your laptop. Store the three secrets on that server entry.
In the bot chat:
Add a custom MCP server called nextcloud that runs:
npx -y --package github:wckdboy/nextcloud-mcp nextcloud-mcp
Set these environment variables on the server entry. Store the values as secrets:
NEXTCLOUD_URL
NEXTCLOUD_USERNAME
NEXTCLOUD_APP_PASSWORDCommand: npx
Args: -y, --package, github:wckdboy/nextcloud-mcp, nextcloud-mcp
Secret names: NEXTCLOUD_URL, NEXTCLOUD_USERNAME, NEXTCLOUD_APP_PASSWORD
Confirm when the bot repeats the command and the variable names. Store the app token as NEXTCLOUD_APP_PASSWORD on that server entry. Do not paste the Nextcloud account password or the app token into the chat. Attach the server with @ if the bot does not pick it up on its own. A server saved only in Cursor's mcp.json is not automatically available in Grok Bot; add it there with the message above.
If the bot's computer already has a built checkout, use command node and args /ABSOLUTE/PATH/nextcloud-mcp/dist/index.js with the same three variables.
Grok Build (terminal)
This is the grok CLI, not the Grok Bot chat UI. Either form uses the same secret names.
grok mcp add nextcloud -- \
npx -y --package github:wckdboy/nextcloud-mcp nextcloud-mcpThen set the variables in ~/.grok/config.toml so the values can come from your environment:
[mcp_servers.nextcloud]
command = "npx"
args = ["-y", "--package", "github:wckdboy/nextcloud-mcp", "nextcloud-mcp"]
enabled = true
[mcp_servers.nextcloud.env]
NEXTCLOUD_URL = "${NEXTCLOUD_URL}"
NEXTCLOUD_USERNAME = "${NEXTCLOUD_USERNAME}"
NEXTCLOUD_APP_PASSWORD = "${NEXTCLOUD_APP_PASSWORD}"grok mcp doctor nextcloud checks the process. Grok expands ${VAR} when it loads the file.
Grok on the web
Custom connectors at grok.com/connectors need a public HTTPS MCP URL. The stdio command above is the one Grok Bot should run. The HTTP mode below is loopback unless you put it behind your own TLS proxy and set MCP_HTTP_TOKEN.
Optional HTTP
npm run mcp:httpThat is node dist/index.js --http. The MCP endpoint is http://127.0.0.1:8787/mcp. GET /health returns {"ok":true,"name":"nextcloud-mcp"} and no credentials.
The transport is Streamable HTTP: a normal JSON response, or an SSE stream when the session needs one. On loopback, Host and Origin are limited to localhost. Set MCP_HTTP_TOKEN to require Authorization: Bearer <token>.
Binding a non-loopback address also requires MCP_HTTP_TOKEN and MCP_HTTP_ALLOWED_HOSTS (the hostnames clients send in Host).
Search limits
search sends a WebDAV SEARCH request (RFC 5323) to /remote.php/dav/, scoped to files/<user>/<folder> with depth infinity. The match is a substring of displayname (the file name). It does not search inside file contents. %, _, and \ in the query are removed so they are not LIKE wildcards. Results default to 25 and cannot exceed 100. If the server returns HTTP 405 or 501, that instance does not allow WebDAV SEARCH.
Development
npm run typecheck # tsc --noEmit
npm test # mocked WebDAV and OCS
npm run build # dist/
npm run check # typecheck and testCI runs typecheck, test, and build on Node 22. No live Nextcloud.
License
MIT
Available Tools
9 toolsdeleteDelete file or folderADestructive
Delete one file or one folder. Requires confirm: true. Deleting a folder also requires recursive: true because Nextcloud removes the folder's contents. Refuses the files root. There is no recursive account wipe and no multi-path delete.
Inputs: path (required), confirm (required), recursive.
list_directoryList directoryARead-onlyIdempotent
List the immediate children of a folder in the signed-in user's Nextcloud files. Not recursive. path is relative to the files root.
Inputs: path, limit.
mkdirCreate folderA
Create a folder with WebDAV MKCOL. Set parents true to create missing ancestors. Refuses when a path segment already exists as a file.
Inputs: path (required), parents.
moveMove or renameADestructive
Move or rename a file or folder with WebDAV MOVE. overwrite defaults to false. Refuses to move the files root or a folder into itself.
Inputs: to (required), from (required), overwrite.
read_fileRead fileARead-onlyIdempotent
Read a file from Nextcloud. Text is returned as UTF-8. Binary files are refused unless encoding is base64. Files larger than the server read limit are refused rather than truncated.
Inputs: path (required), encoding.
searchSearch file namesARead-onlyIdempotent
Search file and folder names with Nextcloud WebDAV SEARCH (RFC 5323) on /remote.php/dav/. This is a filename substring match inside one folder scope (default: the user's files), not full-text content search. The server must allow SEARCH. Results are capped.
Inputs: query (required), path, limit.
statGet file infoARead-onlyIdempotent
Get metadata for one file or folder (name, size, type, etag, file id, modified time) via WebDAV PROPFIND. This is the file-info tool.
Inputs: path (required).
write_fileWrite fileADestructiveIdempotent
Create or upload a file over WebDAV PUT. Refuses to overwrite an existing file unless overwrite is true. Set parents true to create missing parent folders. Does not delete anything else.
Inputs: path (required), content (required), parents, encoding, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a clearly distinct file-system operation: stat for metadata, list_directory for listing, read_file/write_file for content, mkdir for folders, move/delete for lifecycle changes, create_share_link for sharing, and search for filename lookup. The descriptions explicitly distinguish overlapping-seeming tools, such as search being filename-only and stat being the file-info tool.
Most names use recognizable verb_noun or verb forms (list_directory, read_file, write_file, create_share_link), with conventional Unix-like exceptions such as stat, mkdir, move, delete, and search. The set is readable and predictable, but not a uniform verb_noun convention throughout.
Nine tools is well-scoped for a Nextcloud file operations server, covering the essential file/folder lifecycle and sharing actions without obvious filler. Each tool appears to earn its place in the surface.
Core CRUD/lifecycle operations are covered: stat, list, read, write, mkdir, move, delete, and create_share_link. Minor gaps exist around share-link management (listing or revoking links) and possibly copy operations, but agents can work around these or use WebDAV behavior for common file workflows.
Related MCP Connectors
Read tickets, contacts, companies, agents and groups; create, update and reply to tickets.
Search tickets, read conversations and people; create and update tickets and people in Octadesk.
Hosted file storage for agents: upload, list, download, share by link, expire, scratch.
Cloud file relay: chunked uploads, folders, share links, inline text reads, ZIP packing.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with Nextcloud instances through 30 tools across Notes, Calendar, Contacts, Tables, and WebDAV file operations, featuring a powerful unified search system for finding files without exact paths.18 npm39AGPL 3.0
- AlicenseAqualityDmaintenanceEnables AI agents to perform file operations and sharing management on NextCloud servers via the Model Context Protocol.145MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to securely access and manage Nextcloud files, edit music tags, and handle archives using the user's own credentials.AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables LLM agents to read and write Nextcloud files, notes, calendars, tasks, contacts, and Talk messages through a secure authenticated MCP endpoint.MIT