Temporary download URL delivery (deliver:'url')#8
Merged
Conversation
generate_screenshot / generate_batch gain a `deliver` mode: - inline (default): PNG as a base64 image block, as before - url: store the PNG in an in-memory TTL cache and return a temporary https://<host>/files/<id>.png link that auto-deletes after ttlSeconds (default 600). Keeps the MCP response tiny and is fetchable from a browser or another machine (reachable through the Cloudflare Tunnel). - both: inline image + URL New filestore.ts (memory-only, auto-eviction), a GET /files/:id endpoint, and a public-base-URL resolver honoring X-Forwarded-* or PUBLIC_BASE_URL. Over stdio (no HTTP server) url falls back to inline with a note. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
For remote use, returning a big base64 blob inline is heavy. This adds the option to host the rendered PNG temporarily and return a short download URL that auto-deletes after a TTL — so a client (Claude, a browser, your Mac) fetches it instead.
What
generate_screenshot/generate_batchgain:deliver:inline(default, base64 image block) ·url(temporary link) ·bothttlSeconds: lifetime of the URL (default 600, 10–86400)Implementation:
filestore.ts— in-memory store keyed by an unguessable id, auto-evicted after the TTL (nothing on disk; gone on restart).GET /files/:idserves the PNG (Cache-Control: no-store), 404 once expired. CORS-enabled so a browser can fetch it.X-Forwarded-Proto/Host(works behind the Cloudflare Tunnel) orPUBLIC_BASE_URL.urlgracefully falls back toinlinewith a note.Verified
deliver:'url'→ tiny text response; fetching the link returns a validimage/png(200); unknown id → 404.deliver:'both'→ image + URL; stdiourl→ inline + note.🤖 Generated with Claude Code