How to Post to Social Media from the Terminal with opencode
You can post to social media from the terminal with opencode by adding PostAxis as a remote MCP server in opencode.json and running opencode mcp auth postaxis once. After that, opencode can summarise your commits, write posts for X, LinkedIn, Telegram or Threads, and schedule or publish them through PostAxis, whichever model provider you run it with. It is for developers who like open-source tools and want shipping and sharing to happen in the same terminal.
What you can automate with opencode
opencode reads your repo, runs shell commands and calls MCP tools. Pair that with PostAxis and the boring half of a release goes away.
- Commit summaries since the last tag, posted to X at a set time.
- Next-morning release posts on LinkedIn, written while you still remember why the change matters.
- Hotfix notices published right away, plus corrections to posts already in the queue.
- A weekly look-back at what you posted, used to plan the next week without repeating yourself.
- A one-word release step in your Makefile or scripts, using opencode's non-interactive mode.
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.
- opencode installed and set up with a model provider you like.
- The PostAxis API add-on only if you want to authenticate with an API key, for example on a build server.
How to connect opencode to PostAxis (step by step)
It takes about a minute.
-
Create your PostAxis account. Sign up at app.postaxis.io. The trial includes MCP access.
-
Connect your social accounts. Open Accounts in PostAxis and connect Instagram, TikTok, YouTube, X, LinkedIn, Facebook Pages, Threads or Telegram channels. opencode can only post to accounts connected there, and it never sees your social media passwords.
-
Add the server to opencode.json. Use
~/.config/opencode/opencode.jsonfor every project, oropencode.jsonin a project folder for that project only. If the file already has anmcpsection, add just thepostaxisentry.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"postaxis": {
"type": "remote",
"url": "https://postaxis.io/api/mcp"
}
}
}
- Sign in. Run this in your terminal and approve access in the browser window that opens:
opencode mcp auth postaxis
- Check it works. Start opencode in your project and ask a read-only question first:
Which social accounts can you post to?
opencode calls the PostAxis list_accounts tool and lists your profiles. If it does, everything is connected.
5 workflows you can copy
Post the commits since the last tag to X
The classic one. You tagged a release, and the commit log is the raw material.
Run git log from the last tag to HEAD. Ignore chores, merges and
dependency bumps. Summarise the rest as one X post: lead with the most
useful change, keep it under 260 characters, no hashtags. Schedule it
for 17:00 Europe/Warsaw today.
opencode runs git describe and git log itself, writes the post, then calls list_accounts, get_platform_rules and create_post. You get something like: "Scheduled an X post for 17:00 today (226 characters) summarising 6 commits."
Write tomorrow's LinkedIn post tonight
LinkedIn rewards a longer, more personal read than X. Writing it right after the release, while the context is fresh, makes it better.
Write a LinkedIn post about the release we just tagged. Structure: the
problem a customer told us about, what we built, one sentence on how it
works, and a link to the changelog at https://example.com/changelog.
Max 4 short paragraphs. Schedule it for tomorrow 09:00 Europe/Warsaw.
opencode drafts the text and calls create_post with tomorrow's time. LinkedIn allows up to 3,000 characters, so there is space, but short paragraphs read better.
Ship a hotfix notice and correct the queue
A bug made it out, you fixed it, and there is a scheduled post that now says something wrong. Handle both in one go.
We just deployed a fix for CSV exports timing out on large files.
1. Publish a short notice to our Telegram channel now: what broke, that
it's fixed, no action needed.
2. Check my scheduled posts for the next 3 days. If any mention CSV
export, update them so they don't contradict this. Show me the edits
before saving.
opencode calls create_post with publish set to now for Telegram. Then it uses list_posts for the date range, get_post to read each one and update_post for the edits you approve. If a post no longer makes sense at all, ask it to remove it with delete_post.
Look back at the week, then plan the next one
Before planning more content, check what you already said. It is the easiest way to avoid posting the same feature three weeks running.
What did I post this week? List each post with date, networks and the
first line. Then suggest 3 posts for next week on X and Threads that
cover topics I haven't posted about recently, based on the commits from
the last 14 days. Save them as drafts.
opencode calls list_posts with this week's date range, reads the commit history, and saves three drafts with create_post. They sit under Drafts in PostAxis until you schedule them.
Add an "announce" step to your release script
opencode has a non-interactive mode, opencode run, that takes a prompt, runs it and exits. That makes a small Makefile target possible:
# Makefile target body (indent with a tab in a real Makefile)
opencode run "Read the newest entry in CHANGELOG.md. Write an X post and a LinkedIn post about it and schedule both for 17:00 UTC today. Print the post ID."
Run it by hand the first few times and check how your permission settings handle tool calls in this mode; that varies with configuration and version. On a server with no browser for the OAuth sign-in, use a PostAxis API key in an Authorization: Bearer header instead (this needs the API add-on). Recent opencode versions accept a headers object on remote servers; check the opencode docs for the exact shape on yours.
Network limits opencode works within
| Network | Caption limit | Media rules |
|---|---|---|
| X (Twitter) | 280 characters | Text-only allowed; up to 4 images or a video |
| 3,000 characters | Text-only allowed; up to 9 images or a video | |
| Telegram | 4,096 characters (1,024 with media) | Text-only allowed; up to 10 images or a video |
| Threads | 500 characters | Text-only allowed; up to 10 images or a video |
Video has to be MP4 or MOV, 3 to 300 seconds long, with a 16:9, 9:16, 4:3, 3:4 or 1:1 aspect ratio. One video per post, and images and video cannot be mixed.
PostAxis checks every post against these rules before saving. That matters more than usual with opencode, because you might be running a smaller or local model that miscounts characters. Whatever model wrote the caption, an X post over 280 characters is rejected with a clear reason, and opencode can shorten it and try again.
Tips for better posts
- Write your voice into AGENTS.md. opencode reads
AGENTS.mdfor project rules. A short "Social posts" section with audience, tone, banned words and hashtag policy keeps every model you try sounding the same. - Pick a model that writes well for the posting step. opencode lets you switch providers and models. A model that is great at refactoring is not always the best copywriter; try a couple on the same prompt.
- Validate first for anything multi-post. Ask for a validation pass and a table. opencode calls
create_posts_bulkwithvalidate_onlyset to true, which checks everything and saves nothing. Bulk calls hold up to 50 posts and are for scheduling, not publishing now. - Include the timezone. "17:00 Europe/Warsaw" is clear. Without one, the agent uses the timezone it was told or UTC.
- Drafts first when you automate. For scripted runs, ask for drafts until you trust the output, then switch to scheduling.
- Bring your own media. PostAxis does not generate images or video. Give opencode a public URL (it uses
upload_media_from_url) or ask for a one-time upload link for a local file (create_upload_link).
Troubleshooting
opencode cannot reach PostAxis or asks you to authenticate. Run opencode mcp auth postaxis again and approve in the browser. Check that the entry has "type": "remote" and sits inside the mcp section.
401 Unauthorized or "sign in again". The sign-in expired or was revoked. Authenticate again. With an API key, check it is still active under Settings → API keys.
opencode says no accounts are connected. Connect at least one social account under Accounts in PostAxis. If you use several workspaces, tell it which one: "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 opencode to fix it and retry.
Posts were scheduled at the wrong time. Say the timezone in the request, for example "9:00 Europe/Berlin".
FAQ
Can opencode post to social media?
Yes. opencode supports remote MCP servers with OAuth. With PostAxis added, it can draft, schedule, publish, edit and delete posts on Instagram, TikTok, YouTube Shorts, X, LinkedIn, Facebook Pages, Threads and Telegram channels.
Where does opencode.json go?
Use ~/.config/opencode/opencode.json for every project, or opencode.json in a project folder for that project only.
Does it work with any model provider?
The PostAxis connection does not depend on the model. Any model you run in opencode can call the PostAxis tools, though models differ in how well they follow tool instructions and count characters. PostAxis's rule checks catch the mistakes either way.
Does opencode see my social media passwords?
No. You connect social accounts inside PostAxis, and opencode only holds a PostAxis sign-in. Revoke it any time under Settings → API keys → Connected agents.
Is it free?
opencode is open source. 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.
For the short version of the setup, see the opencode agent page. The MCP server reference lists every tool, and the complete guide to AI agents for social media covers safe automation. Trying other terminal agents? Read about Claude Code or automating launch posts with Amp. When you are ready, start your free trial and let your next tag announce itself.
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 →