WEIR

Codex MCP for X (Twitter): Setup, Login and Costs

Add X (Twitter) data to Codex with one codex mcp add command: the browser login, a config.toml for API keys, a real research run and what it costs.


Published · Updated · 7 min read

Cover image: X research from the Codex CLI

To give Codex Twitter access over MCP, run codex mcp add with Weir's server URL, then sign in once.

Codex can then search X (Twitter), read threads and pull public profiles while it works in your repo. It only reads, so it never posts as you. We run Weir.

codex mcp add weir --url https://api.weirapp.io/mcp

Codex MCP setup: add Weir and log in

Codex has its own MCP client, so you install nothing beyond a free Weir account. OpenAI's Codex docs say the CLI, the IDE extension and the ChatGPT desktop app share one MCP config.

  1. Add WeirRun the command above. Codex saves it under mcp_servers.weir in ~/.codex/config.toml.
  2. Sign inCodex sees that Weir offers OAuth and opens your browser. Sign in to Weir and approve.
  3. Check itcodex mcp list shows weir. Inside a session, /mcp lists the active servers.
  4. Ask the free question"What's my Weir usage?" Codex calls get_usage, which costs nothing.

If the browser never opened, start the sign-in yourself. You'll also need this after you revoke Weir's access:

codex mcp login weir

Rather edit the file? The whole entry is two lines:

[mcp_servers.weir]
url = "https://api.weirapp.io/mcp"

In the IDE extension or the app, open MCP servers from the gear menu or Settings, then Add server. Pick Streamable HTTP, paste the URL, save and restart.

Headless or CI? Use a key with codex mcp add

A machine with no browser can skip sign-in and send a Weir key as a bearer token. Create a key under API keys in your Weir dashboard, then export it as WEIR_API_KEY.

[mcp_servers.weir]
url = "https://api.weirapp.io/mcp"
bearer_token_env_var = "WEIR_API_KEY"

Codex reads the variable when it connects, so the key never sits in the file. OpenAI's docs say Codex tries a bearer token before OAuth.

The CLI has a flag that writes the same entry:

codex mcp add weir --url https://api.weirapp.io/mcp \
  --bearer-token-env-var WEIR_API_KEY

Want sign-in on a remote machine anyway? Codex's source lists codex mcp login weir --no-browser, which prints the link and takes back the callback URL. OpenAI's MCP page doesn't document that flag yet, so check codex mcp login --help first.

Can Codex read Twitter? A real research task

Yes. With Weir connected, Codex picks the tool and its arguments itself, then writes files in your repo as usual.

Paste a prompt like this into a Codex session:

Use Weir to find X posts about MCP servers from @OpenAIDevs and
@OpenAI in the last 30 days. Skip reposts. Read the full thread for
the five most-liked posts, then write notes/mcp-on-x.md: one line per
post with likes and a link, and three takeaways for our team.

Codex calls search_x with fromUsers, query and since. Then it calls get_x_thread on the top posts and writes the file. In the Auto preset, OpenAI says Codex can edit files in your working folder without asking.

We ran that first call through Weir's MCP server on 22 October 2026, with a small limit:

→ search_x {"fromUsers": ["OpenAIDevs"], "query": "MCP",
            "since": "2026-09-01T00:00:00Z", "onlyOriginal": true, "limit": 3}
← 3 posts · 4 credits (1 + 3 × 1) · nextCursor set
  Oct 15  likeCount 0  RT: ChatGPT Sites + MCP Events + dots is a really fun combination...
  Oct 5   likeCount 0  RT: you no longer need to toggle developer mode to connect custom MCP...
  Oct 2   likeCount 0  RT: a Blender MCP demo (smaller account, text left out)

All three were reposts. onlyOriginal drops replies, not reposts, and a repost carries no likes of its own.

The real counts sit in each result's retweetedPost. The second original had 1,120 likes, for example. That field and the RT prefix are how Codex spots reposts, so "Skip reposts" in the prompt works.

To drop reposts in the search itself, add -filter:nativeretweets to query. On a plain @OpenAIDevs search, that left only original posts in our test. To test search words before a run, see our Twitter keyword research guide.

Keep Codex on the X tools. Weir lists 44 tools on a default sign-in, Reddit included. An allow list trims them, and writes mode lets read-only tools run without a prompt:

[mcp_servers.weir]
url = "https://api.weirapp.io/mcp"
enabled_tools = ["search_x", "get_x_thread", "get_x_post", "get_usage"]
default_tools_approval_mode = "writes"

Weir marks its data tools read-only. OpenAI's docs say writes asks only before tools that aren't.

What does X research in Codex cost?

Weir bills 1 credit per call plus 1 per X post, and failed calls are free.

4credits for our 3-post test call
21credits for a 20-post search
32credits with one 10-post thread added
5,000free Weir credits every month

The free credits cover about 150 runs of the task above. Paid packs start at $5 and never expire, as of October 2026. At that pack's rate, a 32-credit run costs under a cent. Every rate is on our pricing page.

Codex itself runs on your ChatGPT plan or an OpenAI API key. OpenAI's pricing page lists Codex on every ChatGPT plan, Free and Go included.

If it doesn't work

  • codex mcp list has no weir. A project .codex/config.toml loads only in trusted projects, so put Weir in ~/.codex/config.toml.
  • The add command told you to log in. Codex couldn't confirm Weir's sign-in, so run codex mcp login weir.
  • Codex never calls Weir. Type /mcp to check it's active, then check enabled and enabled_tools. Or start with "Use Weir to…".
  • A tool call times out. Raise tool_timeout_sec, which defaults to 60 seconds.
  • 401 unauthorized with a key. Export WEIR_API_KEY in the shell that starts Codex, and check the key isn't revoked.
  • Weir returns 402. Your credits ran out, and retrying won't help. Add credits or wait for next month's grant.

When not to use Weir

  • Codex has to post, reply or DM. Weir is read-only. Composio's X toolkit for Codex lists posting and DM tools.
  • You want your own private data. Weir reads public posts, not your bookmarks, DMs or home timeline.
  • Price per post matters most. TwitterAPI.io lists $0.15 per 1,000 tweets as of October 2026, less than our $5 pack.
  • You need a guarantee. Weir isn't licensed by X or affiliated with it, so access can change.

FAQ

How do I add an MCP server to Codex?

Run codex mcp add <name> --url <url> for a remote server, or codex mcp add <name> -- <command> for a local one. Codex saves it in ~/.codex/config.toml. Then codex mcp list shows it, and the IDE extension and app pick it up too.

What does codex mcp login do?

It runs the OAuth sign-in for a server saved with a URL. Codex opens your browser, you approve, and Codex keeps the token. With Weir, codex mcp add usually starts it for you, so you need login only to sign in again.

Can Codex post tweets through Weir?

No. Weir only reads public X data, so nothing can post, like or follow through it. To post, Codex needs a tool with write access to your account. X's own API charges $0.015 per post created, as of October 2026.

Do I need X API keys to use Twitter in Codex?

Not with Weir. You need only a free Weir account, and Codex signs in to it. The official X API route needs your own developer app and pays $0.005 per post read, per X's pricing page in October 2026.

Sources