Give your AI agent a Twitter reader: MCP and tool definitions for Claude, ChatGPT and Codex
By Steven Van ·
Claude, ChatGPT and Codex can read public X data over MCP at 1 credit ($0.001) per returned record, and the old free script endpoints now return HTTP 402.
Claude, ChatGPT and Codex can now read public X profiles, posts, replies and search results through the Unif API MCP server, which UnifAPI describes in a guide for X access. For agent loops you run yourself, the guide also supplies copy-paste tool definitions for Anthropic tool use and OpenAI function calling, plus a SKILL.md for Claude Code and Codex.
Connecting the MCP server
Add https://mcp.unifapi.com in the client and sign in with OAuth, so there is no key to paste. The agent gets three tools: list_operations to search the catalog, get_operation to read one operation's parameters, and call_api to run it. Setup per client:
- Claude: Settings, Connectors, Add custom connector, then paste the URL and leave Authentication as OAuth.
- ChatGPT: on Plus, Pro, Team or Enterprise, turn on Developer Mode, click Create app and paste the URL as the MCP Server URL.
- Codex: run codex mcp add unifapi --url https://mcp.unifapi.com, then codex mcp login unifapi if sign-in does not open on its own.
- Claude Code: run claude mcp add --transport http unifapi https://mcp.unifapi.com.
What the agent can read
The operations are GET calls on the paid X API: profile lookup by username, an account's timeline, a single post, recent search, replies under a post (searching on conversation_id), trends by WOEID, Communities search, and followers and following lists. A request such as "what has @NASA posted with media lately?" becomes a call_api call to /x/tweets/search/recent with the query from:nasa filter:media and max_results of 20.
Every response uses one envelope with data, pagination and billing. Errors come back as { error: { type, message } } with a closed set of types, such as unauthorized, insufficient_credits, not_found and rate_limited. A 429 response adds a Retry-After header.
Pricing
Calls are pay as you go, with no subscription. Each returned record costs 1 credit ($0.001), with a minimum of one credit per call. A profile or single post is 1 credit, a profile with 10 posts is 11, and a 20-post search page is 20 ($0.02).
Running your own agent loop
For a self-run loop, the guide defines a single read_x tool with a lookup enum (profile, post, replies, search), so the model never builds a path itself. The handler calls https://api.unifapi.com with a Workspace API key from an environment variable. The guide also gives the model three rules: count credits before paging, sleep on Retry-After, and trim what goes into the context window.
Old free endpoints
Since October 17, 2026, the old free endpoints under /tools/x/ answer scripts and agents with HTTP 402. The response body names the MCP server and the paid operation that replaces each lookup. The viewer pages, such as the X profile viewer, stay free in a browser.
