Automate Social Media Posting and Scheduling With Claude Code (and Any AI Agent)
I just told Claude Code "post HI from postpeer on my twitter" and it did. No copy-paste, no dashboard, no OAuth dance. One sentence in the terminal and the tweet was live.
The whole thing took about three seconds, most of which was the network round-trip. Here's how the setup works, and how to do the same thing whether you're using Claude Code, the Claude API directly, or any other AI agent framework.
What's actually happening
PostPeer ships an MCP server. MCP (Model Context Protocol) is the standard Anthropic introduced to let agents call external tools. When you register PostPeer's MCP with Claude Code, Claude gets two new tools:
mcp__postpeer_mcp_api__executeruns TypeScript against the PostPeer SDK in a sandboxmcp__postpeer_mcp_api__search_docssearches the SDK docs
That's it. From Claude's perspective, it now knows how to post to social media. From your perspective, you can talk to your terminal and your accounts get updated.
Step 1: Install the MCP
Grab an API key from the PostPeer dashboard. Then run:
claude mcp add postpeer_mcp_api \
--env POSTPEER_API_KEY="your-api-key-here" \
-- npx -y postpeer-mcpThat's the entire install. Claude Code will spin the MCP up on the next session. If you're not on Claude Code, you can wire the same npx command into Cursor, Zed, or any MCP-compatible client.
Step 2: Connect your social accounts
The MCP can post anywhere PostPeer can post, but it needs an account to post as. Connect your Twitter, LinkedIn, Instagram, TikTok, YouTube, Pinterest, or Bluesky in the integrations dashboard. One OAuth click per platform.
Once they're connected, you can ask Claude to list them:
"List my connected social accounts"
Claude will run client.connect.integrations.list() under the hood and show you each account with its id, platform, and display name. Those IDs are what the publish endpoint needs.
Step 3: Post by talking
Here's the actual prompt I used:
"post HI from postpeer on my twitter"
Claude figured out which account ID to use from the integrations list, called client.posts.create() with publishNow: true, and returned the post URL. The TypeScript it ran looked like this:
async function run(client) {
const res = await client.posts.create({
content: "HI from postpeer",
publishNow: true,
platforms: [{ accountId: "69da6882322e75b602ad2916", platform: "twitter" }],
});
return res;
}Same code structure works for every platform. Swap twitter for linkedin, instagram, tiktok, youtube, pinterest, or bluesky.
Step 4: Schedule instead of post now
Want it to go out tomorrow at 9am? Just say so:
"Schedule a tweet for tomorrow at 9am ET that says 'shipping new features today'"
Claude swaps publishNow: true for scheduledFor and timezone:
const res = await client.posts.create({
content: "shipping new features today",
scheduledFor: "2026-05-02T09:00:00",
timezone: "America/New_York",
platforms: [{ accountId: "<id>", platform: "twitter" }],
});PostPeer queues it and delivers at the exact time. You can see all scheduled posts in the posts dashboard.
Step 5: Cross-post in one shot
Here is where it gets fun. Tell Claude:
"Post 'we just hit 10k users 馃帀' to my Twitter, LinkedIn, and Bluesky right now"
One API call goes to PostPeer, PostPeer fans out to all three platforms, and Claude reports back with three live URLs. The agent doesn't have to know any platform-specific details. Character limits, OAuth scopes, media formats. PostPeer normalizes all of that.
Going beyond Claude Code
The MCP is the easy path, but PostPeer is a plain REST API underneath. Any agent framework can use it.
If you're using the Anthropic SDK with tool use, define a post_to_social tool that wraps the PostPeer endpoint and let Claude call it directly. Same idea as the MCP, just hosted in your own code.
OpenAI function calling works the same way. Define a function with the same shape and pass it to GPT. The PostPeer call is identical regardless of which model is on the other end.
LangChain, LangGraph, and CrewAI all support custom tools. Add PostPeer as one. The endpoint is POST https://api.postpeer.dev/v1/posts with an x-access-key header.
For no-code workflows, n8n, Zapier, and Make can hit PostPeer as a webhook node. Trigger from RSS, Google Sheets, a database, or wherever your content lives.
And if you're writing your own service in Node, Python, or Go, it's just HTTP. There's a TypeScript SDK if you want types.
The MCP isn't magic. It's a thin wrapper over the REST API that gives Claude Code a built-in way to use it. If you're building something more custom, skip the MCP and call the API directly.
A more interesting example: the daily content agent
Here's what I actually do with this. A scheduled Claude Code task runs every morning. Its prompt is roughly:
"Look at our changelog from yesterday and our top GitHub issues. Write 3 tweets and 1 LinkedIn post about anything notable. Schedule them across the day."
The agent reads the changelog, drafts the content, picks reasonable posting times, and calls PostPeer. I get an email summary, review what's queued, and either let it ship or tweak it in the dashboard. I wrote about an earlier version of this setup if you want the full story.
The pattern generalizes to anything text-shaped. Release notes, support themes, analytics highlights, weekly wrap-ups. Anything you'd be willing to post manually if you had time, an agent can post for you.
Caveats worth knowing
A few things I learned the hard way.
Always have the agent confirm before posting to production accounts, especially during initial setup. Get it to show you what it's about to post first, then publish.
Scheduled posts are easier to review than immediate ones. Schedule for an hour out, check the dashboard, cancel if anything's off.
Watch your credit usage. Each post is 1 credit, and an over-eager agent can burn through your quota fast. The free tier is 20 posts a month, paid plans go higher.
Media is async. If you want the agent to post images, upload them via client.media.upload() first, then attach the returned URL to the post.
Try it
Grab an API key, run the claude mcp add command above, and tell Claude Code to post something. If you want a deeper look at the agent-side patterns, the Social Media API for AI Agents page has the relevant SDK examples, and the Social Media API for Claude Code page covers the MCP setup in more detail.
MCP install, connect an account, post. About five minutes from a cold start. The real work is figuring out what you want your agent to actually say.