MCP (streamable HTTP)

Draft social posts from the terminal with Gemini CLI

Gemini CLI reads MCP servers from settings.json. Add SocialHandoff with an httpUrl and a bearer header, and Gemini can draft, preview, and plan posts, which then wait for a person to approve them.

How to do it

  1. Mint a Gemini CLI key In https://app.socialhandoff.com, open Connections and add an agent named Gemini CLI. Keep it draft-only and limit its networks.
  2. Choose the settings file Use ~/.gemini/settings.json for all projects, or .gemini/settings.json in a project folder for just that project.
  3. Add the mcpServers entry Paste the block below. Gemini CLI uses httpUrl for streamable HTTP servers and url for SSE, so use httpUrl here.
  4. Verify with /mcp Start gemini and run /mcp. The server should be connected with its tools and descriptions listed.
  5. Ask for drafts Ask Gemini for a post and approve it in the SocialHandoff inbox.
{
  "mcpServers": {
    "social": {
      "httpUrl": "https://app.socialhandoff.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_AGENT_KEY"
      },
      "timeout": 30000
    }
  }
}

Using Gemini CLI for posts

Gemini CLI is a terminal agent with a large context window, which helps when the source for a post is big: a long changelog, a full RFC, or a transcript. Paste or reference the file with @path/to/file, then ask for drafts. Gemini calls draft_post for each network and can call preview_posts to check lengths before it reports back.

Prompts that work

  • "@CHANGELOG.md Draft an X thread and a LinkedIn post about the 3 biggest changes. Use brand memory for tone. Do not schedule."
  • "Plan next week on Mastodon and Bluesky: one post a day about the tutorials in @docs/guides."
  • "List pending drafts for LinkedIn and summarize which ones I should approve first."
  • "Get insights for the last 30 days and suggest one change to my voice rules. Do not apply it."

That last prompt uses get_insights. Best-time and engagement comparisons are labeled as heuristics, so treat them as hints.

Trust settings

Gemini CLI asks before running MCP tools unless the server is marked trust: true in settings. Leave trust off for SocialHandoff; the confirmation prompt is cheap, and it pairs well with the approval inbox. You can also limit which tools Gemini sees with includeTools or excludeTools in the server entry, for example excluding update_brand_memory (which an agent key cannot call anyway).

Keeping the key safe

Gemini CLI can read values from environment variables in settings.json. Put the key in your shell environment and reference it rather than pasting it, especially in a project-level .gemini/settings.json that could be committed. Recent versions also offer a gemini mcp add command that writes the entry for you with a transport and header flag.

Troubleshooting

  • Server shows disconnected: the key is httpUrl, not url. With url, Gemini tries SSE.
  • Timeouts: raise timeout in milliseconds; plan_week does more work than a single draft.
  • 401: check the header and that the key is active in Connections.
  • Tools missing after edit: restart the CLI; settings are read at start.

Walkthroughs by network: Gemini CLI for X, Gemini CLI for LinkedIn, Gemini CLI for Bluesky, Gemini CLI for Mastodon, and Gemini CLI for Threads.

Frequently asked questions

Where does Gemini CLI read MCP servers from?
From the mcpServers object in ~/.gemini/settings.json, or .gemini/settings.json in a project. Project settings apply only in that folder.
Should I use httpUrl or url for SocialHandoff?
Use httpUrl. In Gemini CLI, httpUrl means streamable HTTP, which is what the SocialHandoff /mcp endpoint speaks. The url field is for SSE servers.
Can Gemini CLI post without asking me?
It can draft, and schedule if you grant it, but it cannot approve. New agents are draft-only, so a person approves every post in the inbox.

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