Pricing

Connect to OpenAI Codex

Set up BlackTwist MCP in OpenAI Codex using an API key.

Prerequisites

  • A BlackTwist API key. Generate one in your dashboard under Settings > MCP. You'll use this key to authenticate Codex with BlackTwist.

Method 1: Codex app settings (recommended)

This is the easiest way to add BlackTwist MCP to Codex — no terminal or config file editing required.
  1. Open Codex and go to Settings.
  2. Go to Integrations & MCP.
  3. Click Add custom MCP server.
  4. Enter the server name: blacktwist
  5. Enter the server URL: https://blacktwist.app/api/mcp
  6. Add a header with name: Authorization
  7. Set the header value to: Bearer YOUR_API_KEY
  8. Save the MCP server.
Replace YOUR_API_KEY with the key you generated in BlackTwist.Once saved, BlackTwist tools will be available in Codex. You can ask Codex to schedule posts, view drafts, check analytics, manage your queue, and more.

Method 2: CLI command

You can also add BlackTwist MCP from your terminal. First, set your BlackTwist API key as an environment variable:
export BLACKTWIST_TOKEN="YOUR_API_KEY"
Then run:
codex mcp add blacktwist --url https://blacktwist.app/api/mcp --bearer-token-env-var BLACKTWIST_TOKEN
Replace YOUR_API_KEY with the key you generated. You can verify the server was added with:
codex mcp list
In the Codex terminal UI, you can also run /mcp to see your active MCP servers.

Method 3: Edit config.toml

Codex reads MCP server definitions from ~/.codex/config.toml. Create the file if it doesn't already exist:
mkdir -p ~/.codex && touch ~/.codex/config.toml
Append the following block to ~/.codex/config.toml:
[mcp_servers.blacktwist]
url = "https://blacktwist.app/api/mcp"
bearer_token_env_var = "BLACKTWIST_TOKEN"
Then make sure the environment variable is available before starting Codex:
export BLACKTWIST_TOKEN="YOUR_API_KEY"
Replace YOUR_API_KEY with your actual API key. After saving, restart Codex so the changes take effect.

Using a direct header

If you prefer adding the header directly in config.toml instead of using an environment variable, you can use:
[mcp_servers.blacktwist]
url = "https://blacktwist.app/api/mcp"

[mcp_servers.blacktwist.http_headers]
Authorization = "Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your actual API key. For most users, the Codex app settings method is the simplest option.

Try it out

Inside Codex, ask something like:
Draft a Threads post about my new product launch and schedule it for tomorrow at 9am.
Codex will call the BlackTwist tools to create the draft and schedule it. The first time a tool runs, Codex will prompt you for approval.

Optional: Auto-approve tools

To skip the per-call approval prompt for trusted tools, set a default approval mode on the server in ~/.codex/config.toml:
[mcp_servers.blacktwist]
url = "https://blacktwist.app/api/mcp"
bearer_token_env_var = "BLACKTWIST_TOKEN"
default_tools_approval_mode = "approve"
Only enable this if you're comfortable letting Codex publish posts, edit drafts, and update settings without asking each time.

Notes

  • Codex stores MCP configuration in config.toml. The Codex app, CLI, and IDE extension share this configuration, so once BlackTwist is connected in one place, it can be used across Codex surfaces.
  • Codex supports OAuth for streamable HTTP MCP servers, but API key authentication is recommended for BlackTwist MCP in Codex.

Troubleshooting

  • Server fails to start: Run codex --verbose and check the logs for HTTP status errors. A 401 means the Bearer token is wrong or expired — regenerate it in Settings > MCP.
  • Timeout on startup: Add startup_timeout_sec = 30 (or higher) to your [mcp_servers.blacktwist] block, especially on slow networks.
  • Config not picked up: Confirm the file lives at ~/.codex/config.toml (not config.json) and that the table header is exactly [mcp_servers.blacktwist].
  • Environment variable not found (bearer_token_env_var): Make sure BLACKTWIST_TOKEN is exported in the shell that launches Codex. Adding it to your ~/.zshrc or ~/.bashrc ensures it's always available.
Built with
Shipped.club


© Copyright 2026 BlackTwist. All rights reserved.