Post to social media from Codex
Codex reads iHatePosting from its config.toml, and its entry names the environment variable that holds your key instead of taking the key itself — so the file never holds your secret. The same entry works in the Codex CLI, the IDE extension and the ChatGPT desktop app.
Set it up
1. Create an iHatePosting API key
Sign in, open Settings → Developers and create a key. It starts with pk_live_ and is shown in full only once, so copy it before you leave the page.
2. Add iHatePosting to Codex
Add to the end of ~/.codex/config.toml. Your key does not go in this file.
# ~/.codex/config.toml — add this at the end of the file. # Put the line IHATEPOSTING_API_KEY=pk_live_… in ~/.codex/.env, then restart Codex. # The CLI, the IDE extension and the ChatGPT desktop app read that file at startup. [mcp_servers.ihateposting] url = "https://ihateposting.com/mcp" bearer_token_env_var = "IHATEPOSTING_API_KEY"3. Ask it to post
Tell Codex what you want to say and where. It saves a draft in iHatePosting unless you ask for the post to go out now or at a set time.
What is different about Codex
- bearer_token_env_var names the variable that holds your key; Codex reads it when it starts the server and sends it as a Bearer token. The simplest place for it is a line IHATEPOSTING_API_KEY=pk_live_… in ~/.codex/.env, which the CLI, the IDE extension and the ChatGPT desktop app load at startup; restart Codex after you change it. For the CLI you can instead export the variable in the shell you start Codex from, but a Codex background server that is already running keeps its old environment (codex app-server daemon restart reloads it). If the variable is missing or empty, Codex does not start this server and says so.
- There is no type setting in Codex's config — a url is what makes the entry a Streamable HTTP server.
- A project-level .codex/config.toml is read only in projects you have marked as trusted; the file in your home folder works everywhere.
- config.toml also holds your other Codex settings and MCP servers, so add this block at the end of the existing file rather than replacing it. Lines under a [section] header belong to that section, so pasting it at the top would swallow the settings below it. If you already have an [mcp_servers.ihateposting] block, replace that block instead of adding a second one.
OpenAI's own documentation: Codex MCP configuration
Nothing goes out unless you say so
Every post Codex writes is saved as a draft in iHatePosting unless you ask for it to be published now or at a set time. Publishing, rescheduling, retrying and deleting are marked as actions that change things, so clients that honour those markings ask you before they run them. Deleting a post in iHatePosting never removes one that is already live on a network.
Frequently asked questions
Where does my key go?
Not in config.toml. bearer_token_env_var names the variable that holds the key. The simplest place for it is a line IHATEPOSTING_API_KEY=pk_live_… in ~/.codex/.env, which the Codex CLI, the IDE extension and the ChatGPT desktop app load at startup. Restart Codex after you change it.
Why doesn't Codex start the iHatePosting server?
If the variable is missing or empty, Codex does not start this server and says so. A Codex background server that was already running keeps its old environment; codex app-server daemon restart reloads it.
Can I put the entry in a project's .codex/config.toml?
Yes, but Codex reads a project-level file only in projects you have marked as trusted. The config.toml in your home folder works everywhere.
Ready to post everywhere from Codex?
Start your 90-day free trial — no credit card, about a minute to your first post.
Sign Up