X MCP server: give Claude, Cursor or Codex live X and Reddit data
Set up an X MCP server in Claude Code, Cursor or Codex: exact configs, real tools/call results, safe habits for X actions, and Reddit in the same server.
Piyushh · October 14, 2026 · 7 min read
An X MCP server gives Claude, Cursor or Codex a set of X tools: search tweets, read timelines and profiles, export followers and, if you allow it, like, follow, post or send a DM. Add the server's URL and a key to your client's MCP config, restart, and the agent calls those tools by itself. ChatterAPI's hosted server takes one command in Claude Code and needs no X developer app.
This tutorial covers the exact configs, the X tools you get, real tools/call results, and the habits that stop an agent from doing something public you didn't intend. The same server also handles Reddit. For the Reddit side alone, see our Reddit MCP server guide. To compare the open-source options side by side, see the best MCP servers for Reddit and X.
Two kinds of X MCP server
The first kind is X's own. X's MCP docs (checked 2026-10-14) describe a hosted Streamable HTTP server at https://api.x.com/mcp. You connect it in one of two ways. The full route needs your own X developer app with OAuth 2.0 enabled and a registered callback URL, and runs through the open-source xurl bridge with npx, which handles the PKCE login and token refresh. The simpler route pastes an app-only Bearer token into a header, and X notes that this gives "no user context (no actions as you)." The docs list reads across posts, search, users, news and trends, plus writes for bookmarks and Articles. If you hit a client-not-enrolled error, the docs say to move the app to pay-per-use and production. Those requests then bill against your X credits.
Developers who use it like that it's first-party. They also notice the bridge. "Finally switched to the new X MCP server," Pamela Fox wrote on October 1. "It's a bit annoying that the full MCP requires an npx local bridge, but at least it's a bit slicker than their first version" (post). If you already have an X app and want your data straight from X, use it. Our guide to getting an X API key covers the console steps.
The second kind is a hosted third-party server. It uses its own access to public X data, so you don't register an X app, and you pay that service instead of X. ChatterAPI is one. It's independent and not affiliated with X Corp, and it puts Reddit behind the same key, which helps when your agent's research spans both platforms.
If you want an agent doing X outreach, XAutoDM covers the sales side in connecting Claude and ChatGPT agents to X. This guide sticks to data and careful actions.
Set up the X MCP server in your client
- Sign up with Google for 100 free credits, no card.
- Create a key on the Keys page. Live keys start
ca_live_and test keys startca_test_. export CHATTERAPI_KEY=ca_test_...in your shell.
Use a test key first. Every tool returns one recorded real sample for 0 credits, and action tools run as dry runs, so you can see how your agent behaves before anything happens for real. The configs below come from the MCP server page, where each one was checked against the client's docs on 2026-10-14.
Claude Code (Claude Twitter setup)
claude mcp add --transport http chatterapi https://api.chatterapi.com/mcp \
--header "Authorization: Bearer $CHATTERAPI_KEY"
Run claude mcp list. chatterapi should show as connected. Then ask "What has @levelsio posted today?" and Claude reaches for x_tweets.
Cursor and Windsurf
Cursor reads ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):
{
"mcpServers": {
"chatterapi": {
"url": "https://api.chatterapi.com/mcp",
"headers": { "Authorization": "Bearer ${env:CHATTERAPI_KEY}" }
}
}
}
Windsurf uses serverUrl in mcp_config.json (Cascade, MCP servers, View raw config):
{
"mcpServers": {
"chatterapi": {
"serverUrl": "https://api.chatterapi.com/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" }
}
}
}
Codex and VS Code
Codex, in ~/.codex/config.toml:
[mcp_servers.chatterapi]
url = "https://api.chatterapi.com/mcp"
bearer_token_env_var = "CHATTERAPI_KEY"
VS Code, in .vscode/mcp.json. It asks for the key the first time the server starts:
{
"inputs": [{ "type": "promptString", "id": "chatterapi-key", "description": "ChatterAPI API key", "password": true }],
"servers": {
"chatterapi": {
"type": "http",
"url": "https://api.chatterapi.com/mcp",
"headers": { "Authorization": "Bearer ${input:chatterapi-key}" }
}
}
}
Claude Desktop needs the mcp-remote bridge to send the header. That config is in the Reddit MCP server guide and works for X without changes.
The X tools your agent gets
On 2026-10-14, tools/list returned 36 tools. Each tool is named after its REST id with the dots replaced by underscores, so x.search becomes x_search. Here are the X tools:
| MCP tool | What it does | Credits |
|---|---|---|
x_search | Tweets by keyword with X operators (from:, min_faves:, since/until) | 3 per page of about 20 |
x_tweets | An account's timeline | 3 |
x_tweet_detail | One tweet by id or URL | 3 |
x_replies, x_retweeters | Who replied to or retweeted a tweet | 3 |
x_user, x_user_search | Profiles, including canDm | 3 |
x_followers, x_following | Follower and following lists | 3 per page |
x_verified_followers | Verified followers only | 4 per 20 rows |
x_mentions, x_list_members, x_leads | Mentions, list members, intent-ranked posts | 3 |
x_like (like or retweet), x_follow, x_tweet | Actions from a connected account | 5 |
x_dm_send | A DM from a connected account | 10 |
The 13 read tools carry readOnlyHint: true in their annotations and the four action tools don't. Good clients use that difference to decide which calls to ask you about first. The same server also exposes 14 read-only Reddit tools and three cross-platform ones. One of those is everywhere_search, which searches Reddit and X in a single call for 5 credits. Every tool draws from the same balance as the REST API. The X endpoint docs list the full parameters.
Most people use a twitter MCP for reading. "x mcp has to be one of the best usecases for mcp if you have scrolling fatigue like me," one developer wrote: "your agent research x for you and tell you what's moving today" (post).
Real tools/call results from the X MCP server
Your agent reasons over results like these. Both were recorded with a test key, which returns one real sample per tool whatever the input, and then trimmed.
Search tweets
Asking "Find recent tweets where people ask for a CRM recommendation" produces:
{ "method": "tools/call", "params": { "name": "x_search", "arguments": { "q": "crm recommendation", "sort": "latest" } } }
{
"structuredContent": {
"data": [
{
"id": "2099495333231288346",
"text": "meta ads: how important is the “connect to your crm” recommendation? ...",
"url": "https://x.com/HesomParhizkar/status/2099495333231288346",
"createdAt": "2026-09-14T13:47:48.000Z",
"likes": 2, "replies": 2, "views": 138,
"author": { "handle": "HesomParhizkar", "followers": 584, "canDm": true }
}
],
"page": { "nextCursor": "AcWNIo1WFWYR7CN…", "hasMore": true },
"credits": { "charged": 0, "remaining": 717 }
}
}
The sample page had 20 tweets. On a live key it costs 3 credits, and the agent passes page.nextCursor back as cursor to get the next page.
Read a timeline
{ "method": "tools/call", "params": { "name": "x_tweets", "arguments": { "handle": "levelsio" } } }
{
"structuredContent": {
"data": [
{
"id": "2110066474513793361",
"text": "✨ 200,000+ users on my computer nostalgia project @pieter ...",
"createdAt": "2026-10-13T17:53:45.000Z",
"likes": 129, "retweets": 4, "replies": 37, "views": 15475,
"isReply": false, "quotedTweetId": "2108957488410161442"
}
],
"page": { "nextCursor": "AdRoOOdYidXg6…", "hasMore": true },
"credits": { "charged": 0, "remaining": 717 }
}
}
With fields like isReply and quotedTweetId, the agent can drop replies or follow quote chains without another call. Checking a balance before a loop with chatterapi_account is free. If you'd rather script it, the same JSON comes back over REST: see the X API in Python.
Actions from a connected X account, and how to keep them safe
Reads need only the key. Actions need an X account you connect in the ChatterAPI dashboard, and every action tool takes that account's accountId, a UUID. They also take an idempotencyKey, so a retried call never likes, posts or messages twice. On a test key, actions are dry runs. Here is a real one:
{ "method": "tools/call", "params": { "name": "x_like", "arguments": {
"accountId": "00000000-0000-0000-0000-000000000000",
"tweetId": "2099495333231288346", "action": "like", "idempotencyKey": "demo-like-1" } } }
{ "data": { "ok": true, "action": "like", "targetId": "2099495333231288346", "dryRun": true },
"credits": { "charged": 0, "remaining": 717 } }
On a live key that like costs 5 credits, charged only on success. A DM costs 10. The tool's own tip is to check canDm with x_user first, because a DM to someone who has closed them fails.
The habits worth keeping:
- Keep approval prompts on for action tools. Claude Code, Cursor and VS Code can ask before each tool call. Auto-approve the read tools if you like, but never the four action tools.
- Have the agent show you the exact text and target first. "Draft the reply, show me, then post only if I say yes" works better as a prompt than "reply to these."
- Don't wire search results straight into replies. X's automation rules (updated April 2026, checked 2026-10-14) say "sending automated replies to posts based on keyword searches alone is not permitted," and advise: "Ask for the user's permission before taking an action if you aren't sure."
- Stay within safe daily limits. Spread actions out and keep volumes low. You're responsible for what happens on the account.
- Give the agent a budget. Every result ends with
credits.remaining, and the server's instructions tell the agent to stop oninsufficient_creditsand tell you.
The case for keeping your agent read-only on X
There's a strong case for giving an agent no actions at all. "Marketing might be the best job for an AI agent," @beninthehouse wrote on October 9. "It's also a job where one wrong action is very public" (post). A bad SQL query stays in your terminal. A bad reply sits on your profile with your name on it, and X's rules say the account owner is "ultimately responsible for the actions taken with your account."
Most research work only needs reads: monitoring, competitor timelines, follower exports, finding threads to read yourself. If that describes your use, don't connect an X account. With no accountId to pass, the action tools have nothing to act from. Connect one only for a specific job a human has reviewed, like posting a reply you already wrote.
If you only need to look up a post or two by hand, see how to view tweets without an account. If the agent's job is reading both platforms, also see how to give an AI agent Reddit and X data. If MCP itself is new to you, what an MCP server is walks through one request at a time.
Try it
ChatterAPI gives your code and your agents Reddit and X data through one key, over REST or MCP, without applying for a developer account. Sign up with Google to get 100 free credits without entering a card, which covers about 33 tweet searches. Paste the config, restart your client, and ask it what an account posted this week. Plans start at $19 a month for 25,000 credits.