Post to LinkedIn from Gemini CLI

From Gemini CLI, LinkedIn starts with which Page may post. Hermoso enforces that on the server, so a terminal run cannot post as the wrong identity.

Hermoso is a marketing MCP server: 850+ tools over one OAuth’d endpoint that let an agent research the ads already running in a market, generate finished image and video ads, publish them, and build the paid campaigns behind them. Gemini CLI reaches all of it through one connection. This page is about one slice of that — what Gemini CLI can actually do on LinkedIn, and what LinkedIn will not let it do.

Connect Hermoso to Gemini CLI

  1. Install the extension.
    gemini extensions install https://github.com/hermoso-ai/hermoso
    It installs the latest release of Hermoso’s public repository: five skills (research, ad-from-brand, generate, product-photoshoot and marketing) plus a GEMINI.md context file. The skills run the hermoso command through npx, so nothing is added to Gemini CLI’s tool list and nothing costs context until a command runs. gemini extensions list shows them under Agent skills.
  2. Sign in once.
    npx -y hermoso auth login
    It opens a browser sign-in and stores an owner-only credential in ~/.hermoso/config.json. Gemini CLI can run it for you the first time it needs Hermoso. No browser on that machine? Create a key under MCP & CLI → Terminal & API keys and run npx -y hermoso auth login --token hmk_….
  3. Optional: the MCP server as well.
    gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp
    Gemini CLI finds Hermoso’s authorization server when the first connection answers 401 and registers itself, so no key goes in settings.json; /mcp auth hermoso inside a session runs the sign-in. The skills reach every tool without it.
  4. Ask Gemini CLI for something. “Pull my three closest competitors’ longest-running ads and remix the best hook into a 9:16 video,” or “post this render to the channel.” The agent picks the tools; you approve the spend.

We ran the install above on 2026-09-23 against Gemini CLI 0.60.0 in a clean home directory: it pulled the current release of hermoso-ai/hermoso, and gemini extensions list reported the five skills and the context file. The extension carries no MCP server of its own, which is deliberate: a tool list is loaded into every session, and skills cost nothing until they run. Hermoso is not affiliated with or endorsed by Google.

Then connect LinkedIn itself, once, under Settings → Connectors in Hermoso. That is an OAuth consent screen, so it is the one step that needs a browser — everything after it is a tool call.

The LinkedIn tools Gemini CLI gets

  • post_to_linkedin_page — publishes to a company Page — text, an image, a video, or a multi-image post — with alt text.
  • post_to_linkedin — publishes to a personal profile, which stays switched off until you explicitly share that identity.
  • list_linkedin_pages — the Pages you have shared with this brand, with their organization ids.
  • schedule_post — queues it, carrying linkedinOrganizationId so the right identity posts.
  • manage_linkedin_post — edit the copy of a post, or delete it.
  • linkedin_page_analytics — organic Page performance — follower gains, Page views, and post impressions, clicks and engagement, per Page or per post.
  • search_linkedin_ads — the LinkedIn Ad Library — the one public ad library that exposes real impression counts.

LinkedIn is the channel where identity is a permission rather than a preference. One person usually administers several companies’ Pages, so Hermoso makes the postable identities an explicit choice: only the Pages you have ticked under Manage accounts can be posted to, an unticked Page is refused server-side rather than in the UI alone, and the personal profile is off unless you turn it on. An agent that asks which Page rather than assuming is doing the right thing.

LinkedIn limits worth knowing before you automate anything

TextA LinkedIn post is capped at 3,000 characters. It is enforced when the post is created or queued — refused while you are still there to fix it, rather than silently cut on the way out.
VisibilityPublic only — “a LinkedIn post publishes to the profile or company Page — LinkedIn has no unlisted, private or draft post.”
Carousel2 to 20 images, from a company Page. Both bounds are LinkedIn’s own: “A MultiImage post is a post containing multiple images (minimum of 2 images and maximum of 20 images)”, and the schema adds “Only supports images”. Two refusals follow from that and both are by name rather than by silent downgrade: a video slide is refused because LinkedIn’s multi-image post cannot carry one, and a personal-profile carousel is refused with the way forward — “Pass linkedinOrganizationId (list_linkedin_pages) — a personal-profile carousel is not something Hermoso can publish.”
Which accountlinkedinOrganizationId. Unset means the member’s own profile, never “probably the company” — so the field is how you say which Page, and leaving it out is a decision rather than an accident.

Try it in Gemini CLI

Ask for it in ordinary language — these are sentences, not a DSL:

“List the LinkedIn Pages I have shared, then post ./drafts/case-study.md to the company Page with the four charts in ./assets as a carousel and alt text on each.”

That walks list_linkedin_pagesplan_adrender_adpost_to_linkedin_pagelinkedin_page_analytics. Gemini CLI asks before it runs a shell command, and the skills act through the hermoso command, so a publish shows up as a line you can read before you say yes. For MCP tools it offers once, always for that tool, or always for the server.

Gemini CLI on LinkedIn: the part that bites

Leaving the organization id out means your personal profile, never “probably the company”, and the personal profile is off until you share it. A carousel needs the Page anyway, since multi-image posts come from company Pages. Resolve list_linkedin_pages once and keep the id in the project, the same way a project-scoped Gemini CLI config keeps one repo on one brand.

Two Gemini CLI details decide how safe this is. gemini mcp add writes to the project’s .gemini/settings.json unless you pass --scope user, which is useful when one repo should always run against one brand. And never add Hermoso with --trust: it skips every confirmation for the server, including the ones in front of a publish. MCP tools arrive named mcp_hermoso_ plus the tool name, and --exclude-tools keeps any of them out entirely.

Research LinkedIn before you post

search_linkedin_ads reads the LinkedIn Ad Library, which is unusual among public ad libraries in exposing real impression counts — so B2B competitor research on LinkedIn can be ranked by actual delivery rather than by guesswork about what is running.

The paid half

create_linkedin_ads_campaign_groupcreate_linkedin_ads_campaigncreate_linkedin_ads_creative builds the tree, and everything is born as a draft. set_linkedin_ads_status is the only switch that arms real money and it refuses without an explicit confirmation. One access note that is better said than discovered: LinkedIn meters ad writes by the API tier your own ad account holds — reporting and reads are unrestricted, and on the development tier an app may edit a small number of ad accounts, each registered by hand.

What Gemini CLI cannot do on its own

An agent with a budget is only useful if the blast radius is bounded, so the fence is in the server rather than in a prompt. Every ad campaign, ad set, ad group and ad is created paused, and the status switches that arm real money refuse to run without an explicit confirmation flag. Every render is quoted first — hermoso_capabilities publishes each model’s exact credit cost before anything spends — and credits are reserved before the first provider call and settled at the exact cost afterwards, so a failed dispatch refunds rather than leaving you billed for nothing. Deletes are confirm-gated too, and every campaign tree is read back from the ad platform before your agent tells you what it built.

One step is deliberately not headless: linking an account is an OAuth consent screen, so you connect the channel once in a browser. Everything after that is a tool call.

The rest of the matrix

From Gemini CLI, post to: Facebook · Instagram · Threads · TikTok · YouTube · X · Pinterest · Bluesky · Telegram — or see everything Gemini CLI can publish to.

Post to LinkedIn from: Claude · ChatGPT · Claude Code · Cursor · Codex · Cline · OpenClaw · Grok Bot · Hermes · Perplexity · Le Chat

Frequently asked questions

Can Gemini CLI post to LinkedIn?

Yes, with Hermoso's Gemini CLI extension. Run gemini extensions install https://github.com/hermoso-ai/hermoso, which adds five Hermoso skills that drive the hermoso command, then sign in once with npx -y hermoso auth login. The sign-in opens a browser and stores the credential itself, so there is no key to create and none to paste. If you also want Hermoso's tools in Gemini CLI's own list, gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp adds the hosted server, which signs in with OAuth. Gemini CLI then has 850+ tools, including the ones that publish to LinkedIn — and the ones that research the ads already running in your market and render the creative in the first place.

How do I connect LinkedIn to Gemini CLI?

Two steps, once each. Run gemini extensions install https://github.com/hermoso-ai/hermoso, which adds five Hermoso skills that drive the hermoso command, then sign in once with npx -y hermoso auth login. The sign-in opens a browser and stores the credential itself, so there is no key to create and none to paste. If you also want Hermoso's tools in Gemini CLI's own list, gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp adds the hosted server, which signs in with OAuth. Then connect LinkedIn inside Hermoso under Settings → Connectors, which is an OAuth consent screen in a browser. After that Gemini CLI publishes to LinkedIn as an ordinary tool call.

Does Gemini CLI need my LinkedIn password?

No. You connect LinkedIn to Hermoso once through an OAuth consent screen in a browser, and Gemini CLI then reaches it as a tool call. Linking an account is the one step that is not headless; nothing after it needs a password, and no credential is ever handed to the model.

Can Gemini CLI run LinkedIn ads as well as posting?

Yes. The LinkedIn Ads tree is buildable — campaign group, campaign, creative — and everything is born as a draft, with the status switch confirm-gated. LinkedIn meters ad writes by the API tier your own ad account holds.

Start free — 30 credits at signup and 250+ more to earn, and every feature on every plan. Credits are spent only on AI models and Ad Spy research; posting, scheduling, ads management and analytics are free.

Start free   See pricing