How to Connect Codex to MewCP
Add MewCP to Codex once, and Codex can use every app you have connected in MewCP: Gmail, Calendar, Slack, GitHub and the rest. Codex connects to MewCP directly over HTTP, so there is nothing to install.
The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share one config file, so setting it up once covers all three.
Before you start
- Codex installed. For the CLI, check with
codex --version, or see the Codex docs - A API Key from Dashboard → API Keys, see API Key
- At least one app connected in the dashboard under Servers
Set up MewCP
Codex reads MCP servers from ~/.codex/config.toml. The file is TOML, not JSON or YAML, and each server is a [mcp_servers.<name>] table. Create the file if it does not exist.
Choose how Codex gets your key:
Key in an environment variable (recommended)
Add this to ~/.codex/config.toml:
Code
Then set the variable in your shell profile (~/.zshrc or ~/.bashrc) and open a new terminal:
Code
Codex sends Authorization: Bearer <your key> for you, so set the variable to the key alone.
Key in the file
If you start Codex from somewhere that does not load your shell profile, such as the ChatGPT desktop app, put the header in the file instead:
Code
This is the entire configuration either way. One entry reaches every app you have connected, and connecting another app later needs no change here.
MewCP loads the next time you start Codex. In the IDE extension, choose Restart extension. In the ChatGPT desktop app, choose Restart under Settings → MCP servers.
Only in one project
To use MewCP in a single project, put the same table in .codex/config.toml inside that project. Codex reads project config only for projects you have marked as trusted.
Check it works
Run:
Code
mewcp should be listed. Inside the codex terminal UI, type /mcp to see your active servers.
You will see four tools, not the tools of every app: search, get_schema, list_accounts and call_tool. That is expected. Codex uses them to find and run the right tool for whatever you ask. See How MewCP works.
Then ask for something from an app you have connected:
Code
Troubleshooting
Codex ignores the MewCP entry
- Check the file is
~/.codex/config.tomland the entry is a TOML table named[mcp_servers.mewcp]. Codex does not readmcpServersblocks in JSON or YAML, which older guides show. - For
.codex/config.tomlinside a project, check you have trusted that project.
MewCP returns 401
Codex connects without a key when it cannot find one, so a missing key shows up as a 401 from MewCP.
- With
bearer_token_env_var, checkMEWCP_API_KEYis set where you start Codex:echo $MEWCP_API_KEY. The variable holds the key alone, withoutBearer. - With
http_headers, check the value readsBearerfollowed by the whole key, which starts withmcp_live_.
A 403 that says the billing period is not active means your MewCP plan needs renewing in the dashboard.
MewCP times out at startup or during a tool call
Codex waits 10 seconds for a server to start and 60 seconds for a tool to finish. On a slow network, raise the limits:
Code
Last checked against Codex's documentation on 13 October 2026.