Skip to content

t1k:comms-mcp:media-upload

FieldValue
Modulemedia-upload
Version0.3.3
Effortlow
Tools—
/t1k:comms-mcp:media-upload

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 DiscordPath B — shared media host
DestinationA Discord message/channelSlack, Lark, WhatsApp, a wiki page, anywhere a URL works
LifetimeTied to the Discord message/channelOutlives any single message — a stable URL you can paste anywhere
Requiresdiscord-mcp with attachments_prepare_upload (shipped) and the bot’s Attach Files permission in the channelT1K_MEDIA_UPLOAD_TOKEN env var — live now

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”).

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.

  1. Call attachments_prepare_upload with { channel_id, files: [{ filename, file_size }] } (1-10 files). It calls Discord’s POST /channels/{channel_id}/attachments for you and returns { attachments: [{ id, filename, upload_url, upload_filename }], expires_hint }.
  2. PUT the raw bytes to each upload_url yourself — no server involvement, no bot token needed for this step (it’s a signed CDN URL):
    Terminal window
    curl -sS -X PUT -H 'Content-Type: application/octet-stream' --data-binary @<file> '<upload_url>'
    Confirm HTTP 200 before continuing.
  3. Call messages_send (or components_v2_send) with attachments: [{ id, filename, uploaded_filename, description? }] — content becomes optional once attachments are present. A Components V2 MediaGallery can reference the file as attachment://<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.

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.

Terminal window
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.gif

Each 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:

  1. A Cloudflare Worker secret (UPLOAD_TOKEN, set via wrangler secret put), and
  2. 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.

  • 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.