How-to guide
How to add an MCP server to Codex
The Codex CLI and the Codex IDE extension share one config file. Add a remote MCP server once and both can use it.
Last checked November 2026
Add the server from the terminal
-
Run codex mcp add
codex mcp add connectchats --url https://api.connectchats.com/mcp -
Sign in
This opens your browser for OAuth. On a machine without a browser, add --no-browser and paste the redirect URL back when asked.
codex mcp login connectchats -
Check it
codex mcp list shows your servers. Inside Codex, type /mcp to see their tools.
codex mcp list
Or edit config.toml by hand
-
Open ~/.codex/config.toml
A trusted project can also have its own .codex/config.toml.
-
Add a block for the server
[mcp_servers.connectchats] url = "https://api.connectchats.com/mcp" -
Sign in
Run codex mcp login connectchats as above.
Turn a server off or remove it
Add enabled = false to the server's block to switch it off without deleting it, or run codex mcp remove connectchats. codex mcp logout connectchats clears the stored token.
Example: your WhatsApp chats in Codex
-
Create a ConnectChats account
Open https://connectchats.com/app and sign in with a passkey. There is no email or password to remember.
-
Link WhatsApp
Choose Link a chat app, then WhatsApp. Scan the QR code from WhatsApp on your phone (Linked devices, then Link a device), or switch to Use a pairing code.
-
Choose the chats your AI can read
Chats appear on the Chats page as they import. Turn on only the ones you want your AI app to see.
-
Add the server
Run codex mcp add with https://api.connectchats.com/mcp, then codex mcp login connectchats.
Tips
- Older guides mention an experimental rmcp client flag. Current Codex versions connect to remote servers without it.
- If codex mcp add does not accept --url, update Codex.
- For a server that uses a static token, set bearer_token_env_var to the name of an environment variable instead of pasting the token into the file.
Questions
Where is the Codex MCP config?
In ~/.codex/config.toml, under [mcp_servers.<name>]. The CLI and the IDE extension read the same file.
Does Codex support Streamable HTTP MCP servers?
Yes. A block with url = "..." is a Streamable HTTP server, and Codex signs in with OAuth by default.
Is adding a server to Codex the same as adding it to ChatGPT?
No. ChatGPT adds servers from its Plugins page on the web, with plan limits. Codex reads its own config file, so you add the server there separately.
Related pages
More guides
- Add an MCP server to ChatGPT Custom MCP plugins on the web, which plans allow them, and how to call one in a chat.
- Add an MCP server to Claude Code One claude mcp add command, scopes, OAuth with /mcp, list and remove.
- Add an MCP server to Cursor The mcp.json entry for a remote server, OAuth sign-in and where to switch it on.
Connect your chats
More on ConnectChats
Stop switching apps. Ask your AI instead.
Add ConnectChats in one click. Your first two chat apps are free.
Get started free