MCP (streamable HTTP) · Instagram

Draft Instagram posts from Gemini CLI

Gemini CLI can read a folder, write copy, and run shell commands, which covers everything an Instagram post needs. With SocialHandoff added as an MCP server, it drafts the caption, attaches the image with attach_media, and creates a post that waits for approval. Instagram rejects text-only posts, so Gemini should handle the image before the draft is final. You then review the caption and photo together in the inbox.

Prompt

Read events/workshop-june.md. Write an Instagram caption announcing the workshop: date, city, what people will build, and that seats are limited to 30. Upload events/workshop-june.jpg with alt text and create an Instagram draft with the uploaded id.

How to do it

  1. Connect Instagram and mint a key In https://app.socialhandoff.com, open Connections, connect an Instagram professional account (Business or Creator). Then create an agent key named Gemini CLI scoped to Instagram 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 JPEG image, Reel, or carousel (up to 10 items): 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 and give it the prompt. It shows each shell command and tool call before it runs.
  5. Review and approve Check the caption, hashtag count, and alt text on the approval card. On approval, the post publishes; if Instagram's daily quota is full, it is deferred by an hour.

Example draft

Build your first AI agent in one afternoon.

June 14 in Lisbon: a hands-on workshop where you wire a small agent to real tools and leave with working code. Laptops required, experience optional.

30 seats. Sign up at the link in bio.

#workshop #lisbon #aiagents #learntocode

[Image: workshop-june.jpg, a poster with the date and city, alt text included]

Gotchas

  • Only professional accounts (Business or Creator) can connect. A personal account is refused at connect time with instructions to switch.
  • Gemini CLI reads project settings over user settings. A stale .gemini/settings.json in the repo can point at the wrong instance.
  • Instagram refuses text-only posts. A draft can be saved as text first, but approving or scheduling it is refused with a clear error until an image or video is attached.
Instagram
  • Account type: Professional accounts only (Business or Creator). Personal accounts cannot publish through the API.
  • Media: Every post needs an image or video. Text-only posts are not possible on Instagram.
  • Image files: JPEG only, up to 8 MB. Convert PNG or WebP before posting.
  • Reels: Video posts publish as Reels, from MP4 or MOV files.
Schedule Instagram posts and Reels your agents draft

Frequently asked questions

Can I post Reels?
Yes. Attach an MP4 or MOV video and it publishes as a Reel with your caption.
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.
Does it work with a personal Instagram account?
No. Instagram only allows publishing through its API for professional accounts, Business or Creator. Switching is free in the Instagram app settings.

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