Post to social media from Claude Code
Post to LinkedIn, X and Bluesky from Claude Code.
One `claude mcp add` command and Claude Code can draft from your repo, dry run against each network's rules, and publish when you say so.
The short answer · Updated Nov 1, 2026
To post to social media from Claude Code, add SocialsForAI's MCP server with claude mcp add --transport http socials https://socialsforai.vercel.app/api/mcp --header "Authorization: Bearer $SOCIALS_API_KEY". Claude Code then has tools to list accounts, create a connect link, dry run and publish posts, and check each account's result. You connect accounts once from a link; the agent never sees passwords or tokens.
What Claude Code is
Anthropic describes Claude Code as "an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools," available in the terminal, IDEs, a desktop app and the browser. It connects to external tools over MCP, and its docs say MCP servers configured once work across those surfaces.
That makes it a good fit for posting that starts from code: release notes from a changelog, a launch post from a merged PR, a weekly summary from commit history. The repo is already in context, so the draft is grounded in what shipped.
Setup command
Claude Code's MCP docs give the form claude mcp add --transport http <name> <url> for remote servers, with --header for a bearer token. Export the key, then run:
Scope matters. The default local scope keeps the server to you in this project, stored in ~/.claude.json. --scope user loads it in all your projects. --scope project writes .mcp.json in the project root to share through version control, so don't use it with a raw key. Check the connection with claude mcp list, or /mcp inside a session.
export SOCIALS_API_KEY=sk_...
claude mcp add --transport http socials https://socialsforai.vercel.app/api/mcp \
--header "Authorization: Bearer $SOCIALS_API_KEY"
claude mcp listHow the tools show up in Claude Code
Claude Code names MCP tools mcp__<server>__<tool>, so with the server called socials you'll see mcp__socials__list_accounts, mcp__socials__create_post, mcp__socials__get_post and five more. Those full names are what permission rules match on. You rarely type them: Claude reads each tool's description when the server connects and picks the right one from a plain request. The inputs for all eight are on the hub under every tool and its inputs.
Three prompts to start with
Each prompt below lists the tool calls Claude Code will make. Claude reads tool descriptions, so you don't have to name tools yourself.
- "Read CHANGELOG.md, draft a release post for LinkedIn and a shorter one for X and Bluesky, dry run all three, and show me the previews." Calls
list_accounts, thencreate_postwithdry_run: true, the long text intextand short versions inplatform_options.x.textandplatform_options.bluesky.text. After your yes, the same call withoutdry_runand with anidempotency_key. - "Schedule that post for Tuesday at 9am Pacific, then show me what's scheduled." Calls
create_postwithscheduled_at: "2026-11-03T09:00:00-08:00", thenlist_postswithstatus: "scheduled". If you change your mind,cancel_postworks until it starts publishing. - "Connect my Bluesky account." Calls
create_connect_linkwithplatforms: ["bluesky"]and prints the URL. Open it, enter your handle and an app password, then ask Claude to list accounts again.
What the release-post dry run looks like
This is the first prompt's dry run, from the repo's changelog to three previews. One create_post call carries the long LinkedIn text in text and the two short versions in platform_options, so each network gets its own wording from a single request and a single idempotency key. The preview is what Claude shows you before asking to publish. Ids are illustrative.
If one version is over its limit, ok is false and the issue names the field to change, for example platform_options.x.text. Claude can edit that string and dry run again without touching the other two. All three networks are live on the hosted server, so this runs as written once each account is connected.
// Claude Code, after reading CHANGELOG.md
mcp__socials__create_post({
"accounts": ["acc_Li4nKd8Qp2Zr7TmX", "acc_x7Qm2pLr9sTn4VwB", "acc_Bs2rTq8Lm5Wn1KdP"],
"text": "v2.4 is out. Webhooks now retry for 24 hours, ...",
"platform_options": {
"x": { "text": "v2.4: webhooks retry for 24h, signed payloads." },
"bluesky": { "text": "v2.4 is out: webhooks retry for 24 hours. Notes: https://example.com/changelog" }
},
"dry_run": true
})
→ { "object": "preflight", "ok": true, "issues": [],
"preview": [ { "platform": "linkedin", "text": "v2.4 is out. ..." },
{ "platform": "x", "text": "v2.4: webhooks retry for 24h, signed payloads." },
{ "platform": "bluesky", "text": "v2.4 is out: webhooks retry for 24 hours. ..." } ] }Approval with Claude Code permission rules
In Claude Code, permission rules decide whether a tool call prompts you. Don't add an allow rule for mcp__socials__create_post, so every publish asks first. Allowing the read-only tools (mcp__socials__list_accounts, mcp__socials__get_post, mcp__socials__list_posts) is reasonable. You can also put the review rule in CLAUDE.md: "Always dry run social posts and wait for my approval." The server-side controls that back this up, from dry runs to per-account caps, are listed under keeping a human in the loop.
Fixing Claude Code connection problems
Most failures in Claude Code happen before any tool runs. Errors that come back from a tool call, such as preflight_failed or account_needs_reauth, carry a fix field, and the full error list explains each code.
claude mcp listshows the server as failed or needing authentication: the header didn't arrive. Remove and re-add it withclaude mcp remove socials, making sure$SOCIALS_API_KEYis set in that shell.- The header was empty from the start. Your shell expands
$SOCIALS_API_KEYwhen you runclaude mcp add, so if the variable wasn't exported yet, the stored header isBearerwith nothing after it and every connection gets a 401. - The tools exist in one project but not another: the server was added at the default
localscope, which belongs to that project. Re-add it with--scope userto have it everywhere. - A teammate cloned the repo and has no server: only
--scope projectwrites anything into the repo (.mcp.json), and you shouldn't use it with a raw key. Each person runs the add command with their own key.
Set up Claude Code in four steps
- 01
Export a key in your shell
Sign up or call POST /v1/workspaces, then export SOCIALS_API_KEY=sk_... in the terminal you'll run Claude Code from.
- 02
Add the server
Run claude mcp add --transport http socials https://socialsforai.vercel.app/api/mcp --header "Authorization: Bearer $SOCIALS_API_KEY". Add --scope user to use it in every project.
- 03
Confirm with claude mcp list
The socials entry should show as connected. Inside a session, /mcp shows the same thing.
- 04
Connect an account from the session
Ask Claude to connect your Bluesky account. It prints a connect link; open it in a browser, finish there, and ask Claude to list accounts again.
Questions
What developers ask
Can I post to LinkedIn from Claude Code?
Yes. LinkedIn is live on our hosted server for personal profiles; Company Pages aren't supported. X, Bluesky, Mastodon and Telegram work too.
Does Claude Code see my social media passwords?
No. You connect accounts on the network's own OAuth screen, or with a Bluesky app password, Mastodon access token or Telegram bot token, from a connect link. Claude Code only sees account ids.
Should I use project scope so my team shares the server?
Project scope writes .mcp.json, which is meant to be committed. Share the server config without the key, and have each person add their key at local or user scope.
Does this work in Claude Code on the web or the desktop app?
Claude Code's docs say MCP servers work across its surfaces. The server is remote over HTTP, so nothing has to run on your machine.
Can Claude Code post on a schedule?
Yes. It passes scheduled_at, up to 365 days ahead, and we hold the post. No cron job or open session is needed.
What is the tool name for posting in Claude Code?
mcp__socials__create_post, if you named the server socials. That's the name to leave out of your allow rules so each publish prompts you.
Keep reading
Get an API key and send your first post in five minutes.