nextcloud-mcp-server

abdullahMASHUK/nextcloud-mcp-server

3.3

If you are the rightful owner of nextcloud-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The NextCloud MCP Server is a professional Model Context Protocol server designed for seamless integration with NextCloud, providing AI agents with comprehensive file management and sharing capabilities.

Tools
9
Resources
0
Prompts
0

๐ŸŒ 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

Installation โ€ข Quick Start โ€ข Features โ€ข Documentation โ€ข Security


๐Ÿš€ Features

๐Ÿ“ File Management๐Ÿ”— Sharing๐Ÿ”’ Security๐Ÿ› ๏ธ Developer Experience
List, upload, downloadPublic linksApp passwordsFull TypeScript support
Create directoriesUser/group sharesEnvironment variablesComprehensive tests
Delete files/foldersPassword protectionSecure authenticationProfessional documentation
Move and renameExpiration datesHTTPS enforcementEasy 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

From NPM (Recommended)

# 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

1. ๐Ÿ” Setup App Password (Recommended)

Click to expand security setup instructions

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

Claude Desktop Configuration

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"
      }
    }
  }
}
Direct Usage
# Run the MCP server
nextcloud-mcp-server

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

๐Ÿ› ๏ธ Available Tools

๐Ÿ“ File Operations

๐Ÿ” test-connectionTest connectivity to your NextCloud server
๐Ÿ“‹ list-filesList files and directories with metadata
๐Ÿ“ create-directoryCreate new directories in NextCloud
๐Ÿ—‘๏ธ delete-fileDelete files or directories
โฌ†๏ธ upload-fileUpload files with base64 encoding
โฌ‡๏ธ download-fileDownload files from NextCloud
๐Ÿ”„ move-fileMove or rename files and directories
๐Ÿ“„ copy-fileCopy files and directories to new locations
๐Ÿ” search-filesSearch for files and directories by name or content
๐Ÿ“š get-file-versionsGet version history of a file
๐Ÿ”„ restore-file-versionRestore a specific version of a file

๐Ÿ”— Sharing Operations

๐ŸŒ create-shareCreate public links, user, or group shares
๐Ÿ“ค list-sharesList and filter existing shares
๐Ÿ—‘๏ธ delete-shareRemove shares by ID

๐Ÿ“– Documentation

๐ŸŽฏ Tool Examples

๐Ÿ“‹ List Files
{
  "name": "list-files",
  "arguments": {
    "path": "/Documents"
  }
}

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

โฌ†๏ธ Upload File
{
  "name": "upload-file",
  "arguments": {
    "remotePath": "/documents/report.pdf",
    "content": "JVBERi0xLjQK..."  // base64 encoded content
  }
}
๐Ÿ”„ Move File
{
  "name": "move-file",
  "arguments": {
    "sourcePath": "/old-location/document.pdf",
    "destinationPath": "/new-location/document.pdf",
    "overwrite": false
  }
}

Response: Confirmation message with source and destination paths

๐Ÿ“„ Copy File
{
  "name": "copy-file",
  "arguments": {
    "sourcePath": "/Documents/template.docx",
    "destinationPath": "/Projects/new-document.docx",
    "overwrite": true
  }
}

Response: Confirmation message with copy operation details

๐Ÿ” Search Files
{
  "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

๐Ÿ“š Get File Versions
{
  "name": "get-file-versions",
  "arguments": {
    "path": "/Documents/important-document.pdf"
  }
}

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

๐Ÿ”„ Restore File Version
{
  "name": "restore-file-version",
  "arguments": {
    "path": "/Documents/important-document.pdf",
    "versionId": "1672531200"
  }
}

Response: Confirmation of version restoration

๐ŸŒ Create Share
{
  "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

Setup Development Environment
# 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 passwordsUse main account password
Store in environment variablesHardcode credentials
Use HTTPS URLsUse HTTP connections
Rotate passwords regularlyKeep old passwords
Monitor access logsIgnore 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

  • App password created and configured
  • HTTPS enabled on NextCloud server
  • Environment variables properly set
  • .env file added to .gitignore
  • Regular password rotation scheduled

License

MIT License - see LICENSE file for details.

๐Ÿค Contributing

We Welcome Contributions!

Contributors Welcome PRs Welcome

๐Ÿš€ How to Contribute
  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...


๐Ÿ“ˆ Changelog

Version History

๐ŸŽ‰ 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