🎉 Cyber Week: 30% off your first payment — ends Sunday, Dec 7Claim 30% off
MCP · Codex CLI

Codex CLI

Keep the key in an environment variable, not in the config file.
Codex CLI reads MCP servers from ~/.codex/config.toml. The bearer_token_env_var field names the variable that holds the key, so the file itself never contains a secret. The same entry also powers the ChatGPT desktop app.
Included with paid plans60 tools · 8 groups · Draft-first by default
What the agent gets

60 tools in 8 groups

60 tools, one workspaceAccounts, presets, schedules, posts, generation, content, insights and billing — all reachable from the agent.
Same key, same creditsUse the API key and plan you already have. There is no separate MCP subscription or balance.
Drafts firstAnything the agent writes lands in XBeast as a draft. Review it, edit it, or let it fill the next scheduled slot.
Safe by defaultRead-only keys for observers. Full-access keys can publish, but create_post defaults to a draft.
Connect

Connect Codex CLI

Create an API key on the Developer page, then add the server. The key comes from your environment, so the snippet below is safe to keep in a config file.
  1. Create an API key under Developer API in your XBeast account.
  2. Add the entry below to ~/.codex/config.toml.
  3. Export the raw key, open a new terminal, then confirm with codex mcp list.
The value is the raw key. Codex adds the Bearer prefix when it calls the server.
Open a new terminal after exporting so the variable is visible to Codex.
Add to ~/.codex/config.toml
Codex CLI
toml
[mcp_servers.xbeast]
url = "https://xbeast.io/api/mcp"
bearer_token_env_var = "XBEAT_API_KEY"
Export the key, then confirm
Codex CLI
bash
export XBEAT_API_KEY="xb_live_..."   # raw key, no "Bearer " prefix
codex mcp list
The loop

Find, inspect, write, schedule

Four messages do the whole job. The tool names below are the ones the agent calls for you.
01
Find

Find what already exists

Ask for an account, preset or post in plain language. Read tools return real IDs, statuses and dates, and cost nothing.
list_accountslist_presetslist_scheduleslist_posts
02
Inspect

Read before you spend

Check credits, audience growth and post performance before the agent writes anything.
get_workspaceget_account_analytics_overviewlist_account_postsget_post
03
Write

Write in your voice

Generate from a preset, rewrite a hook, add media or save a draft. create_post defaults to a draft, so nothing ships by accident.
generate_textbeast_mode_generateedit_post_with_aicreate_post
04
Schedule

Put it on the calendar

Move a slot, drop the post into the next queue slot or publish now — with the same rules as the dashboard.
create_scheduleupdate_schedulequeue_postpublish_post
A real session

What it looks like when it runs

Real tool names; the values are illustrative.
Codex CLI
MCP
Show my workspace credits and the next three queue slots.
get_workspacelist_schedules
84 credits left this month · next: Thu 09:00, Fri 08:30, Fri 12:00
Draft a week of posts from the Build in public preset.
generate_from_preset
7 drafts saved · 7 credits
Schedule them into the open slots and list what changed.
create_postupdate_post
7 posts scheduled · no conflicts · 0 errors
Three prompts to try

Start with one of these

Show my workspace credits and the next three open queue slots.
Draft a week of posts from the Build in public preset.
Schedule the drafts into the open slots and list every change.
FAQ

Common questions

Also works with

One server. Any client.

Claude CodeMCP guide
ChatGPTMCP guide
CursorMCP guide
Hermes Agent
Hermes AgentMCP guide
Every tool, protocol version and header rule: MCP server docs. The REST API behind those tools: API overview.

Connect XBeast to Codex CLI

Create a key, add the server, and ask the agent to call list_accounts. The whole workspace follows.