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 and signs in with your MewCP account, so there is nothing to install and no API key to paste.
The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share one config file, ~/.codex/config.toml, 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 MewCP account with at least one app connected under Apps
Option A: Command
-
Add the server
Code -
Sign in
Run this and approve access in the browser window:
CodeSign in to MewCP and click Allow access.
Option B: MCP config
-
Open your config
Edit
~/.codex/config.toml. Create it if it does not exist. The file is TOML, not JSON or YAML, and each server is a[mcp_servers.<name>]table. -
Add the server
Code -
Sign in
Run this and approve access in the browser window:
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, manage_connections 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
Use an API key instead
For a machine with no browser, send an API key from Dashboard → API Keys instead of signing in. Read it from an environment variable:
Code
Then set export MEWCP_API_KEY="API_KEY" in your shell profile (~/.zshrc or ~/.bashrc) and open a new terminal. Codex sends Authorization: Bearer <your key> for you, so set the variable to the key alone.
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
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
- With sign-in, Codex has not signed in yet or the sign-in has expired. Run
codex mcp login mewcpagain. See OAuth Sign-In for errors on the sign-in page. - With
bearer_token_env_var, checkMEWCP_API_KEYis set where you start Codex. The variable holds the key alone, withoutBearer. - With
http_headers, check the value readsBearerfollowed by the whole key, which starts withmewcp_proj_.
A 403 that says your plan's billing period has ended means your MewCP plan needs renewing under Billing.
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 updated on 29 November 2026.