You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ You can also use Codex with an API key, but this requires [additional setup](./d
61
61
62
62
### Model Context Protocol (MCP)
63
63
64
-
Codex CLI supports [MCP servers](./docs/advanced.md#model-context-protocol-mcp). Enable by adding an `mcp_servers` section to your `~/.codex/config.toml`.
64
+
Codex can access MCP servers. To configure them, refer to the [config docs](./docs/config.md#mcp_servers).
Copy file name to clipboardExpand all lines: codex-rs/README.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,15 @@ Codex supports a rich set of configuration options. Note that the Rust CLI uses
23
23
24
24
### Model Context Protocol Support
25
25
26
-
Codex CLI functions as an MCP client that can connect to MCP servers on startup. See the [`mcp_servers`](../docs/config.md#mcp_servers) section in the configuration documentation for details.
26
+
#### MCP client
27
27
28
-
It is still experimental, but you can also launch Codex as an MCP _server_ by running `codex mcp-server`. Use the [`@modelcontextprotocol/inspector`](https://github.com/modelcontextprotocol/inspector) to try it out:
28
+
Codex CLI functions as an MCP client that allows the Codex CLI and IDE extension to connect to MCP servers on startup. See the [`configuration documentation`](../docs/config.md#mcp_servers) for details.
29
+
30
+
#### MCP server (experimental)
31
+
32
+
Codex can be launched as an MCP _server_ by running `codex mcp-server`. This allows _other_ MCP clients to use Codex as a tool for another agent.
33
+
34
+
Use the [`@modelcontextprotocol/inspector`](https://github.com/modelcontextprotocol/inspector) to try it out:
Copy file name to clipboardExpand all lines: codex-rs/docs/codex_mcp_interface.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Codex MCP Interface [experimental]
1
+
# Codex MCP Server Interface [experimental]
2
2
3
-
This document describes Codex’s experimental MCP interface: a JSON‑RPC API that runs over the Model Context Protocol (MCP) transport to control a local Codex engine.
3
+
This document describes Codex’s experimental MCP server interface: a JSON‑RPC API that runs over the Model Context Protocol (MCP) transport to control a local Codex engine.
4
4
5
5
- Status: experimental and subject to change without notice
6
6
- Server binary: `codex mcp-server` (or `codex-mcp-server`)
Copy file name to clipboardExpand all lines: docs/advanced.md
+1-9Lines changed: 1 addition & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,7 @@ See the Rust documentation on [`RUST_LOG`](https://docs.rs/env_logger/latest/env
16
16
17
17
## Model Context Protocol (MCP)
18
18
19
-
The Codex CLI can be configured to leverage MCP servers by defining an [`mcp_servers`](./config.md#mcp_servers) section in `~/.codex/config.toml`. It is intended to mirror how tools such as Claude and Cursor define `mcpServers` in their respective JSON config files, though the Codex format is slightly different since it uses TOML rather than JSON, e.g.:
20
-
21
-
```toml
22
-
# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.
23
-
[mcp_servers.server-name]
24
-
command = "npx"
25
-
args = ["-y", "mcp-server"]
26
-
env = { "API_KEY" = "value" }
27
-
```
19
+
The Codex CLI and IDE extension is a MCP client which means that it can be configured to connect to MCP servers. For more information, refer to the [`config docs`](./config.md#connecting-to-mcp-servers).
Copy file name to clipboardExpand all lines: docs/config.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -335,40 +335,47 @@ Codex provides three main Approval Presets:
335
335
336
336
You can further customize how Codex runs at the command line using the `--ask-for-approval` and `--sandbox` options.
337
337
338
-
## MCP Servers
338
+
## Connecting to MCP servers
339
339
340
-
You can configure Codex to use [MCP servers](https://modelcontextprotocol.io/about) to give Codex access to external applications, resources, or services such as [Playwright](https://github.com/microsoft/playwright-mcp), [Figma](https://www.figma.com/blog/design-context-everywhere-you-build/), [documentation](https://context7.com/), and [more](https://github.com/mcp?utm_source=blog-source&utm_campaign=mcp-registry-server-launch-2025).
340
+
You can configure Codex to use [MCP servers](https://modelcontextprotocol.io/about) to give Codex access to external applications, resources, or services.
341
341
342
-
### Server transport configuration
342
+
### Server configuration
343
343
344
344
#### STDIO
345
345
346
+
[STDIO servers](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#stdio) are MCP servers that you can launch directly via commands on your computer.
347
+
346
348
```toml
347
349
# The top-level table name must be `mcp_servers`
348
350
# The sub-table name (`server-name` in this example) can be anything you would like.
349
-
[mcp_servers.server-name]
351
+
[mcp_servers.server_name]
350
352
command = "npx"
351
353
# Optional
352
354
args = ["-y", "mcp-server"]
353
355
# Optional: propagate additional env vars to the MVP server.
354
356
# A default whitelist of env vars will be propagated to the MCP server.
[Streamable HTTP servers](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http) enable Codex to talk to resources that are accessed via a http url (either on localhost or another domain).
367
+
361
368
```toml
362
369
# Streamable HTTP requires the experimental rmcp client
363
370
experimental_use_rmcp_client = true
364
371
[mcp_servers.figma]
365
-
url = "http://127.0.0.1:3845/mcp"
372
+
url = "https://mcp.linear.app/mcp"
366
373
# Optional bearer token to be passed into an `Authorization: Bearer <token>` header
367
-
# Use this with caution because the token is in plaintext.
374
+
# Use this with caution because the token is in plaintext and can be read by Codex itself.
368
375
bearer_token = "<token>"
369
376
```
370
377
371
-
Refer to the MCP CLI commands for oauth login
378
+
For oauth login, you must enable `experimental_use_rmcp_client = true` and then run `codex mcp login server_name`
372
379
373
380
### Other configuration options
374
381
@@ -381,17 +388,25 @@ tool_timeout_sec = 30
381
388
382
389
### Experimental RMCP client
383
390
384
-
Codex is transitioning to the [official Rust MCP SDK](https://github.com/modelcontextprotocol/rust-sdk) and new functionality such as streamable http servers will only work with the new client.
391
+
Codex is transitioning to the [official Rust MCP SDK](https://github.com/modelcontextprotocol/rust-sdk).
392
+
393
+
The flag enabled OAuth support for streamable HTTP servers and uses a new STDIO client implementation.
385
394
386
395
Please try and report issues with the new client. To enable it, add this to the top level of your `config.toml`
387
396
388
397
```toml
389
398
experimental_use_rmcp_client = true
399
+
400
+
[mcp_servers.server_name]
401
+
…
390
402
```
391
403
392
404
### MCP CLI commands
393
405
394
406
```shell
407
+
# List all available commands
408
+
codex mcp --help
409
+
395
410
# Add a server (env can be repeated; `--` separates the launcher command)
396
411
codex mcp add docs -- docs-server --port 4000
397
412
@@ -413,6 +428,19 @@ codex mcp login SERVER_NAME
413
428
codex mcp logout SERVER_NAME
414
429
```
415
430
431
+
## Examples of useful MCPs
432
+
433
+
There is an ever growing list of useful MCP servers that can be helpful while you are working with Codex.
434
+
435
+
Some of the most common MCPs we've seen are:
436
+
437
+
-[Context7](https://github.com/upstash/context7) — connect to a wide range of up-to-date developer documentation
438
+
- 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 to your Figma designs
439
+
-[Playwright](https://www.npmjs.com/package/@playwright/mcp) - control and inspect a browser using Playwright
440
+
-[Chrome Developer Tools](https://github.com/ChromeDevTools/chrome-devtools-mcp/) — control and inspect a Chrome browser
441
+
-[Sentry](https://docs.sentry.io/product/sentry-mcp/#codex) — access to your Sentry logs
442
+
-[GitHub](https://github.com/github/github-mcp-server) — Control over your GitHub account beyond what git allows (like controlling PRs, issues, etc.)
443
+
416
444
## shell_environment_policy
417
445
418
446
Codex spawns subprocesses (e.g. when executing a `local_shell` tool-call suggested by the assistant). By default it now passes **your full environment** to those subprocesses. You can tune this behavior via the **`shell_environment_policy`** block in `config.toml`:
0 commit comments