Skip to main content
Glama
Nextcloud MCP Server

Nextcloud MCP Server

Nextcloud MCP Server

A Model Context Protocol (MCP) server that provides Nextcloud file access to Claude Desktop via WebDAV.

Disclaimer: This project was created with assistance from Claude AI (Anthropic). While functional, use at your own discretion and review the code before deployment.

Features

  • Full WebDAV access to Nextcloud files

  • Integrates natively with Claude Desktop

  • Supports file listing, upload, download, and deletion

  • Smart directory detection for uploads

  • No external dependencies beyond Python and webdav4

Related MCP server: WebDAV MCP Server

Available Tools

Once configured, Claude Desktop will have access to these tools:

  • nextcloud_list - List files and directories

  • nextcloud_download - Download files from Nextcloud

  • nextcloud_upload - Upload files to Nextcloud (with smart directory handling)

  • nextcloud_cat - Display text file contents

  • nextcloud_mkdir - Create directories

  • nextcloud_delete - Delete files or directories

Prerequisites

  • Python 3.8 or higher

  • Claude Desktop installed

  • A Nextcloud instance with WebDAV access enabled

  • uv (recommended) or pip for Python package management

Installation

1. Clone or Download

# Clone this repository or download the files to a local directory
git clone https://github.com/runter-vom-mattenwagen/nextcloud-mcp-server.git
cd nextcloud-mcp-server

2. Configure Credentials

Edit nextcloud_client.py and update the following variables at the top of the file:

WEBDAV_URL = "https://your-nextcloud-instance.com/remote.php/dav/files/username/"
USERNAME = "your-username"
PASSWORD = "your-password"

Important: The WEBDAV_URL should end with your username followed by a trailing slash.

Example: https://cloud.example.com/remote.php/dav/files/john/

3. Configure Claude Desktop

Add the MCP server to your Claude Desktop configuration file.

Configuration file location by OS:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "nextcloud": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "webdav4",
        "/absolute/path/to/nextcloud_mcp_server.py"
      ]
    }
  }
}

Option B: Using system Python

{
  "mcpServers": {
    "nextcloud": {
      "command": "python3",
      "args": [
        "/absolute/path/to/nextcloud_mcp_server.py"
      ]
    }
  }
}

Note: If using system Python, you must install dependencies first:

pip3 install webdav4

4. Restart Claude Desktop

After configuration, restart Claude Desktop for the changes to take effect.

Usage Examples

Once configured, you can interact with your Nextcloud instance through Claude:

User: "List the files in my Nextcloud"
Claude: [uses nextcloud_list tool]

User: "Upload this document to my Nextcloud Documents folder"
Claude: [uses nextcloud_upload with remote_path="Documents/"]

User: "Show me the contents of notes.txt"
Claude: [uses nextcloud_cat]

Standalone Usage

The nextcloud_client.py script can also be used standalone from the command line:

# List files
python3 nextcloud_client.py list /

# Upload a file
python3 nextcloud_client.py upload local_file.txt remote_folder/

# Download a file
python3 nextcloud_client.py download remote_file.txt

# Create directory
python3 nextcloud_client.py mkdir new_folder

# Delete file
python3 nextcloud_client.py delete old_file.txt

# Show file contents
python3 nextcloud_client.py cat notes.txt

Troubleshooting

Connection Issues

  1. Verify your WebDAV URL is correct (should include /remote.php/dav/files/username/)

  2. Check username and password are correct

  3. Ensure WebDAV is enabled in your Nextcloud instance

  4. Test connection manually:

    curl -u "username:password" "https://your-nextcloud-instance.com/remote.php/dav/files/username/"

MCP Server Not Starting

  1. Check the Claude Desktop logs for errors

  2. Verify Python path in configuration is correct

  3. Ensure webdav4 is installed (if using system Python)

  4. Test the MCP server directly:

    echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | python3 nextcloud_mcp_server.py

Permission Denied

Ensure the scripts are executable:

chmod +x nextcloud_client.py nextcloud_mcp_server.py

Security Considerations

  • Credentials in Code: This implementation stores credentials directly in the Python file. For production use, consider using environment variables or a separate config file.

  • HTTPS Only: Always use HTTPS URLs to protect credentials in transit.

  • File Permissions: Ensure the Python files are not world-readable if they contain credentials.

Architecture

  • nextcloud_client.py - WebDAV client handling all Nextcloud operations

  • nextcloud_mcp_server.py - MCP protocol server that wraps the client for Claude Desktop

The MCP server communicates with Claude Desktop via JSON-RPC over stdin/stdout, executing the WebDAV client as needed.

Dependencies

  • Python 3.8+

  • webdav4 - WebDAV client library

License

MIT License - See LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Acknowledgments

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables Claude Desktop and other MCP clients to interact with WebDAV file systems through natural language commands for CRUD operations.
      8
      138 npm
      20
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables CRUD operations on WebDAV file systems with authentication support, allowing users to manage files and directories through natural language commands. Includes advanced features like file search, range requests, smart editing with diff preview, and directory tree visualization.
      16
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects Claude to your self-hosted or cloud-based Seafile storage for managing libraries and files through natural language. It enables users to browse directories, read file contents, and perform file operations like moving, renaming, or searching across their private infrastructure.
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude with complete file system integration including directory management, file operations, Office document creation/editing, and advanced file tree visualization.
      3
      MIT