Post to X From Claude Code With Kalen
To post to X from Claude Code, add Kalen as a remote MCP server with one claude mcp add command and your Kalen key. Connect your X account through X’s own sign-in, then ask Claude Code to plan your posts. Kalen gives it a briefing on your niche and your open slots, scores the drafts it writes, and schedules them after you approve. Posts go out through the official X API at their times, whether your terminal is open or not.
Why post from the terminal?
If you spend the day in Claude Code, switching to a browser to write posts is the moment the habit breaks. You just shipped something worth posting about, the context is right there in the repo, and the X tab is one more thing to open. Posting from where you work means the update about today’s release gets written while you still remember the details, because the changelog and the code are right there. What an X MCP server does explains how the pieces connect.
What you need
- A Kalen account at kalen.si.
- Claude Code installed.
- An X account.
- A plan to schedule posts; without one you can still connect X, set your profile and score drafts. See the plans.
Step 1: Create a key
Sign in to Kalen and open the Connect page in your account. Create a key; it starts with kln_live_. Copy it now: Kalen shows it only once. You can create one key per machine and revoke any of them later.
Step 2: Add Kalen to Claude Code
Run once:
claude mcp add --transport http kalen https://kalen.si/mcp --header "Authorization: Bearer kln_live_…"
Paste your key in place of kln_live_…. Start a new Claude Code session so it picks up the server. Running /mcp inside Claude Code lists connected servers; Kalen should be there.
Step 3: Connect X and set your profile
In Claude Code, ask:
Set up Kalen: my niche is [your niche]. Connect my X account, then suggest keywords and reference accounts.
Claude Code gives you a link to X’s own sign-in screen. Open it in your browser and approve; Kalen never sees your X password. Then Claude Code saves your profile with Kalen: niche and up to 8 keywords, up to 10 reference accounts, your time zone, a posting window and a note on your tone.
Step 4: Plan your first week
Ask:
Plan my X posts for next week with Kalen.
What happens next:
- Claude Code calls Kalen for a briefing: today’s top posts in your niche, trends, your reference accounts’ best posts, your own best posts, and patterns such as typical length and format mix.
- It asks for your open slots across the week, spread through your posting window.
- It writes the drafts. No writing model runs on Kalen’s side; Claude does the writing.
- Kalen scores each draft from 0 to 100. Drafts below the pass mark come back with a reason, and Claude rewrites them, up to three rounds.
- Claude shows you the week. Change anything you want.
- When you say yes, Kalen schedules the posts. Nothing is scheduled without that confirmation.
Step 5: Post about what you just shipped
The terminal advantage is context. After a release, try:
Read the changelog for today’s release and write two X posts about it with Kalen: one how-to, one build update. Put the docs link in a first reply. Schedule them for this afternoon.
Kalen’s “moment” posts, the ones tied to today, can be scheduled within the next 48 hours. Links go in the first reply when you add one, and count toward your daily link posts. Putting your link in the first reply explains why that’s often the better shape.
Useful requests
| You ask | What Kalen does |
|---|---|
| “What’s scheduled this week?” | Lists your queue by day |
| “Move Thursday’s 10:00 post to Friday” | Updates the slot |
| “Cancel the post about pricing” | Asks you to confirm, then cancels |
| “What’s working in my niche today?” | Returns today’s briefing |
| “Score these three drafts” | Scores and gives a reason for each |
| “How many link posts do I have left today?” | Shows plan usage |
Rules to know
Kalen checks every post on his side before it’s queued: 280 characters as X counts them, with links as 23 (X’s character limit); no @mentions of other accounts, since X restricts automated mentions; one cashtag at most; up to 21 days ahead; and images or video within the size limits (JPG, PNG, WebP 5 MB; GIF 15 MB; MP4 50 MB).
Using Cursor or VS Code instead?
The same key works there. Add this to ~/.cursor/mcp.json or .vscode/mcp.json:
{ "mcpServers": { "kalen": { "url": "https://kalen.si/mcp", "headers": { "Authorization": "Bearer kln_live_…" } } } }
Claude.ai and ChatGPT connect with a sign-in instead of a key. All of it is in connect Kalen to Claude, ChatGPT and Cursor.
If you rarely post, or you prefer writing in the X app, skip this setup: there’s no free plan that posts, because X charges per post. It pays off when you post most days and already live in the terminal.
FAQ
Does my terminal need to stay open for posts to go out?
No. Kalen publishes from his own servers at each scheduled time.
Can Claude Code post immediately?
Kalen schedules posts at least a few minutes ahead. Ask for the next open slot.
Is my key safe in Claude Code’s config?
Treat it like a password. Kalen stores only a digest of it, and you can revoke a key from the Connect page at any time.
Can I use it in several repos?
Yes. Add --scope user to the claude mcp add command and Kalen is available in every project.
Start now
Start now: create your key on the Connect page and run the command above.