You can connect X (Twitter) to Claude using the Model Context Protocol (MCP), and once it’s connected, Claude can search X for a topic or post on your behalf without you opening the app yourself. This guide covers what X’s official MCP server does, both ways to connect it — directly or through a gateway — and why this one deserves a different kind of caution than most servers in this series: it’s the first one where the tool call lands in public, under your name, the moment it runs.
What the X MCP server actually does
X publishes an official remote MCP server at api.x.com/mcp. It exposes posting and search as tools Claude can call directly, so prompts like these work against your real account instead of you copying and pasting:
- “Search X for what people are saying about the release today.”
- “Post this update to my account.”
- “Find my last few posts about the launch.”
- “Draft a reply to this thread and post it.”
Claude acts through your actual X account for anything it posts — it isn’t a staging area or a preview. A post tool call is a real post, visible the moment it runs, the same as if you’d typed it into the compose box and hit send.
The catch: the connect path isn’t one-click OAuth
Most of the servers in gate’s directory — Notion, Airtable, Linear — let any AI client register itself and walk through a standard OAuth consent screen. X’s endpoint doesn’t currently support that automatic handshake: there’s no RFC 9728 protected-resource metadata for a client to auto-discover, so instead of a client self-registering and sending you to an “Allow” screen, you connect with a bearer token you obtain out-of-band from your X developer account and paste in yourself.
That’s a similar shape to connecting GitHub to Claude, where a personal access token stands in for one-click sign-in. It’s a different gap than the one covered in the unauthorized client error, though — that post is about a vendor allow-listing which clients can OAuth in at all. Here, the issue is simpler: the discovery step a client would normally use to find the OAuth endpoints automatically isn’t published, so a token is the reliable path today regardless of which client you’re using.
Option 1: Connect X to Claude directly
The short version of the setup:
- Generate a bearer token for your X account from your developer settings.
- Open Claude’s connector or MCP settings and add a remote server pointing at X’s MCP endpoint.
- Paste in the token when prompted for credentials, instead of an OAuth sign-in screen.
That’s workable if Claude is the only AI client you’re giving posting access to. The tradeoff shows up once you add a second client — Cursor for a quick search, ChatGPT for drafting replies — or hand the same account to a teammate: each one needs its own copy of the same token, and rotating it means updating every place it was pasted.
Option 2: Connect it once, through a gateway
If you’re already connecting more than one MCP server or using more than one AI client, wiring each pair directly gets old fast — the connection sprawl covered in what an MCP gateway is. The idea is to connect X (and everything else) to one gateway URL, then point every AI client at that single URL instead of reconfiguring each one and re-pasting the token per client.
With gate specifically, connecting X looks like this: add gate’s gateway URL to Claude once, then pick X from the X server page in the directory and paste in your token there instead of in each client separately. From then on, posting and search are available in every client connected to your gate URL, and the token lives in one place instead of scattered across config files. See the full list of servers on the MCP servers page.
What to check before you let it post
Every other server in this series risks a bad read or an accidental edit somewhere private — a file, a board, a database row. A posting tool on a social account is different: the moment it runs, the output is public, attributed to you, and effectively permanent in practice, since deleting a post doesn’t undo a screenshot. A few things worth checking before or right after you connect:
- Does it post without confirming first? Some AI clients ask before a write-capable tool runs; some don’t by default. Know which mode you’re in before you ask Claude to “draft and post” in the same breath — see human-in-the-loop approvals for AI tool calls for the patterns that make that confirmation step actually work instead of becoming a button nobody reads.
- What content is it reading before it posts? If Claude searches X, reads a thread, and then drafts a reply, that thread’s text is untrusted input the same way a scraped webpage is — a post crafted to steer what an AI replies with isn’t a hypothetical. See the confused deputy problem in MCP for why a fully authorized tool call can still do something you didn’t intend.
- How broad is the token’s scope? A bearer token tied to posting access can usually read and write; check what your developer account actually granted before assuming it’s search-only. Run the tool list through gate’s free MCP security scanner to see exactly what’s exposed.
- Who else holds a copy of the token? A token pasted into more than one client is a token you now have to remember to rotate everywhere, which is the same problem covered in MCP access control for teams — worth deciding in advance if this is a personal account or a shared brand one.
Troubleshooting the connection
- No OAuth screen appears, or the client asks for a token field instead. Expected — X’s endpoint doesn’t publish the metadata a client needs to auto-discover OAuth, so a token is the path, not a sign of a broken setup.
- “Unauthorized” or 401 errors. Usually means the token expired or wasn’t granted the permission the tool call needs — check the token’s scope before assuming the server is down.
- A post silently fails or doesn’t appear. Check your account’s own rate limits and posting rules first; those apply to an MCP-driven post exactly the way they apply to the app.
The bottom line
Connecting X to Claude with MCP means pasting in a bearer token rather than clicking “Allow,” because the server doesn’t currently publish the metadata a client needs to walk through OAuth automatically. Do it directly if you’re on one client, or once through a gateway if you want the same token and the same posting access available everywhere without copying it into multiple configs. Either way, know whether a post goes out immediately or waits for your confirmation — that distinction matters more here than for almost any other tool in this series, since there’s no private “undo” once it’s public.