Replies: 2 comments
-
|
PR is up: #1954 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks for picking this up, @swissky! Glad to see a PR up already — will take it for a spin. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue #620 (assigned) and #1825 both ask for the same missing piece: the MCP server has no way to get file bytes into storage.
media_createonly registers metadata for a file that's already at astorageKey, so fully-automated content workflows (e.g. Claude Code generating a post with a cover image) still have to drop to the CLI or the raw multipart API with CSRF headers.Proposed design (implementation ready)
A new
media_uploadtool that accepts:base64— base64-encoded file contents, orurl— a public http(s) URL to fetch the file from (exactly one of the two)filename(required),contentType(required withbase64, defaults to the responseContent-Typewithurl),alt(optional)It runs the exact same pipeline as the REST
POST /_emdash/api/mediaroute:image/,video/,audio/,application/pdf)maxUploadSizelimit (with a cheap precheck on the encoded string /Content-Lengthbefore buffering)deduplicated: trueReturns the media item with
id,storageKey, andurl, ready forcontent_create/content_update.Security: URL fetches go through the existing
ssrfSafeFetch(DNS resolution checked against private ranges, redirects re-validated, credential headers stripped cross-origin). Auth mirrors the REST route:media:writescope + Contributor minimum role (themedia:uploadpermission's floor inrbac.ts).Non-goals: no signed-URL round-trip over MCP (that flow stays as-is via
media_create), no chunking — base64 over JSON-RPC is fine within the upload size limit.PR incoming, linked here.
Beta Was this translation helpful? Give feedback.
All reactions