Schedule Facebook posts from Codex CLI
Add Hookpost to Codex CLI as a remote MCP server in ~/.codex/config.toml, with your API key in an environment variable. Then ask it for a Facebook post: it saves a draft, schedules it, or publishes it now to a Facebook Page you manage. If Facebook is not connected yet, it gives you a link that connects it in about a minute.
By the Hookpost team ·
Set it up in 3 steps
- Copy your Hookpost API key. In Hookpost, open Settings → Developers → Reveal → Copy.
- Add the server. Add the table below to ~/.codex/config.toml and export HOOKPOST_API_KEY with your key.
- Connect Facebook. Ask Codex CLI to connect Facebook. It replies with a link; open it, approve on Facebook's screen, and the channel is in Hookpost. You can also use Add Channel in the app.
~/.codex/config.toml
# ~/.codex/config.toml [mcp_servers.hookpost] url = "https://hookpost.hookstep.in/api/mcp" bearer_token_env_var = "HOOKPOST_API_KEY"
Claude Code, Cursor, VS Code, Windsurf, Codex, Gemini CLI and the hookpost CLI use an API key, which comes with the Hookpost plan.
What Facebook accepts
Text limit: 63,206 characters. Codex CLI reads these from get_platform_post_rules before it writes, so the draft fits.
- Stories require at least one media item
- Posts to a Page, not a personal profile
A first prompt
Paste this into Codex CLI. It stops at a draft, so nothing goes out until you look at it.
Prompt
List my Hookpost channels. If Facebook is not connected, give me the link to connect it and wait. Then write one Facebook Page post, based on CHANGELOG.md, within Facebook's limits. Save it as a draft in Hookpost. Do not schedule or publish anything.
What happens behind it
- list_channels finds your Facebook channel and its id.
- If there is none, create_channel_connect_link returns a link: you open it, approve on Facebook's own screen, and the channel is added. The link works for 24 hours.
- get_platform_post_rules returns Facebook's limit and the settings a post takes.
- create_post saves the post as a draft, schedules it for a time, or publishes it now.
Questions
- Can Codex CLI post to Facebook on its own?
- Yes, through Hookpost's create_post tool: as a draft, at a scheduled time, or right away. It posts to a Facebook Page you manage only after you have connected it, and the prompt above keeps it to drafts until you review them in the Hookpost calendar.
- Do I need my own Facebook developer app or API key?
- No. Hookpost holds the Facebook app; you approve Hookpost once on Facebook's sign-in screen, from the link Codex CLI gives you or from Add Channel.
- What does it need on the Hookpost side?
- Claude Code, Cursor, VS Code, Windsurf, Codex, Gemini CLI and the hookpost CLI use an API key, which comes with the Hookpost plan.
- What can Codex CLI not do in Hookpost?
- Delete posts, edit the text or date of a post, or read analytics. Do those in the Hookpost app.
Related
- Facebook in Hookpost
Everything Hookpost does on Facebook.
- Full Codex CLI setup
Every option for Codex CLI, step by step.
- Every agent and network
The other agents and networks.
- The Hookpost MCP server
Endpoints and the full tool list.