The AI Loadout

How to post on X with an AI agent

Connect your agent to the X API through xmcp, the official X MCP server, then ask it to draft posts and only publish after you approve. Claude Code, Codex and Cursor all add it as an MCP server. Grok Bot connects to your X account directly and asks before it posts anything.

Checked against official docs on Oct 26, 2026.

Get the free starter kit. One short email a day when our setups change.

Free starter kit on signup: 2 Claude Code skills and 1 agent persona from our paid packs. By subscribing you agree to get The AI Loadout Daily, one email each morning. No spam, we never sell your email, and every email has a one-click unsubscribe link.

Claude Code

  1. git clone https://github.com/xdevplatform/xmcp && cd xmcp
  2. python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
  3. Put X_OAUTH_CONSUMER_KEY and X_OAUTH_CONSUMER_SECRET from your X developer app in .env, plus X_API_TOOL_ALLOWLIST=getUsersByUsername,createPosts,searchPostsRecent
  4. python server.py (serves http://127.0.0.1:8000/mcp by default)
  5. claude mcp add --transport http xmcp http://127.0.0.1:8000/mcp
  6. Ask: "Draft 3 posts about today's release. Show them to me. Do not call createPosts until I say which one."

Codex

  1. Start xmcp the same way (python server.py)
  2. codex mcp add xmcp --url http://127.0.0.1:8000/mcp
  3. codex mcp list to confirm it is connected
  4. Ask Codex to draft first and post only after you approve

Cursor

  1. Start xmcp the same way (python server.py)
  2. Add to .cursor/mcp.json: {"mcpServers":{"xmcp":{"url":"http://127.0.0.1:8000/mcp"}}}
  3. Cursor asks for approval before each MCP tool call by default, so leave that on for createPosts

Grok Bot

  1. Connect your X account to Grok Bot
  2. Ask: "Draft a post about X. Do not post it."
  3. Edit the draft, then tell Grok Bot to post it. Posting is a sensitive action, so it asks you first

Gotchas

  • Posting through the X API needs a developer account and app. Check X's current API pricing before you build on it.
  • Keep X_API_TOOL_ALLOWLIST short. Every tool you load is one more thing the agent can call.
  • Never let an agent auto-reply or auto-follow at scale. That breaks X's automation rules.

The loadout for this job

FAQ

Can an AI agent post on X for me?

Yes, through the X API. xmcp is X's own MCP server for it. Keep a human approval step before anything goes live.

Is there an official X MCP server?

Yes. xdevplatform/xmcp on GitHub runs locally and exposes X API endpoints as MCP tools.

Related how-tos

Sources

Commands change. Check the linked docs before you run anything. All how-to guides