mcp.md +27 −2
58- `env` (optional): Environment variables to set for the server.58- `env` (optional): Environment variables to set for the server.
59- `env_vars` (optional): Environment variables to allow and forward.59- `env_vars` (optional): Environment variables to allow and forward.
60- `cwd` (optional): Working directory to start the server from.60- `cwd` (optional): Working directory to start the server from.
61- `experimental_environment` (optional): Set to `remote` to start the stdio
62 server through a remote executor environment when one is available.
63
64`env_vars` can contain plain variable names or objects with a source:
65
66```toml
67env_vars = ["LOCAL_TOKEN", { name = "REMOTE_TOKEN", source = "remote" }]
68```
69
70String entries and `source = "local"` read from Codex's local environment.
71`source = "remote"` reads from the remote executor environment and requires
72remote MCP stdio.
61 73
62#### Streamable HTTP servers74#### Streamable HTTP servers
63 75
75- `enabled_tools` (optional): Tool allow list.87- `enabled_tools` (optional): Tool allow list.
76- `disabled_tools` (optional): Tool deny list (applied after `enabled_tools`).88- `disabled_tools` (optional): Tool deny list (applied after `enabled_tools`).
77 89
7890If your OAuth provider requires a static callback URI, set the top-level `mcp_oauth_callback_port` in `config.toml`. If unset, Codex binds to an ephemeral port.If your OAuth provider requires a fixed callback port, set the top-level `mcp_oauth_callback_port` in `config.toml`. If unset, Codex binds to an ephemeral port.
91
92If your MCP OAuth flow must use a specific callback URL (for example, a remote Devbox ingress URL or a custom callback path), set `mcp_oauth_callback_url`. Codex uses this value as the OAuth `redirect_uri` while still using `mcp_oauth_callback_port` for the callback listener port. Local callback URLs (for example `localhost`) bind on the local interface; non-local callback URLs bind on `0.0.0.0` so the callback can reach the host.
93
94If the MCP server advertises `scopes_supported`, Codex prefers those
95server-advertised scopes during OAuth login. Otherwise, Codex falls back to the
96scopes configured in `config.toml`.
79 97
80#### config.toml examples98#### config.toml examples
81 99
83[mcp_servers.context7]101[mcp_servers.context7]
84command = "npx"102command = "npx"
85args = ["-y", "@upstash/context7-mcp"]103args = ["-y", "@upstash/context7-mcp"]
104env_vars = ["LOCAL_TOKEN"]
86 105
87[mcp_servers.context7.env]106[mcp_servers.context7.env]
88MY_ENV_VAR = "MY_ENV_VALUE"107MY_ENV_VAR = "MY_ENV_VALUE"
89```108```
90 109
110```toml
111# Optional MCP OAuth callback overrides (used by `codex mcp login`)
112mcp_oauth_callback_port = 5555
113mcp_oauth_callback_url = "https://devbox.example.internal/callback"
114```
115
91```toml116```toml
92[mcp_servers.figma]117[mcp_servers.figma]
93url = "https://mcp.figma.com/mcp"118url = "https://mcp.figma.com/mcp"
109 134
110The list of MCP servers keeps growing. Here are a few common ones:135The list of MCP servers keeps growing. Here are a few common ones:
111 136
112137- [OpenAI Docs MCP](/resources/docs-mcp): Search and read OpenAI developer docs.- [OpenAI Docs MCP](/learn/docs-mcp): Search and read OpenAI developer docs.
113- [Context7](https://github.com/upstash/context7): Connect to up-to-date developer documentation.138- [Context7](https://github.com/upstash/context7): Connect to up-to-date developer documentation.
114- Figma [Local](https://developers.figma.com/docs/figma-mcp-server/local-server-installation/) and [Remote](https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/): Access your Figma designs.139- Figma [Local](https://developers.figma.com/docs/figma-mcp-server/local-server-installation/) and [Remote](https://developers.figma.com/docs/figma-mcp-server/remote-server-installation/): Access your Figma designs.
115- [Playwright](https://www.npmjs.com/package/@playwright/mcp): Control and inspect a browser using Playwright.140- [Playwright](https://www.npmjs.com/package/@playwright/mcp): Control and inspect a browser using Playwright.