How-To Guide

How to Post to Twitter
from Claude Code

No browser, no dashboard — just ask Claude. Create, schedule, and manage your entire Twitter presence directly from your terminal using Claude Code and OpenTweet's MCP server.

Set up in 2 minutes • Free 7-day trial

Why Post to Twitter from Claude Code?

Claude Code is Anthropic's official CLI for AI-powered development. It lives in your terminal, understands your codebase, and can use external tools through the Model Context Protocol (MCP). With OpenTweet's MCP server connected, Claude Code becomes your Twitter command center — no context switching required.

Developers lose significant time switching between their IDE, terminal, and social media dashboards. By integrating Twitter directly into Claude Code, you can create a tweet about the feature you just shipped, schedule a thread explaining your architecture decisions, or batch plan a week of content — all without leaving the terminal where you're already working.

The best part? Claude Code understands your code. It can read your git commits, analyze your project structure, and use that context to craft tweets that are technically accurate and genuinely interesting. This makes it the ideal tool for build-in-public content, technical threads, and developer marketing.

Step-by-Step: Tweet from Claude Code

1

Install Claude Code CLI

Claude Code is Anthropic's official CLI for AI-powered development. Install it globally with npm install -g @anthropic-ai/claude-code. Once installed, you can run claude in any terminal to start an interactive session. Claude Code can read your codebase, run commands, and use external tools via MCP (Model Context Protocol) — which is how it connects to OpenTweet.

2

Install OpenTweet MCP Server

Add OpenTweet's MCP server so Claude Code can manage your tweets. The fastest way is to run npx opentweet-mcp in your terminal. Alternatively, add it to your claude_desktop_config.json for persistent access across sessions. The MCP server exposes tools for creating tweets, scheduling posts, managing threads, controlling your evergreen queue, and checking analytics — all accessible through natural language.

3

Get Your OpenTweet API Key

Sign up for OpenTweet (free 7-day trial on all plans) and navigate to the API section in your dashboard to generate an API key. Enter this key when the MCP server prompts you during first setup. Your API key is stored securely and gives Claude Code permission to post on your behalf. You can revoke or rotate the key at any time from your dashboard.

4

Create Your First Tweet

Now the fun part — just talk to Claude. Say something like "schedule a tweet about my latest open source release for tomorrow at 9am" or "create a tweet announcing our new feature." Claude understands context, so it can reference your current project, recent git commits, or anything in your codebase to craft relevant tweets. No special syntax or commands needed.

5

Schedule Threads and Batch Content

Claude Code excels at bulk content creation. Ask it to "create a 5-tweet thread explaining how our authentication system works" or "schedule tweets for every day next week about our product launch." You can batch schedule dozens of posts in a single conversation. Claude will handle the threading, scheduling times, and content variety automatically.

6

Use Analytics and Evergreen Queue

Go beyond posting — manage your entire Twitter strategy from Claude Code. Ask "how did my tweets perform this week?" to check analytics. Say "add my best tweets to the evergreen queue" to set up automatic recycling of top content. You can also manage account settings, check your posting schedule, and review drafts without ever opening a browser.

What You Can Do from Claude Code

Content Creation

  • Create single tweets with natural language
  • Write and schedule multi-tweet threads
  • Batch create a week of content at once
  • Generate build-in-public updates from git history
  • Draft tweets for review before publishing
  • Upload images and media with tweets

Management & Analytics

  • View posting analytics and engagement data
  • Manage your evergreen content queue
  • Check and modify your content calendar
  • Switch between multiple X accounts
  • Review and edit scheduled drafts
  • Find best posting times from your data

Pro Tips for Claude Code + Twitter

Enable Voice Learning

Turn on voice learning in your OpenTweet settings and Claude will generate tweets that match your natural writing style. The system analyzes your past tweets to build a voice profile, ensuring AI-generated content sounds authentically you — not generic or robotic. This works automatically with every tweet created through Claude Code.

Batch Schedule a Week at Once

Instead of creating tweets one at a time, ask Claude to plan and schedule an entire week of content in one conversation. Say "schedule 7 tweets for next week, one per day at 10am, about our product features." Claude will generate varied content and space it out across your calendar, saving you hours of content planning.

Reference Git Commits for Build-in-Public

Claude Code can read your git history. Ask it to "create a tweet about what I built today based on my recent commits." This is incredibly powerful for build-in-public content — Claude translates technical commit messages into engaging tweets that your audience will actually care about, with no manual effort.

Create Technical Threads from Code

Leverage Claude's deep understanding of your codebase to create educational content. Ask it to "write a thread explaining how our rate limiter works" and it will analyze your actual implementation to create an accurate, detailed thread. This turns your code into content marketing that showcases your technical expertise.

Common Mistakes to Avoid

Publishing Without Reviewing

While Claude generates great content, always review before publishing. Use the draft or schedule workflow instead of publish_now so you have a chance to review tweets in your OpenTweet dashboard. AI-generated tweets occasionally need tweaking for tone, accuracy, or brand voice — a quick review catches these before they go live.

Forgetting to Set Your Timezone

If your timezone isn't configured in OpenTweet settings, scheduled tweets may go out at unexpected times. Set your timezone in the OpenTweet dashboard under Settings so that when you tell Claude "schedule for 9am," it means 9am in your local time. This is a one-time setup that prevents constant scheduling confusion.

Ignoring Analytics Feedback

Don't just post and forget. Regularly ask Claude "which of my recent tweets performed best?" and use those insights to inform future content. The analytics tools in OpenTweet track impressions, engagement, and more. Let the data guide your content strategy rather than guessing what your audience wants.

Over-Automating Without Personality

It's tempting to fully automate your Twitter with AI, but audiences engage with authenticity. Mix AI-generated scheduled content with personal, in-the-moment tweets. Use Claude Code for the bulk of your content planning, but don't let it replace the spontaneous, human side of your Twitter presence entirely.

Frequently Asked Questions

How do I set up the OpenTweet MCP server with Claude Code?

Run 'npx opentweet-mcp' in your terminal to start the MCP server, or add it to your claude_desktop_config.json for persistent access. You'll need your OpenTweet API key, which you can generate from the OpenTweet dashboard after signing up.

How much does it cost to tweet from Claude Code?

OpenTweet plans start at $11.99/month for Pro, which includes API access and MCP server support. All plans include a 7-day free trial. Claude Code itself requires an Anthropic API key or Claude Max subscription.

Can I manage multiple X accounts from Claude Code?

Yes. OpenTweet supports multiple X accounts on Advanced and Agency plans. When creating tweets through Claude Code, you can specify which account to post from using the x_account_id parameter. Claude will remember your preference within a conversation.

Does voice learning work with Claude Code?

Yes. If you enable voice learning in your OpenTweet settings, all tweets generated through Claude Code will match your writing style. OpenTweet analyzes your past tweets to build a voice profile, and this profile is automatically applied when generating content via the MCP server.

Which AI models work with the MCP server?

The OpenTweet MCP server works with any AI tool that supports the Model Context Protocol. This includes Claude Code (Anthropic's CLI), Claude Desktop, Cursor, Windsurf, and other MCP-compatible clients. The MCP server itself is model-agnostic — it provides tools that any connected AI can use.

Can I tweet from Claude Code while offline?

No. Claude Code requires an internet connection to communicate with both Anthropic's API and the OpenTweet MCP server. However, you can draft tweets as text files locally and then ask Claude to schedule them all at once when you're back online.

Start Tweeting from Claude Code

Set up in 2 minutes. Free 7-day trial. No browser needed.