MCP (streamable HTTP) · TikTok

Draft TikTok posts from Gemini CLI

If your short videos come out of a script, for example a screen recorder that drops files into a folder, Gemini CLI can pick up where it ends. It writes the caption, uploads the video to SocialHandoff, and creates a TikTok draft for approval. TikTok needs a video or photos on every post, and until TikTok audits your developer app, posts are private, which makes early testing low-risk.

Prompt

Look in exports/ for today's MP4. Write a TikTok caption about what it shows (read exports/notes.txt), with a hook and 4 hashtags. Upload the video to /v1/media and create the TikTok draft.

How to do it

  1. Connect TikTok and mint a key In https://app.socialhandoff.com, open Connections, connect TikTok, then open TikTok settings on the account and choose visibility, comment/duet/stitch, and commercial disclosure. Then create an agent key named Gemini CLI scoped to TikTok with draft and schedule permission.
  2. Add the server to settings.json In ~/.gemini/settings.json or the project .gemini/settings.json, add an mcpServers entry with httpUrl set to https://app.socialhandoff.com/mcp and a headers object carrying the bearer key.
  3. Attach media from the workspace Gemini CLI calls attach_media for the video or up to 35 photos: a public url, or the file as base64 data (up to 8 MB) with its mime type and alt text. Larger files go to POST https://app.socialhandoff.com/v1/media as multipart. The ids go into draft_post as mediaIds.
  4. Ask for the draft Run gemini in the project folder. It reads the notes, writes the caption, uploads the MP4 with curl, and calls draft_post with the id in mediaIds.
  5. Approve with the consent text The approval screen shows the visibility and interaction settings chosen in Connections and TikTok's consent text. Approve, and it publishes; a video is sent to TikTok in chunks.

Example draft

We taught our robot arm to sort LEGO by color. It gets about 9 out of 10 right. The 10th goes on the floor.

#robotics #engineering #maker #lego

[Video: today's MP4 from exports/, 27 seconds, vertical]

Gotchas

  • Photo posts are fetched by URL, so the domain serving your media must be verified in the TikTok developer portal. Videos upload as bytes and skip this.
  • Gemini CLI reads project settings over user settings. A stale .gemini/settings.json in the repo can point at the wrong instance.
  • TikTok refuses text-only posts. The agent can draft the caption first, but approval and scheduling are refused until a video or photos are attached.
TikTok
  • Media: Every post needs one video or up to 35 photos. Text-only posts are not possible.
  • Video upload: Videos upload in chunks of 5 to 64 MB; smaller files go in one piece. Maximum duration depends on the creator account.
  • Photo posts: Up to 35 JPEG or WebP images, a title up to 90 characters, and a description up to 4,000 characters.
  • Required choices: TikTok requires a visibility setting with no default, comment/duet/stitch toggles, and a commercial content disclosure.
TikTok scheduler with approval and TikTok's required choices

Frequently asked questions

What does the reviewer see before approving?
The approval screen shows the caption, the media, the account's chosen settings, and TikTok's consent text, so the person approving knows exactly what will be posted.
Which key does Gemini CLI use for the URL?
httpUrl for streamable HTTP. The url key means SSE and will not connect to the /mcp endpoint.
Where do I choose who can see the video?
In Connections, TikTok settings reads the creator's live options and asks for visibility, comment, duet, stitch, and commercial content disclosure. Those choices apply to every post from that account.

Let your agents post. Keep the final say.

Connect your first agent in minutes. Every draft waits in your inbox until you approve it.

14 days free. No card required.

The hosted version is opening soon

Leave your email and we will send one message when hosted accounts open, with your 14-day trial ready. Want it today? Self-host it free from the repo.

Start free trial