MCP (streamable HTTP) · Mastodon

A Gemini CLI Mastodon bot that asks first

Many sysadmins and command-line tool authors hang out on Mastodon instances like Fosstodon and Hachyderm. Gemini CLI fits that audience: it can read the man page or changelog of a tool in your terminal and draft a toot through SocialHandoff that sounds like a person who uses the tool, with CamelCase hashtags placed at the end. Nothing federates until you approve it in the inbox.

Prompt

Read CHANGELOG.md and draft a Mastodon post for the 2.0 release of our backup CLI. Mention that the config format changed and link the migration guide at example.org/backy/migrate. Add #SysAdmin #CommandLine. Keep it under 450 characters.

How to do it

  1. Mint a Mastodon agent key In https://app.socialhandoff.com, open Connections, connect your Mastodon account, then create an agent key scoped to Mastodon with draft permission only. Copy the key when it is shown; only its hash is stored.
  2. Edit settings.json In ~/.gemini/settings.json, add an mcpServers entry with httpUrl set to https://app.socialhandoff.com/mcp and a headers object carrying the Mastodon key as a bearer token.
  3. Check the connection Start gemini and run /mcp. The server should be listed as connected with its tools.
  4. Draft from the terminal Ask Gemini CLI to read the release notes or git log and draft a Mastodon post. It calls draft_post and the post appears in your approval inbox.

Example draft

backy 2.0 is out. The headline: incremental backups are now the default, and restores can pick a single file out of any snapshot.

The config format changed from INI to TOML. backy migrate-config converts your old file, and the guide covers the edge cases: example.org/backy/migrate

#SysAdmin #CommandLine

Gotchas

  • Alt text is expected on the fediverse, and many people filter posts without it. The missing alt text guardrail flags drafts before they reach you.
  • Read your instance rules on automated posting. Many ask that bot-driven accounts tick the automated account box in profile settings.
  • Use CamelCase hashtags such as #OpenSource so screen readers say them correctly, and a content warning for long logs or spoilers.
  • Gemini CLI reads settings.json at startup. If /mcp shows the server as disconnected, check the httpUrl and that the bearer header uses the Mastodon key.
Mastodon
  • Character limit: 500 characters on a default Mastodon server. Each instance can raise it, so check yours.
  • Links: Every URL counts as 23 characters, however long it is.
  • Media per post: Up to 4 attachments on a default server.
  • File sizes: Images up to 16 MB and video up to about 99 MB on a default install. Instances can set their own limits.
Mastodon scheduler with approval for any instance

Frequently asked questions

Can Gemini CLI run this non-interactively?
Yes. Pass a prompt to gemini in non-interactive mode from a script. The result is still only a draft, so an unattended run cannot publish.
Does Gemini CLI know my instance's character limit?
Not by itself. Tell it in the prompt or brand memory, and set the per-network length guardrail so drafts over your limit are flagged.
Is posting to Mastodon from an agent good etiquette?
It can be, if the account is labeled as automated where your instance asks for it, posts carry alt text, and a person reviews each post. The approval inbox covers the last part.

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