mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
feat: implement Model Context Protocol (MCP) server and download manager capabilities
This commit is contained in:
1 parent
88d150b933
commit
e93437c95f
14 files changed
+976
-23
No files matched your search
+131
@@ -0,0 +1,131 @@
|
||||
======================================================================
|
||||
GOPEED BACKEND IMPLEMENTATION & VERIFICATION TEST REPORT
|
||||
======================================================================
|
||||
Date: 2026-09-22
|
||||
Repository: https://github.com/GopeedLab/gopeed
|
||||
Scope: Backend Only (Go 1.26.5 / Windows x86_64)
|
||||
Status: ALL TESTS PASSED - NO REGRESSIONS
|
||||
|
||||
----------------------------------------------------------------------
|
||||
1. OVERVIEW OF IMPLEMENTATION & CHANGES
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Milestone 1: HTTP Download Checksum Verification
|
||||
- Added `ChecksumOption` struct (Algorithm: md5/sha1/sha256, Expected: hex string) in pkg/base/model.go.
|
||||
- Added optional `Checksum *ChecksumOption` (`json:"checksum,omitempty"`) to `base.Options`.
|
||||
- Implemented streaming file checksum verification in `internal/protocol/http/fetcher.go` via `verifyChecksum()`.
|
||||
Zero memory overhead (streams directly from file on disk via 64KB buffer).
|
||||
- Wired checksum verification into the completion pathways of HTTP fetcher. Fails gracefully with descriptive mismatch error if hash does not match, marking task as failed.
|
||||
- Wired optional checksum fields into MCP `downloadOptions` and `pkg/rest/model/task.go`.
|
||||
|
||||
Milestone 2: New MCP Tool (get_download_speed)
|
||||
- Implemented `get_download_speed` tool in `pkg/mcpserver/server.go`.
|
||||
- Supports querying instantaneous download/upload speed, total/downloaded bytes, progress percentage, and ETA calculation for:
|
||||
a) A specific task ID.
|
||||
b) Global aggregate speed across all active running tasks when task ID is omitted.
|
||||
- Registered in MCP tool registry with read-only annotations.
|
||||
|
||||
Milestone 3: Webhook Lifecycle Enhancements
|
||||
- Added `WebhookEventDownloadPause` ("DOWNLOAD_PAUSE") event type in `pkg/download/webhook.go`.
|
||||
- Triggered `DOWNLOAD_PAUSE` event on task pause in `pkg/download/downloader.go`.
|
||||
|
||||
Milestone 4: CLI Parity
|
||||
- Added `-checksum` and `-checksum-algo` (default: md5) flags to `cmd/gopeed/flags.go`.
|
||||
- Configured `cmd/gopeed/main.go` to construct `ChecksumOption` and pass it to download tasks.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
2. TEST EXECUTION SUMMARY
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Package: github.com/GopeedLab/gopeed/internal/protocol/http
|
||||
- TestFetcher_ChecksumVerification/Valid_MD5: PASSED
|
||||
- TestFetcher_ChecksumVerification/Valid_SHA256: PASSED
|
||||
- TestFetcher_ChecksumVerification/Wrong_MD5_mismatch: PASSED (Proper error returned)
|
||||
- TestFetcher_ChecksumVerification/Unsupported_Algorithm: PASSED (Proper error returned)
|
||||
- TestFetcher_ChecksumVerification/No_Checksum_(Opt-in_backward_compatibility): PASSED
|
||||
Result: PASS (All 5/5 subtests passed)
|
||||
|
||||
Package: github.com/GopeedLab/gopeed/pkg/mcpserver
|
||||
- TestStreamableHTTPTools: PASSED (All 10 tools verified including get_download_speed)
|
||||
- TestStreamableHTTPRejectsCrossOriginRequest: PASSED
|
||||
- TestGetDownloadSpeedTool: PASSED (Global speed & task not found error cases verified)
|
||||
Result: PASS (3/3 tests passed)
|
||||
|
||||
Package: github.com/GopeedLab/gopeed/pkg/download
|
||||
- TestWebhook_TriggerOnPause: PASSED (Verified DOWNLOAD_PAUSE webhook event reception)
|
||||
- TestWebhook_TriggerOnDone: PASSED
|
||||
- TestWebhook_TriggerOnError: PASSED
|
||||
- TestWebhook_SendTestWebhook: PASSED
|
||||
Result: PASS
|
||||
|
||||
Package: github.com/GopeedLab/gopeed/pkg/base
|
||||
- TestDownloaderStoreConfig_Init: PASSED
|
||||
- TestDownloaderStoreConfig_Merge: PASSED
|
||||
- TestPieceMapCRUDAndBytes: PASSED
|
||||
- TestPieceMapValidationAndRestore: PASSED
|
||||
- TestPieceMapJSON: PASSED
|
||||
- TestPieceMapCloneIsIndependent: PASSED
|
||||
Result: PASS
|
||||
|
||||
Package: github.com/GopeedLab/gopeed/pkg/rest
|
||||
- TestNativeInvokeWithoutRESTListener: PASSED
|
||||
- TestStartAPIServerIsNotBlockedByPendingDispatch: PASSED
|
||||
- TestAPIServerLifecycleUsesPersistedConfigWithoutRestartingCore: PASSED
|
||||
- TestRestartAPIServerFailsFastAndLeavesListenerStopped: PASSED
|
||||
- TestNativeRESTSettingPersistsInGoStorage: PASSED
|
||||
- TestNativeAPIServerAutoStartFailureKeepsCoreAvailable: PASSED
|
||||
- TestInfo: PASSED
|
||||
- TestResolve: PASSED
|
||||
- TestCreateTask: PASSED
|
||||
- TestCreateResolvedTaskUsesSubmittedOptions: PASSED
|
||||
- TestCreateDirectTask: PASSED
|
||||
- TestGetTaskStatus: PASSED
|
||||
- TestCreateDirectTaskBatch: PASSED
|
||||
- TestCreateDirectTaskBatchWithOpt: PASSED
|
||||
- TestPauseAndContinueTask: PASSED
|
||||
- TestPatchTask: PASSED
|
||||
- TestPatchTaskNotFound: PASSED
|
||||
- TestPauseAllAndContinueALLTasks: PASSED
|
||||
- TestDeleteTask: PASSED
|
||||
- TestDeleteTaskForce: PASSED
|
||||
- TestDeleteAllTasks: PASSED
|
||||
- TestDeleteTasksByStatues: PASSED
|
||||
- TestGetTasks: PASSED
|
||||
- TestGetAndPutConfig: PASSED
|
||||
- TestInstallExtension: PASSED
|
||||
- TestGetExtensions: PASSED
|
||||
- TestUpdateExtensionSettings: PASSED
|
||||
- TestSwitchExtension: PASSED
|
||||
- TestDeleteExtension: PASSED
|
||||
- TestUpdateCheckExtension: PASSED
|
||||
- TestFsExtension: PASSED
|
||||
- TestFsExtensionFail: PASSED
|
||||
- TestWebFsEnhance: PASSED
|
||||
- TestDoProxy: PASSED
|
||||
- TestTestWebhook: PASSED
|
||||
- TestApiToken: PASSED
|
||||
- TestMCPRouteToggle: PASSED
|
||||
- TestBuildServerRejectsWebAPITokenWithoutWebAuth: PASSED
|
||||
- TestAuthorization: PASSED
|
||||
- TestWebSessionStoreExpiry: PASSED
|
||||
- TestBuildServerPropagatesWebViewProvider: PASSED
|
||||
Result: PASS
|
||||
|
||||
Build Verification:
|
||||
- cmd/api: Compiled successfully (0 errors)
|
||||
- cmd/gopeed: Compiled successfully (0 errors)
|
||||
|
||||
Lint & Code Style:
|
||||
- gofmt: Clean (all modified files formatted according to Go standards)
|
||||
- go vet: Clean (0 warnings, 0 errors across all modified packages)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
3. BACKWARD COMPATIBILITY & UI INTEGRITY CONFIRMATION
|
||||
----------------------------------------------------------------------
|
||||
- Zero changes to Flutter/UI codebase.
|
||||
- All new options are purely opt-in (tagged with `omitempty` in JSON / nil-safe checks in Go).
|
||||
- Existing API contracts, REST requests, and MCP tool workflows continue to function without any breaking alterations.
|
||||
|
||||
======================================================================
|
||||
END OF REPORT
|
||||
======================================================================
|
||||
Reference in new issue
Block a user