feat: ✨ add issue & comment attachment tools (closes #106) #109
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp!109
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-attachments"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #106 — attachments uploaded via the Forgejo web UI were invisible to MCP clients because
GET /issues/{index}does not embed them andforgejo-sdk/v3has no issue/comment attachment methods.--climodepkg/forgejo/rawhttp.go— a single raw-HTTP helper (DoJSON,DoJSONList,DoMultipart,DoRaw) that all attachment handlers go through; nonet/httpimports in the handler packageBlobResourceContents(MCP-protocol-native binary) + metadata JSONbrowser_download_urlonly; caller fetches withAuthorization: token <TOKEN>— verified live against the Codeberg API (Open Question #2 from the spec, now resolved)browser_download_urlalways included regardless of sizeWhat was verified live
All API contract points from
docs/plans/issue-attachments.mdPart 1 were verified against a live Codeberg test issue before writing any Go code:attachment✓PATCHbody:{"name": "..."}✓DELETEreturns 204 ✓Authorization: tokenworks onbrowser_download_url✓ (Open Question #2 resolved positively)Test plan
go test ./...passes (includes unit tests for rawhttp helper and all 12 handlers with httptest mock servers)go test -race ./pkg/forgejo/... ./operation/attachment/...passesmake buildpasses./forgejo-mcp --cli list_issue_attachments --args '{"owner":"goern","repo":"forgejo-mcp","index":106}'returns attachment metadata on an issue with uploadsdownload_issue_attachmenton a small file returnsBlobResourceContentswhose base64 decodes to the original bytesdownload_issue_attachmenton a file ≥ 1 MiB returns metadata + URL, no blob