CodexX (Twitter)

Publish an X thread from Codex

Turn a changelog into a short thread. Approve the text, account, and estimated X API fees, then check the published thread link.

Connect Codex

codex mcp add writes this entry to ~/.codex/config.toml for your user. To share the server with the repository, put the same entry in the project's .codex/config.toml.

Add PubNio to .codex/config.toml

[mcp_servers.pubnio]
url = "https://pubnio.com/mcp"
.codex/config.toml

Sign in

  1. Run codex mcp login pubnio in a terminal.
  2. Your browser opens PubNio sign-in; approve the workspace.
  3. Start Codex in the repository and ask it to list your PubNio workspaces.

Connect your X account

Open PubNio, choose your workspace, and go to Accounts. Use the same workspace when you sign in from Codex.

  • Connect the X account you want to post from in PubNio and confirm it is ready.
  • Open the repository containing your changelog in Codex.
  • Review the current X pass-through estimate in PubNio before approving.
  • Make sure your workspace has enough prepaid credit for the estimated X fees.

Check the destination

Read-only destination check
List the X accounts in my PubNio workspace and show which are ready to publish. Do not create, schedule, or publish posts.

Turn your changelog into an X thread

Paste the prompt into Codex. It runs the job through PubNio's search and execute tools, as in the Code Mode flow below. Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

Read CHANGELOG.md and draft a short X thread with an opener and two replies. Keep each post within 280 characters. Show the destination account and every post. Validate the thread with PubNio to get the publishing fee estimate, including X pass-through fees, and wait for my approval. If validation is blocked or the cost is unavailable, stop. After approval, publish once, then read the delivery and return the thread’s opening-post link.
Turn your changelog into an X thread

Check delivery and get the link

If delivery is still pending, keep the PubNio post ID and check the same post. A published delivery with a provider reference confirms the result.

  1. Review the validation estimate before any publish request.
  2. Save the PubNio post ID after admission.
  3. Check the existing delivery until it confirms and returns the opening-post URL.
  4. Open the thread to check the replies. If submission is unresolved, reconcile the existing target before trying again.

From approval to delivery

Illustrative conversation and result with sample data.

  1. Codex

    I’ve drafted an opener and two replies for @example. Here are all three posts and the PubNio estimate, including the X API fee for each write.

  2. You

    I’ve reviewed the thread, destination, and estimated fees. Publish it once.

  3. Codex

    PubNio accepted the thread. I checked the original delivery and got the confirmed link to the opening post.

Example delivery result

Status
published
Destination
@example · three-post X thread
Sample URL
https://x.com/i/web/status/1234567890

X rules Codex runs into

Account kinds: social account. Connection scopes: tweet.write.

X placements from the capability catalog
PlacementMedia typesMax per targetCaption limit
feed (default)image, video4280
  • This walkthrough uses a text-only feed target.
  • A feed post takes up to 4 images or videos.
  • Put the opening text in the post body and the replies in the target’s thread settings.
  • Keep each post to 280 characters.
  • If you add URLs, review the new estimate. X charges can vary with the content of each write.

Failures and recovery

Match the error before asking Codex to retry.

X (Twitter) publishing failures and safe retry behavior
CodeCauseFixRetry
account_not_readyThe connected account's OAuth token is expired, revoked, or disconnected.Reconnect the account in the PubNio workspace, then re-validate.After reconnect
empty_contentNeither text nor media was provided for a target that requires content.Add caption text or attach a ready media ID.No
caption_too_longText exceeds the destination placement's character limit (caption.limit).Shorten the caption or add a shorter target-specific text override.No
insufficient_credit (billing, 402)Prepaid credit cannot cover the publish, including X pass-through fees.Top up credit or upgrade the plan.After a top-up
spend_cap_reached (billing, 402)The publish would pass the workspace's monthly spend cap.Raise the monthly spend cap in billing settings.After raising the cap

Codex setup problems

Calls start failing with 401.
Run codex mcp login pubnio again to renew the PubNio sign-in.
Codex does not show the pubnio tools.
Run codex mcp add pubnio --url https://pubnio.com/mcp again, or check that [mcp_servers.pubnio] is in config.toml.
Writes fail with 403 read_only_mode.
PubNio returns 403 read_only_mode when the server URL ends in ?readOnly=1. Point the entry at https://pubnio.com/mcp to allow writes.

Codex quirks

  • Sign-in runs from the terminal with codex mcp login pubnio, outside a Codex session.
  • The TOML entry needs only url; the table name [mcp_servers.pubnio] is the server name.

What it won't do

  • Waive X API fees ($0.015 a post, or $0.20 with a link). They pass through on every plan.
  • Publish when prepaid credit cannot cover the estimated X fees.
  • Post identical copy again. X rejects duplicates, so check the existing delivery first.
  • Connect accounts, create API keys, or manage webhooks from an MCP session that uses an API key. Those operations need a person signed in, so connect the MCP server with browser OAuth or use the PubNio web app.
  • Stream binary uploads through execute. Import media from an HTTPS URL, or send a file of up to 8 MiB inline as base64.
  • Run one execute call past 30 seconds or past its request limit. The script returns the post ID so the next call can check it.

Frequently asked questions

Can Codex turn release notes into an X thread?

Yes. Use the X feed placement with opening text and ordered replies, then approve the prepared thread.

What does it cost to publish an X thread?

Validate the thread for PubNio’s current estimate. X API create fees are separate, and a thread contains multiple writes.

Which link does PubNio return?

The confirmed X delivery links to the opening post. Open that link to review the thread.

Should I resubmit if Codex stops waiting?

Save the PubNio post ID and recheck the same delivery. If the outcome is unresolved, reconcile before retrying.

Where does Codex keep the PubNio server?

In config.toml under [mcp_servers.pubnio] with url = "https://pubnio.com/mcp". codex mcp add writes it to ~/.codex/config.toml; a project can keep the same entry in .codex/config.toml.

How do I sign Codex in again?

Run codex mcp login pubnio. Each client keeps its own PubNio sign-in.

Also works with

Get started with PubNio

Connect unlimited accounts at $0 per account. Pay as you go includes 50 free confirmed publishes a month on your first workspace, then $20 per 1,000. X API fees are separate.

REST API reference

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post. A 202 response includes the post ID and initial delivery status. Use the settled status to confirm publishing.

POST /api/v1/posts?workspaceId=00000000-0000-4000-8000-000000000006
Authorization: Bearer pn_live_***
Idempotency-Key: codex-x-weekly-queues-thread
Content-Type: application/json

{
  "text": "Weekly queues are here. Here’s what changed.",
  "publishNow": true,
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "x",
      "placement": "feed",
      "settings": {
        "thread": [
          "Set a recurring schedule once for each account.",
          "Add a post to the queue and check delivery when it goes live."
        ]
      }
    }
  ]
}
create-post.http