Stream authenticated binary attachments outside MCP results - #7
Merged
Merged
Conversation
Closed
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.
Remote clients previously had to embed binary attachments as Base64 in MCP results. Add
get_attachment_download_url, which checks attachment visibility and returns metadata plus a credential-free HTTP resource link. An authenticated GET to/mcp/attachments/{id}/{filename}streams the original bytes with download headers, backpressure, cancellation and explicit failure on interrupted transfers. Close unused connections on shutdown, including replacement connections opened after an aborted fetch. Inline downloads and local stdio saves remain available.Downloads reuse the existing API-key/OAuth caller handling and require
fmsg:readin OAuth mode. The Web API checks message access on every fetch; incoming OAuth tokens are exchanged rather than forwarded. Links use the configured public MCP URL, never request/forwarded headers. OAuth reuses its resource URL; API-key operators setFMSG_MCP_PUBLIC_URL. Update proxy routing, host guidance and deployment documentation accordingly.Host compatibility: the AI host must fetch the URL using its existing MCP Authorization header. An ordinary unauthenticated browser click returns 401. No credentials are included in links or model output, and no new recipient ACL or messaging approval flow is introduced. Range/resume support is outside this change.
Validation:
88a7fef: CI run.One initial full-suite run hit the existing OAuth wait-expiry test's intermittent 500/401 failure. A subsequent full run and eight targeted runs passed; retain diagnostic response/log output in that assertion. No OAuth exchange logic is changed here.
Closes #6.