Repository navigation
Attachments over the CLI and MCP - #7
Merged
Merged
Conversation
CLI: `completo attachment <ticket> [list|add|download|delete]`, with multipart upload (sent with a Content-Length so the server's early size check applies) and streamed download that never overwrites without --force and keeps a stored name inside the chosen directory. MCP: list_attachments, add_attachment (text or base64), get_attachment (text as text, images as image blocks, other files as a link) and delete_attachment, all through the REST handlers. The in-process fetch drops a FormData body's multipart Content-Type, so the tool context encodes it itself. /mcp gets a body limit that fits a base64 upload at the upload limit instead of the 1 MB default. Fixes found on the way: - GET /api/cards/:id returns attachmentCount; `completo get` printed 0 for every card. - The upload handler answered a non-multipart body with a 500. - Every CLI command accepted a ticket with the wrong project key and acted on that card number in another project; fetchCard now refuses it, as the MCP loadCard already did. - CLI errors printed twice around the full usage text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Attachments could only be handled in the browser. This adds them to the CLI and the MCP server, and fixes what got in the way.
CLI:
completo attachment <ticket> [list|add|download|delete]addtakes one or more files and reads all of them before uploading any (a typo attaches nothing). The upload carries a Content-Length, so the server's early size check applies.downloadsaves under the file's own name, or to-o <dir|path|->; it refuses to overwrite without--force, keeps a stored name inside the chosen directory, and removes a partial file on failure.--jsonon every action.MCP
list_attachments,add_attachment(content astextorbase64),get_attachment(text files as text, PNG/JPEG/GIF/WebP as an image block, anything else as details and a link),delete_attachment.get_cardlists a card's files.event.$fetch. The in-process fetch drops a FormData body's multipart Content-Type, so the tool context encodes the FormData itself./mcpgets a body limit that fits a base64 upload at the upload limit; at the 1 MB default a file stopped at 1 MB.Fixes found on the way
GET /api/cards/:idreturnsattachmentCount;completo getprintedattachments: 0for every card.AB-42acted on card 42 of another project, including writes).fetchCardnow refuses it, as the MCPloadCardalready did.Error:. Argument and flag mistakes still show the usage.Docs: CHANGELOG (Unreleased), README MCP section,
skills/completo/SKILL.md, OpenAPI (attachmentCount), MCP instructions.Tests
pnpm lint,pnpm typecheck,pnpm test: 132 files, 2019 passed, 8 skipped. New: 11 MCP attachment tests (text, maxChars cut, image block, binary as link, a 2 MB file over/mcp, server refusal passed through, input validation, delete, no access to another card's file) and 2 upload tests (400 for non-multipart,attachmentCount).gofmt,go vet,go test ./...: ref resolution, download path containment, declared content type, key check, multipart with Content-Length, error passthrough.--json, download by name and by ID prefix byte-identical, overwrite refusal and--force, refused type, missing file uploads nothing, delete, wrong key refused,getcount.🤖 Generated with Claude Code