Write and schedule
Drafts posts, gives each platform its own text, and schedules them for any date and time.
Gemini + PostNinja
Give Gemini a social media team. Through the Gemini API, a Gemini agent can use PostNinja's MCP tools to write posts for every platform, schedule them and check how they did. Prefer the terminal? Gemini CLI connects in one command.
Setup
In PostNinja, go to Settings → API and create a key. It starts with pn_ and is shown once, so copy it somewhere safe.
In the Gemini app, add PostNinja as a custom app and sign in. Building your own agent? Pass PostNinja to the Gemini API as an MCP server instead (code below).
https://postninja.app/api/mcpcurl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" -H "Content-Type: application/json" \
-d '{
"agent": "antigravity-preview-09-2026",
"environment": "remote",
"input": "Schedule a post about our launch for tomorrow 9am on X and Threads",
"tools": [{
"type": "mcp_server",
"name": "postninja",
"url": "https://postninja.app/api/mcp",
"headers": { "Authorization": "Bearer pn_YOUR_KEY" }
}]
}'import asyncio, os
from google import genai
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
client = genai.Client()
async def main():
headers = {"Authorization": f"Bearer {os.environ['POSTNINJA_API_KEY']}"}
async with streamablehttp_client("https://postninja.app/api/mcp", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
response = await client.aio.models.generate_content(
model="gemini-flash-latest",
contents="Schedule a post about our launch for tomorrow 9am on X",
config=genai.types.GenerateContentConfig(tools=[session]),
)
print(response.text)
asyncio.run(main())Replace pn_YOUR_KEY with a key from Settings → API.
MCP in the Interactions API is in preview, and the SDK's MCP support is experimental, so details may change.
Custom apps in the Gemini app are for personal Google accounts, 18 and over, in the US, in English, with Keep Activity on.
Gemini finds the PostNinja tools on its own. Try:
Tools
Drafts posts, gives each platform its own text, and schedules them for any date and time.
Builds multi-post X threads and posts photos or videos as Instagram Stories.
Lists upcoming posts, drafts and what went out, with links to the live posts.
Moves, edits or deletes drafts and scheduled posts when plans change.
Uploads images to attach to posts. Larger files and video go through the REST API.
Reads each account's status and error, so it can tell you what didn't go out and why.
Connect your accounts in PostNinja once. From then on Gemini can post to any of them, and PostNinja publishes at the time you set.
FAQ
Yes, as a custom app: Settings → Connected Apps → Custom apps → Add a custom app, then sign in with your PostNinja account. Google currently limits custom apps to personal accounts in the US.
Yes: Gemini CLI connects with one command. See the Gemini CLI setup guide.
That depends on Gemini's own settings; most ask before each tool call. If you'd rather review everything, ask it to save posts as drafts, then schedule them from the PostNinja calendar.
PostNinja only stores a hash of each key and shows its first characters so you can tell keys apart. A key works for one workspace, and you can revoke it any time under Settings → API.
Every account you've connected: X, Instagram, Threads, Facebook Pages, TikTok, YouTube Shorts and Pinterest.
No. They're ordinary posts on your plan. As always, X posts use credits (10 each, 80 with a link) because X charges for every post; other platforms are unlimited.
Connect Gemini to PostNinja in a couple of minutes. Plans from $15 a month.