claudekit / tools / x-api
[ MCP · Communication ]

X

X's (formerly Twitter) hosted MCP server. Search posts and users, manage bookmarks, fetch trends and news, and draft Articles from Claude Code.

xdevplatform/xurl ·published ·updated
$ claude mcp add xapi --env CLIENT_ID=YOUR_X_APP_CLIENT_ID --env CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET -- npx -y @xdevplatform/xurl mcp https://api.x.com/mcp copy

X’s (formerly Twitter) hosted MCP server, connected through the open-source xurl bridge (xdevplatform/xurl).

Why it matters

Searching X posts or analyzing a user’s timeline meant the X developer portal or the raw API. Connect the X MCP and you can search posts and users, manage bookmarks, fetch trends, and draft Articles as a conversation in Claude Code.

What you can do

Representative tasks from X’s official docs:

  • Search posts — “Search the full archive for ‘Claude Code’ posts from the last week and summarize them.” (full-archive search)
  • Analyze users — “Look up @username and summarize the main topics in their recent timeline.” (user lookup, timeline)
  • Manage bookmarks — “Bookmark this post into my ‘AI’ folder.” (bookmarks, folders)
  • Trends and news — “Show me what’s trending right now and the related news.” (trends by WOEID, news)
  • Draft Articles — “Draft an X Article from this content.” (draft Articles)

Grounded in docs.x.com/tools/mcp.

Key features

  • Posts — fetch posts, see likers/reposters/quoters, recent counts
  • Search — full-archive post search, user search, news search
  • Users — resolve current user, look up by ID/handle, read posts/timeline/mentions
  • Bookmarks — list, add, remove, manage folders
  • News & Trends — get stories, trends by location (WOEID)
  • Articles — create and publish draft Articles

Cost

The MCP server and the xurl bridge are free, but every tool call goes through the X API. The X API has no free tier — it “uses pay-per-usage pricing. No subscriptions—pay only for what you use.” You buy credits upfront in the developer console and they are deducted as you call. There are no contracts, subscriptions, or minimum spend.

OperationChargedRate
Posts (read)per resource returned in the response$0.005
Users (read)per resource returned in the response$0.010
Likes, mutes, blocks (read)per resource returned in the response$0.001
Owned Reads (your own data)per resource returned in the response$0.001
Post creationper request$0.015
Posts with URLsper request$0.200

Reads bill on resources returned, not on the number of requests. “Search the full archive for ‘Claude Code’ posts from the last week” returning 100 posts costs $0.5, so a single broad conversation can add up quickly — set a spending limit in the developer console.

Grounded in docs.x.com/x-api/getting-started/pricing.

Setup

The app you create in the X Developer Portal has to be moved to the Pay-per-use package and the Production environment before the MCP server will work.

OAuth 2.0 (read and write):

claude mcp add xapi --env CLIENT_ID=YOUR_X_APP_CLIENT_ID --env CLIENT_SECRET=YOUR_X_APP_CLIENT_SECRET -- npx -y @xdevplatform/xurl mcp https://api.x.com/mcp

App-only Bearer (read-only):

claude mcp add --transport http xapi https://api.x.com/mcp --header "Authorization: Bearer YOUR_APP_ONLY_BEARER_TOKEN"

Notes

  • Usage limits — writes (bookmarks, article_publish) count against rate limits and are stricter than reads; expect occasional 429s and back off. Pay-per-usage plans are capped at 2 million Post reads per monthly billing cycle, above which you need an Enterprise plan
  • Auth — OAuth 2.0 PKCE (automatic token refresh) needs the X app’s CLIENT_ID and CLIENT_SECRET; read-only uses an app-only Bearer token. For remote/server environments, use xurl auth oauth2 --headless
  • First run — the first OAuth login needs a browser, so set startup_timeout_sec to 300+ in client configs
  • Install command source — the official docs provide a claude_desktop_config.json JSON for Claude Desktop; the commands above port that to Claude Code’s claude mcp add form
  • License — the xurl bridge is MIT; the MCP server is a service hosted by X
§ 7

Frequently Asked Questions

frequently asked
§ 7.1
What is the X MCP?
X's (formerly Twitter) hosted MCP server (`https://api.x.com/mcp`). It lets Claude Code search posts and users, manage bookmarks, fetch trends and news, and draft Articles using your X account's permissions.
§ 7.2
Where does it work?
It works in Claude Code, Claude Desktop, Cursor, VS Code, and other MCP-compatible tools. OAuth 2.0 is handled through the `xurl` local bridge (`@xdevplatform/xurl`).
§ 7.3
How do I install it?
For OAuth 2.0, pass your X app's `CLIENT_ID` and `CLIENT_SECRET` to the `xurl mcp` bridge. For read-only access, pass an app-only Bearer token via the `Authorization` header to connect directly to `https://api.x.com/mcp`.
§ 7.4
Is it free?
The MCP server and the `xurl` bridge are free, but the X API has no free tier — it uses pay-per-usage pricing, so you pay only for what you use. Reads are charged per resource returned in the response (posts $0.005, users $0.010) and writes per request (post creation $0.015), drawn from credits you buy upfront in the developer console.
§ 7.5
Do I need an X API account?
Yes. Every tool call goes through the X API, so you need an app in the X Developer Portal set to the Pay-per-use package and the Production environment.
§ 7.6
What can I do with it?
Full-archive post search, user lookup and timeline analysis, bookmark management with folders, trends and news, and creating and publishing draft Articles.