nextcloud-mcp-server
Enables AI agents to perform file operations and sharing management on NextCloud servers via the Model Context Protocol.
README
<div align="center">
๐ NextCloud MCP Server
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
</div>
๐ Features
<div align="center">
| ๐ 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 |
</div>
โจ 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)
<details> <summary>Click to expand security setup instructions</summary>
For enhanced security, create a dedicated app password:
-
Navigate to NextCloud Settings
NextCloud โ Settings โ Security โ App passwords -
Create New App Password
- Enter name:
MCP Server - Click "Create new app password"
- Copy the generated password:
xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
- Enter name:
-
Why App Passwords?
- โ Limited scope and permissions
- โ Can be revoked independently
- โ No access to your main account
- โ Auditable access logs
</details>
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
<details> <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"
}
}
}
}
</details>
<details> <summary>Direct Usage</summary>
# Run the MCP server
nextcloud-mcp-server
# Or with Node.js
node build/index.js
</details>
๐ ๏ธ Available Tools
๐ File Operations
<table> <tr> <td><strong>๐ test-connection</strong></td> <td>Test connectivity to your NextCloud server</td> </tr> <tr> <td><strong>๐ list-files</strong></td> <td>List files and directories with metadata</td> </tr> <tr> <td><strong>๐ create-directory</strong></td> <td>Create new directories in NextCloud</td> </tr> <tr> <td><strong>๐๏ธ delete-file</strong></td> <td>Delete files or directories</td> </tr> <tr> <td><strong>โฌ๏ธ upload-file</strong></td> <td>Upload files with base64 encoding</td> </tr> <tr> <td><strong>โฌ๏ธ download-file</strong></td> <td>Download files from NextCloud</td> </tr> <tr> <td><strong>๐ move-file</strong></td> <td>Move or rename files and directories</td> </tr> <tr> <td><strong>๐ copy-file</strong></td> <td>Copy files and directories to new locations</td> </tr> <tr> <td><strong>๐ search-files</strong></td> <td>Search for files and directories by name or content</td> </tr> <tr> <td><strong>๐ get-file-versions</strong></td> <td>Get version history of a file</td> </tr> <tr> <td><strong>๐ restore-file-version</strong></td> <td>Restore a specific version of a file</td> </tr> </table>
๐ Sharing Operations
<table> <tr> <td><strong>๐ create-share</strong></td> <td>Create public links, user, or group shares</td> </tr> <tr> <td><strong>๐ค list-shares</strong></td> <td>List and filter existing shares</td> </tr> <tr> <td><strong>๐๏ธ delete-share</strong></td> <td>Remove shares by ID</td> </tr> </table>
๐ Documentation
๐ฏ Tool Examples
<details> <summary><strong>๐ List Files</strong></summary>
{
"name": "list-files",
"arguments": {
"path": "/Documents"
}
}
Response: Returns array of files with metadata (name, size, type, modification date)
</details>
<details> <summary><strong>โฌ๏ธ Upload File</strong></summary>
{
"name": "upload-file",
"arguments": {
"remotePath": "/documents/report.pdf",
"content": "JVBERi0xLjQK..." // base64 encoded content
}
}
</details>
<details> <summary><strong>๐ Move File</strong></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
</details>
<details> <summary><strong>๐ Copy File</strong></summary>
{
"name": "copy-file",
"arguments": {
"sourcePath": "/Documents/template.docx",
"destinationPath": "/Projects/new-document.docx",
"overwrite": true
}
}
Response: Confirmation message with copy operation details
</details>
<details> <summary><strong>๐ Search Files</strong></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
</details>
<details> <summary><strong>๐ Get File Versions</strong></summary>
{
"name": "get-file-versions",
"arguments": {
"path": "/Documents/important-document.pdf"
}
}
Response: Array of file versions with timestamps, sizes, and user information
</details>
<details> <summary><strong>๐ Restore File Version</strong></summary>
{
"name": "restore-file-version",
"arguments": {
"path": "/Documents/important-document.pdf",
"versionId": "1672531200"
}
}
Response: Confirmation of version restoration
</details>
<details> <summary><strong>๐ Create Share</strong></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 share1- Group share3- Public link4- Email share
</details>
๐๏ธ Development
<details> <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
</details>
๐ Security
๐ก๏ธ Best Practices
<div align="center">
| โ 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 |
</div>
๐ 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
- [ ]
.envfile added to.gitignore - [ ] Regular password rotation scheduled
License
MIT License - see LICENSE file for details.
๐ค Contributing
<div align="center">
We Welcome Contributions!
</div>
<details> <summary>๐ <strong>How to Contribute</strong></summary>
- ๐ด Fork the repository
- ๐ฟ Create your feature branch
git checkout -b feature/amazing-feature - ๐ป Make your changes
- โ Add tests for new features
- ๐งช Run the test suite
npm run test npm run lint - ๐ Commit your changes
git commit -m "โจ Add amazing feature" - ๐ Push to your branch
git push origin feature/amazing-feature - ๐ Open a Pull Request
</details>
๐ก Ways to Contribute
<table> <tr> <td align="center">๐<br><strong>Bug Reports</strong></td> <td align="center">โจ<br><strong>Feature Requests</strong></td> <td align="center">๐<br><strong>Documentation</strong></td> <td align="center">๐งช<br><strong>Testing</strong></td> </tr> <tr> <td align="center">Found an issue?<br>Report it!</td> <td align="center">Have an idea?<br>Share it!</td> <td align="center">Improve docs<br>and examples</td> <td align="center">Add tests and<br>improve coverage</td> </tr> </table>
๐ Support
<div align="center">
Show Your Support! โญ
If this project helped you, please consider giving it a โญ on GitHub!
๐ฃ๏ธ Get Help
- ๐ Documentation
- ๐ Report Issues
- ๐ฌ Discussions
- ๐ง Contact Maintainer
๐ Connect With Us
</div>
๐ License
<div align="center">
MIT License ยฉ 2024 Abdullah MASHUK
Permission is hereby granted, free of charge, to any person obtaining a copy of this software...
</div>
๐ Changelog
<details> <summary><strong>Version History</strong></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
</details>
<div align="center">
Made with โค๏ธ by Abdullah MASHUK
Building bridges between NextCloud and AI assistants ๐
</div>
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.