Harness Notes

MCP

Updated 2026-11-25,

On this page

How to connect MCP servers to each harness and what their tools can do once connected. The protocol table at the end shows which parts of the MCP specification each client supports.

Setting up a server

QuestionCodex CLIchecked at 0.162.1
Add a server

Run codex mcp add <name> -- <command> [args] for a stdio server (with --env KEY=VALUE), or codex mcp add <name> --url <url> for a Streamable HTTP server. Either way, the server is written as a [mcp_servers.<name>] table in ~/.codex/config.toml. You can also edit that file or a project .codex/config.toml by hand, or use Settings > MCP servers in the desktop app or IDE extension, which share the same config.

codex mcp add always writes to the user-level config, never to a project file.

Plugins can bundle servers in .mcp.json; user config controls them under plugins.<plugin>.mcp_servers.<server>.

Transports

Codex supports stdio servers (command, args, env, env_vars, cwd) and Streamable HTTP servers (url). It has no separate config type for the legacy HTTP+SSE transport or for WebSocket. Setting experimental_environment = "remote" starts a stdio server through a remote executor.

Where configs live, and project trust

Servers live in ~/.codex/config.toml (user) or in .codex/config.toml files in a project. Project files are loaded from the project root down to the working directory, with the closest file winning, and only once you trust the project. Admins can set an allowlist in requirements.toml ([mcp_servers.<id>] identity = { command = ... } or { url = ... }). Any server that isn't on it is disabled, and an empty mcp_servers table disables all servers.

Trusting the project is the only gate: Codex has no separate per-server approval prompt for project-defined servers.

Sign in or pass credentials

For HTTP servers, you can set bearer_token_env_var, static http_headers, env_http_headers, or an http_headers_helper command that prints headers as JSON. For OAuth, run codex mcp login <name> (with --scopes and --no-browser available). Codex supports CIMD and DCR client registration plus pre-registered clients via --oauth-client-id/--oauth-client-secret, and codex mcp add starts the login automatically when it detects OAuth. Stdio servers get secrets through env or by forwarding variables listed in env_vars.

mcp_oauth_credentials_store (auto, file, keyring) chooses where OAuth tokens are stored; codex mcp logout <name> removes them.

auth = "chatgpt" reuses your ChatGPT session, but only for trusted first-party ChatGPT servers.

0.164.0 source: enterprise-managed authentication requires xaa_enabled and an enabled directly configured server with EMA registration. Eligible account-grant reuse checks issuer, identity and account ownership; a configured client secret additionally requires matching client identity, otherwise dedicated sign-in is needed. This does not apply automatically to every plugin server.

Using its tools

QuestionCodex CLIchecked at 0.162.1
Approve, allow or block tools

Each server takes a default_tools_approval_mode and each tool a tools.<tool>.approval_mode: auto (the default), prompt, writes or approve. auto asks unless the tool is annotated read-only (or explicitly non-destructive and closed-world), and writes asks for any tool not marked read-only. At the prompt you can allow once, allow for the session, allow and remember (which saves approval_mode = "approve" to config), or cancel. enabled_tools and disabled_tools hide tools completely.

With approval_policy = "never", a call that needs approval is denied, unless the sandbox has full write access, in which case it runs without a prompt.

Tool search & code mode

On models that support tool search, all MCP tools are deferred behind a built-in tool_search tool, and the model loads them on demand, so a large catalog doesn't fill the context. You can trim each server with enabled_tools (allow list) and disabled_tools (deny list, applied after the allow list), or turn a server off with enabled = false.

Tool search can't be turned off: the old tool_search and tool_search_always_defer_mcp_tools switches are retired and rejected.

Tool input schemas larger than tool_input_schema_max_bytes (default 5,000 bytes) are compacted.

Output size and timeouts

Set startup_timeout_sec (or startup_timeout_ms) and tool_timeout_sec per server. In 0.162.1 the built-in defaults are 30 s for startup and 300 s per tool call, while the docs still say 10 s and 60 s. Codex waits mcp_optional_startup_grace_ms (default 1000) for optional servers before the first turn, and a required = true server that fails to start aborts startup. Tool output is cut to the model's truncation budget unless you set tools.<tool>.output_token_limit or the global tool_output_token_limit.

When a tool call times out, the model gets an error result instead of tool output.

Resources

Partly

Yes, but only the model uses them. Codex gives the model built-in list_mcp_resources, list_mcp_resource_templates and read_mcp_resource tools for reading server resources. There is no @-mention or picker for attaching a resource yourself, though /mcp verbose lists each server's resources and templates.

Prompts

Not supported

No. Codex never lists or fetches MCP server prompts, so they don't show up as slash commands or anywhere else in the UI.

When a server asks you or the model

Partly

Codex 0.163.0 forwards MCP forms and URL requests through App Server. The TUI collects strings, booleans and single-select enums; unsupported standard forms fall back to a confirmation, so accept can lack the required data. Structured TUI forms use accept/cancel; URL dismissal maps to decline. The App Server reply envelope supports accept/decline/cancel, but backend forwarding does not validate answers against requestedSchema. exec cancels requests. Policy can decline prompts, with empty-confirmation auto-accept and eligible Full Access form-input exceptions. OpenAI extended forms are separate opt-ins. Roots and sampling remain unsupported on the registered legacy client.

Running servers

QuestionCodex CLIchecked at 0.162.1
Status, enable, reconnect, debug

Use codex mcp list and codex mcp get <name> (both accept --json) to see configured servers, /mcp in the TUI to see live servers and tools, /mcp verbose for full details including resources, and /mcp login <name> to sign in. To disable a server without deleting it, set enabled = false; codex mcp remove <name> deletes it. The desktop app and IDE extension have Restart buttons, and the TUI picks up config changes when you start a new session.

codex doctor includes an MCP configuration check.

Setting log_dir writes codex-tui.log, which includes server log messages and connection errors.

Run the harness as an MCP server

Not supported

No. codex mcp-server and the standalone codex-mcp-server binary were deprecated on 2026-08-24 and removed on 2026-09-05. Other clients should integrate through the experimental codex app-server instead.

Protocol features

FeatureCodex CLIprotocol 2025-06-18
Roots

Let a server discover the client-approved filesystem roots; this is not the server process working directory.

deprecated in the current spec

Not supported

The initialize request advertises only elicitation (plus OpenAI extensions); there is no roots capability or roots/list handler.

Source
Sampling

Let a server request an LLM interaction through the host, with user review and model preferences.

deprecated in the current spec

Not supported

No sampling capability is advertised and sampling/createMessage is not handled.

Source
Sampling with tools

Let the sampling loop invoke tools recursively; do not confuse this with ordinary server tool calls.

deprecated in the current spec

Not supported

Source
Elicitation (generic)

Server-originated MCP input requests, distinct from permission approvals, model ask-user tools, generic chat forms or MCP Apps. Check each mode and host separately.

Partly

0.163.0 source audit: form and URL advertised by default via stable auth_elicitation; disabling it retains form-only capability. Policy/reviewer routing, empty-confirmation auto-accept, and eligible post-startup Full Access form-input exceptions apply. No runtime probe.

Source
Form elicitation

Collect typed property-keyed answers using the restricted elicitation schema, with accept/decline/cancel. Schema parsing, UI validation and backend answer validation are separate claims.

Partly

App Server relays typed standard schemas and accept/decline/cancel with JSON content, but the ordinary backend reply path does not validate content against requestedSchema. TUI renders strings, booleans and single-select enums, checks required answers, omits string constraints, and falls back to an approval for unsupported number/multi-select fields. codex exec returns cancel. Structured TUI forms submit accept or cancel; decline is available in confirmation/approval variants, not a separate structured-form refusal control.

Source
URL elicitation

Direct the user to an external interaction without collecting its sensitive data. Acceptance is not completion; track legacy completion notifications separately from current MRTR retry.

Partly

0.163.0 TUI uses an external-link view with accept/decline; Escape/Ctrl-C maps to decline, without distinct cancel. App Server supports all three actions independently and is a host contract, not MCP wire. Acceptance does not prove browser completion; exec cancels. Modern MRTR is separately gated.

Source
Prompts

Expose reusable, argument-aware server prompts through the client UI.

Not supported

The client never calls prompts/list or prompts/get; server prompts are not exposed as commands.

Source
Resources

List and read server-provided context independently from tool execution.

Supported

Model-driven through built-in list_mcp_resources and read_mcp_resource tools; no @-mention picker.

Source
Resource templates

Discover and fill parameterized resource URIs.

Supported

The model lists templates with list_mcp_resource_templates and reads a filled URI with read_mcp_resource.

Source
Argument completion

Complete prompt arguments and resource-template parameters without an LLM call.

Not supported

Source
Progress

Correlate monotonic progress with a request; UI display and timeout extension are separate behaviors.

Partly

Server progress notifications are accepted and written to Codex's log only; model tool calls carry no progress token and nothing is shown in the UI or extends the timeout.

Source
Cancellation

Cooperatively cancel in-flight protocol requests and propagate intent to the handler.

Partly

Server-sent cancellation closes a pending prompt, and Codex cancels its own long-lived event-stream requests. Since 0.165.0, abandoning a pending tool call sends notifications/cancelled; 0.166.0 extends this to other requests only on shared connections (under-development mcp_connection_sharing, MCP 2026-07-28). No interoperability probe.

Source
Protocol logging

Deliver correlated server logs through MCP rather than relying on process stderr.

deprecated in the current spec

Partly

notifications/message is mapped to Codex's own log levels; logging/setLevel is never sent and nothing is shown in the UI.

Source
Subscriptions

Receive correlated updates over a long-lived request.

Not supported

resources/subscribe is never sent; update and list_changed notifications are only logged. A separate events/stream extension is used only for the built-in ChatGPT apps server. See Events and agent wake-up for the separately pinned 0.164.0 relay and CLI behavior.

Source
Multi-round-trip requests

Pause a request for sampling, elicitation, or roots input and retry it with opaque request state.

Partly

Only for tools/call, and only with the under-development mcp_2026_07_28 feature (off by default) against a server that negotiates 2026-07-28.

Source
Tasks (legacy)

Durable polling, status, result, and cancellation state from the 2025-11-25 experimental protocol era.

earlier experimental spec

Not supported

No tasks capability is advertised and no tasks/* requests are made.

Source
Tasks extension

Asynchronous tool results using io.modelcontextprotocol/tasks on 2026-07-28 connections, separate from legacy Tasks and client backgrounding.

separate protocol extension

Not supported

Source-audited at rust-v0.164.0 (6aaac694803004a63c6f393d153c96d22521a6b9): catalog registrations including host extensions/Apps use a shared call path that accepts normal results and input_required, not task results. App Server extension projection excludes io.modelcontextprotocol/tasks. This rates the built-in Rust client, not hosted server internals or desktop UI.

Source
Events and agent wake-up

External updates that can trigger agent work. ChatGPT Work documents signed webhook subscriptions; Codex has a separate hosted-app event stream. Receiving an event and starting a model turn are separate capabilities.

separate protocol extension

Partly

Codex 0.164.0 source audit: no automatic agent wake-up in the CLI TUI, which ignores event-stream notifications. Experimental App Server methods mcpServer/event/stream/start and /stop relay notifications to the requesting host; forwarding does not start or steer a model turn. The stream only accepts codex_apps registered by the host as its Apps service. Ordinary configured or plugin MCPs, including remote HTTP servers, do not qualify. Hosted apps means integrations through the hosted plugin service, not any server hosted online. A custom host can explicitly register a HostedApps provider; its context injection and turn delivery need separate verification. apps defaults on; the separate codex_apps_mcp_2026_07_28 protocol switch defaults off. This uses events/stream, distinct from ChatGPT Work webhook subscriptions. Source-inspected, not runtime-tested; desktop behavior and hosted availability remain unverified.

Source

Notes and sources

Codex CLI, 37 sources
  • Elicitation rechecked at rust-v0.163.0 (83086188ae0614bd882818ff1aa23f3194962012) on 2026-10-23; observedVersion and non-elicitation references retain the earlier 0.162.1 audit. App Server forwarding does not prove desktop, IDE or custom-host UI/validation. See docs/research/mcp-elicitation.md and its evidence artifact.
  • Tasks extension reviewed 2026-10-24; see docs/research/evidence/mcp-tasks-other-harnesses-2026-10-24.json. Other feature ratings and sourceRevision/observedVersion retain their independently dated audits.
  • 0.167.2 enables incremental_tools_legacy_gcp by default for the legacy GCP provider route; set [features] incremental_tools_legacy_gcp = false to opt out. Responses Lite uses its separate incremental_tools gate, and existing windows retain their recorded tool layout until a new window. This concerns model tool declaration delivery, not a new MCP capability or hosted protocol. Source inspection only.
  • 0.170.0 source: features.multi_environment_mcp is under development and default off. Configuration selects EnvironmentQualified catalog exposure when enabled; otherwise Legacy exposure groups declarations by name. Qualified registration keys distinguish the same server name by environment, and model tool namespaces include a stable environment hash. Registration scope is separate from execution location. This is client-side server identity, not a new MCP protocol revision or proof of desktop behavior; no runtime probe.
  • In 0.172.0, mcp_lazy_stdio_startup defaults on. In regular chats an eligible optional stdio server can advertise cached tools and start on first use. Deferral requires a current catalog containing an allowed tool. Explicit reconnects and selected plugin servers start eagerly.
Add a server, 2
Transports, 2
Where configs live, and project trust, 3
Sign in or pass credentials, 6
Approve, allow or block tools, 2
Tool search & code mode, 3
Output size and timeouts, 3
Resources, 2
Prompts, 1
When a server asks you or the model, 19
Status, enable, reconnect, debug, 4
Run the harness as an MCP server, 1