Step 10: Code review, testing & documentation

Code Review (REVIEW.md):
- Fixed parseSearchResponse skipping first result (critical bug)
- Fixed trashbin/versions/chunked paths missing /remote.php/dav prefix
- Fixed trash_restore to use original file location instead of /restore endpoint
- Fixed createTask/updateTask missing iCal text escaping
- Added 409 handling for createFolder (parent missing)
- Extracted duplicate decodeXmlText to utils.ts
- Extracted duplicate generateUID to utils.ts (shared with calendar/tasks)
- Removed 5 dead code functions (parseVEVENT, extractVEventBlocks, unfoldICalLines, getCalDAVXmlHeaders, local decodeXmlText)
- Cleaned unused imports across all tool files

Testing (RESULTS.md):
- 35 tests passed, 1 skipped (trash_empty), 1 server limitation (bulk_upload)
- Tested all 21+ file tools, edge cases (spaces, unicode, overwrite, empty folders)
- Verified chunked upload end-to-end

Documentation (README.md):
- Complete tool reference (21 file + 10 other tools)
- Quick start, CLI usage, size limits, troubleshooting
- Architecture overview
This commit is contained in:
2026-05-11 18:05:37 +02:00
parent 2cb1666441
commit 8461970523
9 changed files with 482 additions and 371 deletions
+106
View File
@@ -0,0 +1,106 @@
# Test Results — nextcloud-mcp
Date: 2026-05-11
## Test Environment
- Server: cloud.beatrice.wtf
- User: astro_bea
- Test folder: `/__ncmcp_test__/` (created and cleaned up)
## Tool Tests
### Browsing & Discovery (5 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 1 | `list_files` | Root `/` | ✅ | Returns array of files/folders |
| 2 | `list_files` | Empty folder | ✅ | Returns `[]` |
| 3 | `list_files` | Non-existent folder | ✅ | Returns 404 error |
| 4 | `list_files` | `depth=infinity` | ✅ | Recursive listing works |
| 5 | `get_file_info` | Existing file | ✅ | Returns extended metadata (owner, hasPreview) |
| 6 | `get_file_info` | Non-existent file | ✅ | Returns 404 error |
| 7 | `search_files` | By name | ✅ | Found "hello.txt" in test folder |
| 8 | `search_files` | By mimeType | ✅ | Found text/plain files |
| 9 | `search_files` | No results | ✅ | Returns `[]` |
| 10 | `list_favorites` | After set_favorite | ✅ | Shows favorited files |
| 11 | `get_quota` | Standard | ✅ | Returns used/available |
### Read & Download (3 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 12 | `read_file` | UTF-8 text | ✅ | Returns content with encoding=utf8 |
| 13 | `read_file` | Binary (base64) | ✅ | Auto-detects binary, returns base64 |
| 14 | `download_file` | With metadata | ✅ | Returns downloadUrl + metadata |
| 15 | `download_file` | Without metadata | ✅ | Returns downloadUrl only |
| 16 | `download_folder` | ZIP format | ✅ | Returns base64-encoded ZIP |
### Write & Upload (3 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 17 | `upload_file` | UTF-8 content | ✅ | Creates file, returns metadata |
| 18 | `upload_file` | Base64 binary | ✅ | Decodes base64, uploads correctly |
| 19 | `upload_file` | Overwrite | ✅ | Overwrites existing file |
| 20 | `create_folder` | New folder | ✅ | Creates folder, returns metadata |
| 21 | `create_folder` | Already exists | ✅ | Returns "Folder already exists" error |
| 22 | `create_folder` | Parent missing (409) | ✅ | Returns clear error message |
| 23 | `bulk_upload` | Multiple files | ⚠️ | Server returns 400 — endpoint may not be supported on this Nextcloud version |
### Chunked Upload (3 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 24 | `chunked_upload_start` | Start session | ✅ | Returns uploadId, totalChunks |
| 25 | `chunked_upload_chunk` | Upload chunk | ✅ | Returns success, uploadedSize |
| 26 | `chunked_upload_finish` | Assemble file | ✅ | Returns file metadata, content verified |
### Move, Copy, Delete (3 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 27 | `move_file` | Move to subfolder | ✅ | File moved, metadata returned |
| 28 | `copy_file` | Copy file | ✅ | New file created with new fileId |
| 29 | `move_file` | Destination exists (no overwrite) | ✅ | Returns "Destination already exists" error |
| 30 | `move_file` | Overwrite=true | ✅ | Overwrites destination |
| 31 | `delete_file` | Delete file | ✅ | Returns success, file goes to trash |
### Trashbin (4 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 32 | `trash_list` | List trash | ✅ | Returns TrashedFile[] with originalName, originalLocation, deletionTime |
| 33 | `trash_restore` | Restore item | ✅ | Restores to original location |
| 34 | `trash_delete` | Permanent delete | ✅ | Item removed from trash |
| 35 | `trash_empty` | NOT TESTED | ⏭️ | Skipped — would empty entire trashbin |
### Favorites & Versions (3 tools)
| # | Tool | Test | Result | Notes |
|---|------|------|--------|-------|
| 36 | `set_favorite` | Add favorite | ✅ | favorite=true in metadata |
| 37 | `set_favorite` | Remove favorite | ✅ | favorite=false in metadata |
| 38 | `get_file_versions` | List versions | ✅ | Returns version list |
### Edge Cases
| # | Test | Result | Notes |
|---|------|--------|-------|
| 39 | Path with spaces | ✅ | `folder with spaces/file with spaces.txt` works |
| 40 | Special characters (éàü) | ✅ | `file_éàü.txt` works |
| 41 | Empty folder listing | ✅ | Returns `[]` |
| 42 | File overwrite | ✅ | PUT overwrites silently |
| 43 | Depth=0 (single item) | ✅ | Returns single-item array |
## Summary
- **35 tests passed** ✅
- **1 test skipped** (trash_empty — destructive)
- **1 test failed** (bulk_upload — server-side limitation)
- **3 bugs found and fixed during testing** (search parsing, trashbin paths, trash restore)
## Notes
- Chunked upload requires all steps in the same process (in-memory session map). The CLI wrapper spawns a new process per call, so chunked upload must be tested via programmatic API or within a single MCP session.
- `bulk_upload` depends on Nextcloud's `/remote.php/dav/bulk` endpoint which may not be available on all server versions.
- The `search_files` PROPFIND fallback with `depth: infinity` on large directories (e.g., root `/`) may be slow. The WebDAV SEARCH endpoint (when available) is much faster.