t1k:comms-mcp:media-upload
| Field | Value |
|---|---|
| Module | media-upload |
| Version | 0.3.3 |
| Effort | low |
| Tools | — |
How to invoke
Section titled “How to invoke”/t1k:comms-mcp:media-uploadMedia Upload (comms-mcp)
Section titled “Media Upload (comms-mcp)”Two paths, from the shared T1K media-upload contract (v1, 2026-09-27). Pick by destination and lifetime, not by habit — they answer different questions.
| Path A — native Discord | Path B — shared media host | |
|---|---|---|
| Destination | A Discord message/channel | Slack, Lark, WhatsApp, a wiki page, anywhere a URL works |
| Lifetime | Tied to the Discord message/channel | Outlives any single message — a stable URL you can paste anywhere |
| Requires | discord-mcp with attachments_prepare_upload (shipped) and the bot’s Attach Files permission in the channel | T1K_MEDIA_UPLOAD_TOKEN env var — live now |
Executed by
Section titled “Executed by”This skill stays on the reasoning tier. Its only script, scripts/t1k-media-upload.sh, PUTs
files to the shared media host with a bearer token: it publishes content to a public URL that
cannot be unpublished from here (external-state mutation), so no cheap-tier agent runs it.
Choosing Path A vs Path B, deciding whether a file is safe to publish, and handling the
credential are judgment steps for the reasoning tier. No cheap-tier agent is delegated any
step (routing SSOT: rules/orchestration-rules.md § “Task-Type → Agent Routing”).
Path A — native Discord upload
Section titled “Path A — native Discord upload”Status: shipped. attachments_prepare_upload is implemented in The1Studio/discord-mcp
(packages/mcp-core/src/tools/attachments/prepare_upload.ts) and served by the hosted server at
https://discord-mcp.the1studio.org/mcp. It still needs the bot’s Attach Files permission on the
target channel.
Requires discord-mcp with the attachments_prepare_upload tool. This skill teaches the flow;
it does not implement or vendor discord-mcp itself.
- Call
attachments_prepare_uploadwith{ channel_id, files: [{ filename, file_size }] }(1-10 files). It calls Discord’sPOST /channels/{channel_id}/attachmentsfor you and returns{ attachments: [{ id, filename, upload_url, upload_filename }], expires_hint }. - PUT the raw bytes to each
upload_urlyourself — no server involvement, no bot token needed for this step (it’s a signed CDN URL):Confirm HTTP 200 before continuing.Terminal window curl -sS -X PUT -H 'Content-Type: application/octet-stream' --data-binary @<file> '<upload_url>' - Call
messages_send(orcomponents_v2_send) withattachments: [{ id, filename, uploaded_filename, description? }]—contentbecomes optional once attachments are present. A Components V2 MediaGallery can reference the file asattachment://<filename>.
Permission note: if the bot lacks Attach Files on that channel, attachments_prepare_upload (or
the send call) returns a structured error naming the missing permission — surface that error text
verbatim to the user; don’t retry blindly and don’t guess at a workaround.
Path B — shared studio media host
Section titled “Path B — shared studio media host”Cloudflare Worker + R2 at https://media.the1studio.org (repo The1Studio/t1k-media-host,
private). Use this for Slack/Lark/WhatsApp, a wiki/doc link, or anything that needs to survive
longer than one Discord message.
export T1K_MEDIA_UPLOAD_TOKEN=<token> # see "Getting the credential" below.claude/skills/t1k-comms-mcp-media-upload/scripts/t1k-media-upload.sh capture.png demo.gifEach line of stdout is the public URL for the matching input file, in order. The script:
generates <yyyymmdd>/<random> itself, PUTs to /u/<yyyymmdd>/<random>/<filename> with
Authorization: Bearer $T1K_MEDIA_UPLOAD_TOKEN, and prints the { "url": ... } the Worker
returns. GET on that same URL is public, no auth, long-cached, correct Content-Type.
The object name is the local basename slugified to [A-Za-z0-9._-] (other characters become -,
capped at 200 chars, extension kept), because the Worker rejects anything else with 400. So
my shot.png is published as .../my-shot.png; the returned URL shows the slugified name.
Allow-listed extensions: png, jpg/jpeg, gif, webp, mp4, webm, pdf. Size cap: 25 MiB.
Anything else is rejected before upload (client-side) or by the Worker (415/413).
Getting the credential — without it ever being committed
Section titled “Getting the credential — without it ever being committed”T1K_MEDIA_UPLOAD_TOKEN is not in any repo, .env.example value, or skill file. It lives as:
- A Cloudflare Worker secret (
UPLOAD_TOKEN, set viawrangler secret put), and - The matching GitHub Actions secret in
The1Studio/t1k-media-host(Settings → Secrets and variables → Actions → UPLOAD_TOKEN) — the source of truth the deploy/rotation workflow reads from. Once set, nobody can read it back through the GitHub UI or API, only overwrite it.
To get the current value: ask a t1k-media-host repo admin for it out-of-band (the studio’s shared
password vault entry, or a DM) — the same way any other Worker API credential is distributed in
this org. Put it in your own shell env (export T1K_MEDIA_UPLOAD_TOKEN=... in a local, gitignored
profile), never in a tracked file. See The1Studio/t1k-media-host’s README for rotation.
Choosing between them
Section titled “Choosing between them”- Posting into a Discord channel right now → Path A. It’s native, no separate host, no token to manage. Needs the bot’s Attach Files permission on that channel; if it is missing, surface the error verbatim. Use Path B only when the link must outlive the message.
- Posting to Slack/Lark/WhatsApp, a wiki page, an issue, or anywhere the link needs to outlive the message (or the channel gets purged), or Discord today → Path B. It’s live now.
- Both need the file to already exist locally; neither path generates or edits media.