Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nextcloud-mcp-server

abdullahMASHUK929MIT1.1.0TypeScript support: included

Professional NextCloud MCP server for file operations and sharing

mcp, model-context-protocol, nextcloud, webdav, file-sharing, file-management, typescript, server

readme



🌐 NextCloud MCP Server

npm version Downloads License: MIT TypeScript

A professional Model Context Protocol (MCP) server for seamless NextCloud integration

Empower your AI agents with comprehensive NextCloud file management and sharing capabilities

InstallationQuick StartFeaturesDocumentationSecurity


🚀 Features

📁 File Management 🔗 Sharing 🔒 Security 🛠️ Developer Experience
List, upload, download Public links App passwords Full TypeScript support
Create directories User/group shares Environment variables Comprehensive tests
Delete files/folders Password protection Secure authentication Professional documentation
Move and rename Expiration dates HTTPS enforcement Easy integration

✨ Key Capabilities

  • 🎯 14 Comprehensive Tools - Complete file operations and sharing management
  • 🔐 Enhanced Security - Built-in app password support and best practices
  • 🏗️ Professional Architecture - TypeScript-first with full type safety
  • 📚 Rich Documentation - Detailed guides and examples
  • 🔄 WebDAV Integration - Native NextCloud protocol support
  • High Performance - Optimized for speed and reliability
  • 🌍 Universal Compatibility - Works with any NextCloud instance

📦 Installation

# Install globally for CLI usage
npm install -g nextcloud-mcp-server

# Or install locally in your project
npm install nextcloud-mcp-server

From Source

git clone https://github.com/abdullahMASHUK/nextcloud-mcp-server.git
cd nextcloud-mcp-server
npm install
npm run build

🚀 Quick Start

<summary>Click to expand security setup instructions</summary>

For enhanced security, create a dedicated app password:

  1. Navigate to NextCloud Settings

    NextCloud → Settings → Security → App passwords
  2. Create New App Password

    • Enter name: MCP Server
    • Click "Create new app password"
    • Copy the generated password: xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
  3. Why App Passwords?

    • ✅ Limited scope and permissions
    • ✅ Can be revoked independently
    • ✅ No access to your main account
    • ✅ Auditable access logs

2. ⚙️ Configuration

# Copy the environment template
cp .env.example .env

Edit your .env file:

NEXTCLOUD_URL=https://your-nextcloud-server.com
NEXTCLOUD_USERNAME=your-username
NEXTCLOUD_PASSWORD=your-app-password-here  # Use app password!

3. 🎮 Usage with MCP Clients

<summary>Claude Desktop Configuration</summary>

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "nextcloud": {
      "command": "nextcloud-mcp-server",
      "env": {
        "NEXTCLOUD_URL": "https://your-nextcloud-server.com",
        "NEXTCLOUD_USERNAME": "your-username",
        "NEXTCLOUD_PASSWORD": "your-app-password"
      }
    }
  }
}
<summary>Direct Usage</summary>
# Run the MCP server
nextcloud-mcp-server

# Or with Node.js
node build/index.js

🛠️ Available Tools

📁 File Operations

🔍 test-connection Test connectivity to your NextCloud server
📋 list-files List files and directories with metadata
📁 create-directory Create new directories in NextCloud
🗑️ delete-file Delete files or directories
⬆️ upload-file Upload files with base64 encoding
⬇️ download-file Download files from NextCloud
🔄 move-file Move or rename files and directories
📄 copy-file Copy files and directories to new locations
🔍 search-files Search for files and directories by name or content
📚 get-file-versions Get version history of a file
🔄 restore-file-version Restore a specific version of a file

🔗 Sharing Operations

🌐 create-share Create public links, user, or group shares
📤 list-shares List and filter existing shares
🗑️ delete-share Remove shares by ID

📖 Documentation

🎯 Tool Examples

<summary>📋 List Files</summary>
{
  "name": "list-files",
  "arguments": {
    "path": "/Documents"
  }
}

Response: Returns array of files with metadata (name, size, type, modification date)

<summary>⬆️ Upload File</summary>
{
  "name": "upload-file",
  "arguments": {
    "remotePath": "/documents/report.pdf",
    "content": "JVBERi0xLjQK..."  // base64 encoded content
  }
}
<summary>🔄 Move File</summary>
{
  "name": "move-file",
  "arguments": {
    "sourcePath": "/old-location/document.pdf",
    "destinationPath": "/new-location/document.pdf",
    "overwrite": false
  }
}

Response: Confirmation message with source and destination paths

<summary>📄 Copy File</summary>
{
  "name": "copy-file",
  "arguments": {
    "sourcePath": "/Documents/template.docx",
    "destinationPath": "/Projects/new-document.docx",
    "overwrite": true
  }
}

Response: Confirmation message with copy operation details

<summary>🔍 Search Files</summary>
{
  "name": "search-files",
  "arguments": {
    "query": "quarterly report",
    "path": "/Documents",
    "limit": 20,
    "type": "file"
  }
}

Response: Array of matching files with full metadata

Type Options: file, directory, all

<summary>📚 Get File Versions</summary>
{
  "name": "get-file-versions",
  "arguments": {
    "path": "/Documents/important-document.pdf"
  }
}

Response: Array of file versions with timestamps, sizes, and user information

<summary>🔄 Restore File Version</summary>
{
  "name": "restore-file-version",
  "arguments": {
    "path": "/Documents/important-document.pdf",
    "versionId": "1672531200"
  }
}

Response: Confirmation of version restoration

<summary>🌐 Create Share</summary>
{
  "name": "create-share",
  "arguments": {
    "path": "/Documents/presentation.pptx",
    "shareType": 3,
    "password": "secure123",
    "expireDate": "2024-12-31",
    "note": "Shared for team review"
  }
}

Share Types:

  • 0 - User share
  • 1 - Group share
  • 3 - Public link
  • 4 - Email share

🏗️ Development

<summary>Setup Development Environment</summary>
# Clone and install
git clone https://github.com/abdullahMASHUK/nextcloud-mcp-server.git
cd nextcloud-mcp-server
npm install

# Development commands
npm run dev          # Run with auto-reload
npm run build        # Build TypeScript
npm run test         # Run test suite
npm run lint         # Check code quality
npm run format       # Format code

Project Structure:

src/
├── index.ts              # Main MCP server
├── services/
│   └── nextcloud.ts      # NextCloud API client
├── types.ts              # TypeScript definitions
└── utils/                # Utility functions

__tests__/                # Test suites
build/                    # Compiled output

🔒 Security

🛡️ Best Practices

Do Don't
Use app passwords Use main account password
Store in environment variables Hardcode credentials
Use HTTPS URLs Use HTTP connections
Rotate passwords regularly Keep old passwords
Monitor access logs Ignore security events

🔐 Security Features

  • 🔑 App Password Integration - Dedicated authentication tokens
  • 🌐 HTTPS Enforcement - Secure connections required
  • 📝 Environment Variables - Safe credential storage
  • 🔍 Error Handling - No credential exposure in logs
  • 🛡️ Permission Scoping - Limited access rights

⚠️ Security Checklist

  • <input disabled="" type="checkbox"> App password created and configured
  • <input disabled="" type="checkbox"> HTTPS enabled on NextCloud server
  • <input disabled="" type="checkbox"> Environment variables properly set
  • <input disabled="" type="checkbox"> .env file added to .gitignore
  • <input disabled="" type="checkbox"> Regular password rotation scheduled

License

MIT License - see LICENSE file for details.

🤝 Contributing

We Welcome Contributions!

Contributors Welcome PRs Welcome

<summary>🚀 How to Contribute</summary>
  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch
    git checkout -b feature/amazing-feature
  3. 💻 Make your changes
  4. ✅ Add tests for new features
  5. 🧪 Run the test suite
    npm run test
    npm run lint
  6. 📝 Commit your changes
    git commit -m "✨ Add amazing feature"
  7. 🚀 Push to your branch
    git push origin feature/amazing-feature
  8. 🔄 Open a Pull Request

💡 Ways to Contribute

🐛
Bug Reports

Feature Requests
📚
Documentation
🧪
Testing
Found an issue?
Report it!
Have an idea?
Share it!
Improve docs
and examples
Add tests and
improve coverage

💖 Support

Show Your Support! ⭐

If this project helped you, please consider giving it a ⭐ on GitHub!

GitHub stars GitHub forks

🗣️ Get Help

🔗 Connect With Us

GitHub npm


📜 License

MIT License © 2024 Abdullah MASHUK

License: MIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software...

📖 Read Full License


📈 Changelog

<summary>Version History</summary>

🎉 v1.0.3

  • 🎨 Beautified README with professional formatting and visual enhancements
  • 📊 Added interactive tables, badges, and collapsible sections
  • 👤 Updated author information and git configuration
  • 🔗 Enhanced navigation with emojis and better organization
  • ✨ Improved user experience for npm and GitHub viewers

🚀 v1.0.2

  • ✨ Enhanced documentation and README
  • 🔒 Added comprehensive security guidelines
  • 📝 Improved TypeScript definitions
  • 🐛 Bug fixes and stability improvements

🚀 v1.0.1

  • 📚 Updated documentation
  • 🔧 Configuration improvements
  • 🛠️ Build process optimization

🌟 v1.0.0

  • 🎊 Initial release
  • 📁 Basic file operations (list, upload, download, delete)
  • 🔗 Share management (create, list, delete)
  • 🔧 TypeScript implementation
  • ✅ Comprehensive test coverage
  • 📖 Full documentation

Made with ❤️ by Abdullah MASHUK

Building bridges between NextCloud and AI assistants 🌉

Built with TypeScript Powered by MCP

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.1.0] - 2025-09-03

Added

  • 5 new high-priority tools for enhanced NextCloud functionality:
    • move-file: Move or rename files and directories with overwrite support
    • copy-file: Copy files and directories to new locations
    • search-files: Search for files and directories by name or content with filtering
    • get-file-versions: Get version history of files with timestamps and user info
    • restore-file-version: Restore specific versions of files
  • Enhanced TypeScript types for new file operations
  • Comprehensive test coverage for all new tools (18 total tests passing)
  • Updated documentation with examples for all new tools
  • Fallback search mechanism when OCS API is unavailable

Changed

  • Updated tool count from 9 to 14 comprehensive tools
  • Enhanced README with detailed examples for new functionality
  • Improved project documentation structure

Technical

  • Added new interfaces: MoveFileOptions, CopyFileOptions, SearchOptions, FileVersion
  • WebDAV MOVE and COPY method implementations
  • NextCloud OCS API integration for search and versioning
  • Professional error handling for all new operations

[1.0.2] - 2025-09-01

Changed

  • Updated README installation section: "From NPM (when published)" → "From NPM"
  • Reflects current published status of the package

[1.0.1] - 2025-09-01

Added

  • Comprehensive security documentation for App Password usage
  • Step-by-step guide for creating and using NextCloud App Passwords
  • Security best practices section in README
  • Enhanced environment file with security comments

Security

  • IMPORTANT: Strong recommendation to use App Passwords instead of main account passwords
  • Added security considerations section with best practices
  • Environment security guidelines

[1.0.0] - 2025-09-01

Added

  • Initial release of NextCloud MCP Server
  • Complete NextCloud WebDAV API integration
  • File management operations (list, create, delete, upload, download)
  • Share management with support for public links, user shares, and group shares
  • Connection testing functionality
  • TypeScript implementation with full type safety
  • Comprehensive error handling and logging
  • Professional npm package structure
  • Jest testing framework setup
  • ESLint and Prettier configuration

Changed

  • Repository configured for personal management under abdullahMASHUK GitHub account
  • GitHub Actions CI/CD pipeline
  • Complete documentation and usage examples
  • MIT license
  • Environment variable configuration support

Features

  • Connection Testing: Verify connectivity to NextCloud instances
  • File Operations:
    • List files and directories with metadata
    • Create directories
    • Delete files and directories
    • Upload files with base64 encoding
    • Download files with base64 output
  • Share Management:
    • Create public links with optional password protection
    • Create user and group shares
    • List existing shares with filtering
    • Delete shares by ID
    • Support for expiration dates and notes
  • Security: Username/password authentication with secure HTTP client
  • Error Handling: Consistent API response format with detailed error messages
  • TypeScript: Full type definitions and IntelliSense support

Technical Details

  • Built with TypeScript and ES2022 target
  • Uses @modelcontextprotocol/sdk for MCP server implementation
  • Axios for HTTP client with proper authentication
  • xml2js for parsing WebDAV XML responses
  • form-data for multipart form uploads
  • Comprehensive Jest test suite
  • ESLint and Prettier for code quality
  • GitHub Actions for automated testing and publishing

Supported NextCloud APIs

  • WebDAV API for file operations
  • OCS Sharing API for share management
  • Status API for connection testing

Browser/Environment Support

  • Node.js 18.0.0 or higher
  • TypeScript 5.0 or higher
  • Works with any NextCloud instance with WebDAV enabled

[Unreleased]

Planned

  • Additional authentication methods (OAuth, app passwords)
  • Bulk file operations
  • Advanced sharing permissions
  • File versioning support
  • Trash/recycle bin operations
  • Activity monitoring
  • Webhook support