If you want to learn how to build a social media agent with Claude Code, the shortest honest answer is this: give Claude Code a real tool surface, write down your rules, then test it on one post before you let it near a calendar. Creator OS ships a hosted MCP server and a CLI so an AI agent can run your accounts: Instagram, TikTok, YouTube, X, LinkedIn, Facebook, Threads, plus Skool and a WordPress blog. This guide builds that loop from scratch.
You (CLAUDE.md rules)
|
v
Claude Code ---> Creator OS MCP server
| (mcp.creatoros.ca/mcp)
| |
| +--> accounts, posts, media
| +--> comments, DMs, analytics
| +--> Skool, blog, ads
v
Skills: post-shortform, schedule-posts, analytics
|
v
Real post on a real account
What a Claude Code Social Media Agent Can Actually Do
An agent is not a chatbot with a publishing button. It is a loop: read state, decide, call a tool, read the result, decide again. Claude Code gives you the loop. Creator OS gives you the tools.
Concretely, the tools exposed over MCP include names like create_post, update_post, upload_media_from_url, list_posts, get_post, get_post_analytics, get_daily_metrics, get_best_time_to_post, get_follower_stats, list_comments, reply_to_comment, list_conversations, send_message, check_caption_length, skool_multi_post, blog_create_article, ads_create_ad, and skills_list. That is a full working surface. You are not writing 30 wrappers around six platform APIs; you are writing rules and prompts.
Two design choices matter more than the prompt. First, destructive tools like delete post, delete comment, disconnect account, and delete ad are marked so the AI app asks before running them. Second, an API key is pinned to one workspace, one set of socials. An agent holding workspace A’s key cannot post to workspace B. That is the safety story you want before an autonomous loop touches a live account.
Prerequisites: Claude Code, a Social API, and One Test Account
You need three things.
- Claude Code installed and logged in. It works with current Claude models such as Claude Opus 5.5, Claude Sonnet 5, Claude Haiku 4.5 and Claude Fable 5.1, but Creator OS itself does not ship a model. It is a tool layer.
- A Creator OS workspace with one or two connected accounts. Start small. One Instagram, or one X account, is enough for a first build.
- An API key that starts with
cos_live_. Keys, the MCP server, the CLI and the agent skills are included in every plan, including the $19.99/month Creator plan.
Do not start with five platforms. Every platform has its own rules and its own failure modes, and you want to see those failures on a test account, not on your main brand.
If you have already added Creator OS as a custom connector in the Claude desktop app, you have done half of step 2 already. The custom connector walkthrough covers that path. This post assumes the command line instead.
Step 1: Create the Agent Project and CLAUDE.md Rules
Make a folder. Add a CLAUDE.md file. Claude Code reads it on every session, so it becomes the agent’s standing instructions.
mkdir social-agent && cd social-agent
# create CLAUDE.md, then write rules like:
# Brand
Voice: plain, specific, no hype words.
Never use em dashes.
Links go in firstComment on Instagram, not the caption.
# Guardrails
Never publish without showing me the caption and the account list.
Never run a delete tool without asking.
Cap: 3 posts per day across all accounts.
Always call check_caption_length before create_post.
Timezone for all scheduling: America/Toronto.
# Workflow
Draft in list_posts with draft: true first.
Only promote a draft to scheduled after I reply "go".
Two rules in that file do most of the work. The “show me the caption and the account list” rule turns every publish into a review. The “draft first” rule means the agent can be aggressive without being dangerous. If you want a deeper version of this pattern, the skills post goes through how skills and rules interact.
Install the Creator OS skills at the same time:
npx @creatoros/cli@latest init
That installs 14 Claude Code skills, including post-everywhere, post-shortform, post-longform, post-threads, schedule-posts, respond-to-comments, respond-to-dms, automations, analytics, ads, skool and blog. Later, creatoros sync updates them without overwriting files you have edited.
Step 2: Connect Claude Code to Your Social Accounts
One command. The server is hosted, so there is nothing to install or run locally.
claude mcp add --transport http creatoros https://mcp.creatoros.ca/mcp \
--header "Authorization: Bearer cos_live_..."
Then verify the connection from inside Claude Code by asking it to list your accounts. Behind that request is a real call to accounts:list, and you should see the platforms you connected in the web app.
While you are there, confirm the workspace boundary:
creatoros auth:check
creatoros accounts:list
creatoros accounts:health
accounts:health is the one people skip. A token that expired three weeks ago produces confusing errors later in the loop, and it is much easier to spot now. The same hosted server works from Cursor, Windsurf, VS Code and ChatGPT in developer mode. If you want the connector settings for each app, see the MCP server post, and the raw details live at creatoros.ca/docs/mcp.
One more thing worth knowing before you write the loop: read-only connections only see read tools, and the API refuses writes from them. If you want a research-only agent that drafts but cannot publish, that is a configuration choice, not a code change.
Step 3: Give the Agent Skills for Drafting, Scheduling, and Reporting
Skills are reusable instructions. Rather than pasting a prompt every session, you save the procedure once and let Claude Code load it when relevant. Start with three.
Drafting
Write a skill that takes a topic and produces a caption per platform. The agent should call check_caption_length against each platform before it shows you the draft, because limits are not uniform. Threads is 500 characters per post. A YouTube title is 100 characters. TikTok descriptions go to 4,000.
Scheduling
Ask the agent for get_best_time_to_post per platform, then create the post with a real timestamp:
creatoros posts:create \
--text "Draft caption here" \
--platforms instagram,threads \
--media https://example.com/clip.mp4 \
--scheduledAt 2026-03-04T14:30:00Z \
--timezone America/Toronto \
--draft
Note the --draft flag. The post exists, you can see it, and nothing has gone out. That is the difference between a demo and a system you can leave running.
Reporting
End every session with a short report built from real numbers, not vibes:
creatoros analytics:daily --from 2026-02-01 --to 2026-03-01
creatoros analytics:posts --sortBy engagement --limit 10
creatoros accounts:follower-stats --granularity weekly
If the agent starts inventing engagement numbers, it is reading the wrong source. Point it at get_post_analytics and get_daily_metrics and nothing else.
Step 4: Build the Tool Loop That Publishes Safely
This is the part that separates a toy from an agent. The loop should be: plan, draft, validate, ask, publish, verify, report.
- Plan. The agent reads
list_postsand the calendar, then proposes a short list of posts. - Draft. It creates each one with the draft flag set. No exceptions in week one.
- Validate. It checks caption length per platform and validates media with
validate:media --urlbefore upload. Uploading once and reusing the returnedmed_id across platforms saves time and avoids duplicate uploads. - Ask. It prints the caption, the target accounts and the scheduled time, and waits. Your
CLAUDE.mdrule handles this. - Publish. It schedules or publishes. If a network in the post is not connected, the API returns it in
missing_platformsand the rest still go out. Decide in advance whether that is acceptable for your agent. - Verify. It calls
posts:geton the new post id and confirms the state. - Report. It writes a two-line summary with the post id and the scheduled time.
Two failure behaviors to build in early. First, treat errors as one shape: { error: { code, message, status } }. Your loop should read code, not the message text. Second, on a failed publish, call creatoros posts:retry <postId> once before escalating to you.
Webhooks close the loop on the way back. Subscribe to post.published and comment.received, and the payload is signed with X-CreatorOS-Signature, so you can trust it.
creatoros webhooks:create --url https://yoursite.com/hooks/creatoros \
--events post.published,comment.received
If you want the agent to react to your own content, the WordPress blog integration is the natural next step: connect the site, let blog_create_article write drafts, and let the agent turn a published article into a short-form post a few hours later.
Step 5: Test the Agent on One Real Post End to End
Pick one platform. Instagram is a good first choice because it has the most interesting constraints.
Ask the agent to publish a Reel. Watch what it does. A well-built loop will:
- Upload the video once with
media:uploadand reuse themed_id. - Set a custom cover using a media id or a frame timestamp.
- Put the link in
firstCommentinstead of the caption, because Instagram captions have no clickable links. - Leave the audio alone, since trending audio cannot be attached through the API and has to be baked into the file.
Then reply to a comment on that post from the same session, using inbox:comments and inbox:reply. Comment replies work on Instagram, Facebook, X, Threads, YouTube and LinkedIn. They do not work on TikTok. DMs work on Instagram, Facebook and X. Knowing which of the three groups you are in prevents a lot of confused debugging.
Once the single-platform loop is boring, the open-source Social Agents harness is the shortcut to a multi-platform version. Start it with npm start creatoros social-agents. It interviews you about your brand, then posts, replies to comments and DMs, runs automations and reports, with a local dashboard. Bring your own model: a logged-in Claude Code session, an Anthropic API key, or any Anthropic-compatible API. Watch the walkthroughs on the KevBuildsApps YouTube channel if you prefer to see the loop running before you build it.
Common Errors When Building a Social Media Agent With Claude Code
The agent publishes without asking. Your CLAUDE.md rule is missing, or the connection was created as read and write and the model is confident. Add the review rule and keep drafts on.
It hallucinates a base URL. This one wastes an afternoon. Do not hardcode an assumed host. Send the agent to creatoros.ca/docs for the REST API base URL and request shapes. Anything you guess will be wrong.
One failing platform kills the whole post. It should not. Unconnected networks come back in missing_platforms and the rest of the post still publishes. Log it and move on.
Token mistakes between workspaces. A key is pinned to one workspace. If posts land on the wrong brand, you are running two keys in one session.
The agent treats every tool as safe. Destructive tools are marked so the AI app asks first, but only if your loop respects that. Never let a model call a delete tool in the same breath as a publish.
Captions fail on one platform after passing on another. Length rules differ. Validate per platform, before scheduling.
For the REST layer underneath all of this, including typed ids like acc_, post_, cmt_ and med_, the social media API for AI agents post is the companion read. If you came here from the broader MCP conversation, adding social media to Claude with MCP covers the connector-first route.
One last habit: when the loop works, write down what it did. The exact commands, the exact failure, the exact fix. Your second agent will be built from those notes, not from scratch.
Get Started With Creator OS
Create a workspace, connect one account, generate an API key, and run the claude mcp add line from step 2. That is the whole setup. The Creator plan is $19.99/month or $59.99/year and includes up to 8 connected accounts, seven socials plus Skool. API keys, the MCP server, the CLI and the agent skills are included on every plan.
Sign up at creatoros.ca/sign-up, then read the CLI docs for the full command list. Build the loop on one account first. Everything else is repetition.