Skip to content

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

  1. Sign up with Google for 100 free credits, no card.
  2. Create a key on the Keys page. Live keys start ca_live_ and test keys start ca_test_.
  3. 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 toolWhat it doesCredits
x_searchTweets by keyword with X operators (from:, min_faves:, since/until)3 per page of about 20
x_tweetsAn account's timeline3
x_tweet_detailOne tweet by id or URL3
x_replies, x_retweetersWho replied to or retweeted a tweet3
x_user, x_user_searchProfiles, including canDm3
x_followers, x_followingFollower and following lists3 per page
x_verified_followersVerified followers only4 per 20 rows
x_mentions, x_list_members, x_leadsMentions, list members, intent-ranked posts3
x_like (like or retweet), x_follow, x_tweetActions from a connected account5
x_dm_sendA DM from a connected account10

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 on insufficient_credits and 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.

FAQ

Is there an official X MCP server?
Yes. X runs a hosted MCP server at api.x.com/mcp for its own API. It needs your own X developer app: OAuth 2.0 through the xurl bridge for user actions, or an app-only Bearer token for read-only access. Requests bill against your X pay-per-use credits.
How do I connect Twitter to Claude?
Add an X MCP server to your client. For ChatterAPI in Claude Code, run claude mcp add --transport http chatterapi https://api.chatterapi.com/mcp --header "Authorization: Bearer $CHATTERAPI_KEY", then claude mcp list to confirm. Ask Claude to search X and it calls the x_search tool.
Can Claude post to X through an MCP server?
It can if the server exposes write tools and you allow them. ChatterAPI's x_tweet, x_like, x_follow and x_dm_send tools act only from an X account you connected in the dashboard, and each needs an accountId. Keep your client's approval prompt on for those tools.
Does an X MCP server need an X API key?
X's own server does, because it calls the X API with your app's credentials. A hosted server like ChatterAPI reads public X data with its own access, so you only need a ChatterAPI key. Actions still need an X account you connect yourself.
Can one MCP server give an agent both X and Reddit data?
Yes. ChatterAPI's server returned 36 tools on 2026-10-14: 13 X reads, 4 X actions, 14 Reddit reads, 3 cross-platform tools and 2 free account tools. One key and one credit balance cover all of them.

More from the blog

Make your first call on 100 free credits.

Sign up with Google, no card. One key for Reddit and X, over REST or MCP.