← Back to blog
AI Agents10 min read

How to Automate Social Media with Gemini CLI

PostAxis Team·
Gemini CLI logo next to the PostAxis logo with the title How to Automate Social Media with Gemini CLI

You can automate social media with Gemini CLI by adding the PostAxis MCP server to settings.json and running /mcp auth postaxis once. Gemini can then read your docs, changelog or pricing page, plan a week or a month of posts, check them against every network's rules and schedule them to X, LinkedIn, Threads, Telegram and more. It suits developers and technical founders who want their content calendar planned from the same terminal session as their project.

What you can automate with Gemini CLI

Gemini CLI is good at reading a lot of material and turning it into a plan. Lean on that.

  • A week of product tips pulled from your docs, one post a day on X and Threads.
  • An empty week filled around a single topic, like a pricing update, with a list to approve first.
  • A 30-day calendar, validated in one bulk call before anything is saved.
  • Instant announcements to LinkedIn and Telegram when something ships.
  • Queue repair: find scheduled posts that would fail on Instagram and fix them.

What you need

  • A PostAxis account. Sign up at app.postaxis.io; every plan starts with a 7-day free trial and includes MCP access with OAuth sign-in.
  • Social accounts connected under Accounts in PostAxis.
  • Gemini CLI installed and signed in to your Google or Gemini account.
  • The PostAxis API add-on only if you want to use an API key instead of the browser sign-in.

How to connect Gemini CLI to PostAxis (step by step)

It takes about two minutes.

  1. Create your PostAxis account and connect your social accounts. In PostAxis, open Accounts and connect the networks you use: Instagram, TikTok, YouTube, X, LinkedIn, Facebook Pages, Threads or Telegram channels. Gemini can only post to accounts connected here, and it never sees your social media passwords.

  2. Open settings.json. Edit ~/.gemini/settings.json for every project, or .gemini/settings.json inside one project. Create the file if it does not exist.

  3. Add the PostAxis block. Gemini CLI uses httpUrl for Streamable HTTP servers like PostAxis. If mcpServers already exists, add only the postaxis entry.

{
  "mcpServers": {
    "postaxis": {
      "httpUrl": "https://postaxis.io/api/mcp"
    }
  }
}
  1. Sign in. Start Gemini CLI and run the command below. Approve access on the PostAxis page that opens in your browser.
/mcp auth postaxis
  1. Check it works. Run /mcp. postaxis should be listed as ready with its tools. Then ask:
Which accounts can you post to? Is anything scheduled for next week?

Gemini calls list_accounts and list_posts. It asks for confirmation before running each tool, so you see exactly what it is about to do.

5 workflows you can copy

Turn your docs into a week of daily tips

Short, useful tips are the easiest content to keep up and the hardest to remember to write. Your docs folder already has dozens of them.

Read the files in docs/guides. Pick 7 features most users don't know
about. Write one tip per feature: under 240 characters, starts with the
benefit, no hashtags. Schedule one per day at 11:00 Asia/Singapore
starting Monday, each going to X and Threads. Validate first.

Gemini reads the folder, calls get_platform_rules for X (280 characters) and Threads (500), then create_posts_bulk with validate_only set to true. When the check comes back clean, it sends the same batch for real. You get something like: "Scheduled 7 posts, one per day at 11:00, each going to X and Threads. All passed both networks' rules."

Fill next week around a pricing update

When one topic matters this week, spread it out instead of saying it once and hoping.

Next week is empty. Read pricing.md and the pricing section of
CHANGELOG.md. Give me one post a day at 10:00 America/Toronto for X,
LinkedIn and Threads, built around the pricing update: what changes,
who benefits, how to switch, an FAQ, a reminder. Let me see the list
first.

Gemini writes five days of posts with a shorter caption for X and Threads and a longer one for LinkedIn. It shows you the list before calling anything. Once you approve, it validates and schedules them with create_posts_bulk. Ask for changes in plain words: "make Wednesday's LinkedIn post shorter".

Plan 30 days in one go

A month of content in a single session, checked before it touches your calendar. Bulk calls take up to 50 posts, so 30 fits in one.

Plan 30 days of posts for X and LinkedIn about our product, using
README.md, docs/ and the last three CHANGELOG entries as source. Mix
tips, feature spotlights and "how we built it" posts. 10:00
Europe/Madrid every day starting the 1st. Validate them, show me the
calendar as a table, then wait for my go-ahead before scheduling.

PostAxis checks all 30 posts against both networks' rules and saves nothing during validation. You review the table, and Gemini schedules them only after you say go. Every post then appears in the PostAxis calendar, where you can edit or delete any of them.

Publish an announcement right now

Not everything needs scheduling. When the launch is live, post it.

Publish this announcement to LinkedIn and our Telegram channel now:
"Natural-language search is live in the dashboard for all workspaces.
Type a question in plain words and get the matching records." Expand it
into 2 short paragraphs for LinkedIn; keep Telegram as written.

Gemini calls create_post with publish set to now and a separate caption per account. Note that immediate publishing works with single posts; bulk calls are for scheduling only.

Fix posts that would fail on Instagram

Instagram is the strictest network: it needs a professional account and at least one image or a video. Posts drafted for text-first networks sometimes get Instagram added by mistake.

Check which of my scheduled posts for the next two weeks target
Instagram and would fail its rules. Shorten captions that are too long.
For posts with no media, list them for me instead of guessing an image.

Gemini uses list_posts, get_post and get_platform_rules, then update_post for the caption fixes. It cannot invent media, since PostAxis does not generate images, so it lists those posts for you. Give it a public URL and it attaches the image with upload_media_from_url.

Network limits Gemini CLI works within

NetworkCaption limitMedia rules
X (Twitter)280 charactersText-only allowed; up to 4 images or a video
Threads500 charactersText-only allowed; up to 10 images or a video
LinkedIn3,000 charactersText-only allowed; up to 9 images or a video
Telegram4,096 characters (1,024 with media)Text-only allowed; up to 10 images or a video
Instagram2,200 charactersMedia required: 1–10 images or one video (Reel); professional account

For video: MP4 or MOV, 3 to 300 seconds, aspect ratio 16:9, 9:16, 4:3, 3:4 or 1:1. One video per post, and images and video cannot be mixed.

PostAxis checks every post against these rules before saving it. If Gemini writes a 310-character tip for X, the call is rejected with the reason, and Gemini rewrites it. That is why the validate-first habit works so well: the whole plan is checked by the same rules that apply when it is saved.

Tips for better posts

  • Put your voice in GEMINI.md. Gemini CLI loads GEMINI.md as context for the project. Add a "Social posts" section with your audience, tone, words to avoid, hashtag policy and which network gets which kind of post.
  • Validate first, every time you plan more than a couple of posts. "Validate first and show me a table" means nothing is saved until you have read it.
  • Always include a timezone. "11:00 Asia/Singapore" leaves no room for doubt. Without one, the agent uses the timezone it was told or UTC.
  • Keep confirmations on for posting tools. Gemini CLI can be told to skip tool confirmations (for example with a YOLO-style mode). Leave that off for anything that creates or deletes posts.
  • Use drafts for the sensitive stuff. Pricing, outages and anything legal: ask Gemini to save drafts and review them under Drafts in PostAxis.
  • Script the routine parts. Gemini CLI can run a single prompt non-interactively with gemini -p "...". That is handy for a weekly "what's new" draft from your commits. Check the Gemini CLI docs for how tool confirmations behave in that mode on your version, and prefer drafts when nobody is watching.

Troubleshooting

/mcp does not list postaxis. Check the JSON is valid and the block is inside mcpServers. Make sure you used httpUrl, not url. Restart Gemini CLI after editing settings.json.

401 Unauthorized or "sign in again". The sign-in expired or was revoked. Run /mcp auth postaxis again. With an API key, check the key is still active under Settings → API keys.

Gemini says no accounts are connected. Connect at least one social account under Accounts in PostAxis. If you have several workspaces, name the one to use: "use my Acme workspace".

A post was rejected before saving. PostAxis checks caption length, media count, video length and format first. The error says what to change. Ask Gemini to fix it and retry.

Posts were scheduled at the wrong time. Say the timezone in your request, for example "9:00 Europe/Berlin".

FAQ

Can Gemini CLI post to social media?

Yes. With the PostAxis MCP server in settings.json, Gemini CLI can draft, schedule, publish, edit and delete posts on Instagram, TikTok, YouTube Shorts, X, LinkedIn, Facebook Pages, Threads and Telegram channels.

Why httpUrl and not url?

Gemini CLI uses httpUrl for Streamable HTTP servers like PostAxis; url is for the older SSE transport.

Can Gemini CLI schedule 30 days of posts at once?

Yes. It can send up to 50 posts in one bulk call. Ask it to validate first: PostAxis checks every post and saves nothing, so you can review the plan before it is scheduled.

Does this work in the Gemini web app?

This guide is for Gemini CLI, which supports remote MCP servers with OAuth. Support for custom connectors in the Gemini apps depends on Google's rollout in your account and region.

Does Gemini see my social media passwords?

No. Social accounts are connected in PostAxis. Gemini CLI only holds a PostAxis sign-in, which you can revoke any time under Settings → API keys → Connected agents.

How much does it cost?

MCP access with OAuth is included in every PostAxis plan, and every plan starts with a 7-day free trial. API keys need the API add-on.

Start with the Gemini CLI agent page for the config block, keep the MCP server reference handy for the full tool list, and read the complete guide to AI agents for social media for safe-automation habits. Using other assistants as well? See how to automate social media with OpenAI Codex or schedule posts with Claude. Then start your free trial and give Gemini next week's calendar.

gemini cli social mediagemini cli mcp serverschedule posts from terminalgemini cli settings.json mcpsocial media mcp server

Ready to simplify your social media?

PostAxis helps builders and creators publish to all platforms from one dashboard with scheduling, cross-posting, and automation.

Join the waitlist →

Wide list of social channels
on one axis

Harness every network you need. Platforms orbit PostAxis; you stay at the center.

Browse all platform pages

Frequently asked questions

You get a 7-day free trial. A card is required to start. Cancel before the trial ends and you pay nothing. After that, you pick a Creator, Growth, or Pro plan.