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
Some MCP servers take several seconds to start. If there’s an error, Codex waits 60s before timing out.
This makes the CLI startup feel slow (though I can start typing immediately). That's a little distracting when we're not using those MCPs in that session.
Could MCPs be:
Loaded on demand when first invoked in a conversation?
Loaded explicitly via a command-line option (e.g. --with-mcp=playwright,github)
That'd keep startup fast and let us use MCPs when needed.
Are you interested in implementing this feature?
Yes, I'd love to!
Additional information
It's great that Codex is lightweight - interface and feature-wise. I'd love to keep it that way. Happy to understand alternative approaches.
Reacted by smat-dev, Miguel Ripoll, Kyeong Jun (Eric) Lee , Artyom Peredery, Prudhvi Krovvidi, Johannes Bill, Ivan Vaigult, Dante, Kevin Lin, Tyce Herrman and 37 more
Hitting the same issue on Windows with Codex CLI 0.116.0.
In my case I have multiple stdio MCP servers enabled in config at the same time, including context7, chrome-devtools, and image tooling launched via npx.
The current workarounds are only partial:
enabled = false disables the server entirely
startup_timeout_sec only reduces how long startup waits
For local CLI usage, this feels like the wrong default. Paying startup cost for unused MCP servers on every run makes Codex feel slower even in sessions where I only need plain coding help.
What would help:
lazy-load MCP servers on first use
allow a CLI allowlist such as --with-mcp=context7,chrome-devtools
optionally load only required = true servers at startup
support an in-session command to load a server manually
This is more of a local CLI UX issue than just a timeout tuning issue.
+1 here. I'm running multiple codex instances, often 8-10 at a time, all of them running all mcp servers all the time for no reason, I have +10 chromium instances running because of chrome-devtools-mcp alone...
Adding a current Codex CLI data point from codex-cli 0.133.0.
This is still a real UX issue for rarely used MCP servers. In my setup, browser-control and browser-screen-click MCPs are only needed occasionally, but Codex tries to initialize them during session startup. When one is unhealthy, startup prints warnings like:
MCP client for `browser-control` failed to start: MCP startup failed: handshaking with MCP server failed: connection closed: initialize response
MCP startup incomplete (failed: browser-control)
The same applies to remote MCPs such as Atlassian: even if the current prompt does not need Jira/Confluence, the session still pays the startup/auth/network cost and can show unrelated MCP failures.
I checked the rust-v0.133.0 source to make sure this is not just configuration I missed:
config/src/mcp_types.rs: McpServerConfig has enabled, required, startup_timeout_sec/ms, tool filters, auth fields, etc., but no server-level lazy/manual startup mode.
core/src/session/session.rs: session setup calls McpConnectionManager::new(...) for the effective MCP server set.
codex-mcp/src/connection_manager.rs: McpConnectionManager::new iterates every server.enabled() and starts an AsyncManagedClient for each.
codex-mcp/src/rmcp_client.rs: startup performs MCP initialize and tools/list before the server's tools are considered ready.
tool_search_always_defer_mcp_tools only defers model-facing tool exposure behind tool_search; it does not defer server process/network startup.
The behavior I would expect is a server-level mode, for example:
lazy: do not start the MCP server during session startup; start it on first tool/resource/template call, or when tool_search selects one of its tools.
manual: never auto-start; only start via something like /mcp load <server> or a CLI allowlist.
required = true can keep eager/blocking behavior, or at least fail the session if the required server cannot be started before first use.
For tool_search, it would be useful if Codex could search known tool metadata without requiring live server startup on every session. That could come from a cached prior tools/list, plugin-provided/static tool metadata, or a placeholder entry that triggers server initialization when selected.
Current workarounds (enabled = false, profiles, lower startup_timeout_sec) are coarse. They either remove the tools entirely or require restarting/reprofiling Codex for a tool that might be needed once in a long-running session.
This is so insane that there's no option to only start an MCP server when it's needed.
If I leave Codex running unchecked I have to go and manually kill literally hundreds of node, uv and python processes that are taking up non inconsequential amounts of CPU and ram. Codex is instantiating these for every single sub agent even when they are only used maybe 1 out of 100 sessions. So I either have to constantly go in and out of config to enable/disable when I need each or just let them run and start up every time. Very frustrating.
One more here with the same problem.
Codex connected to my MCP server, if it's enabled, handshaking my server by itself. Therefore it wakes up server out of hibernation and never let it hibernate.
It should ping server only when request is made.
That is same as you would load whole database table, just because you 'might need' some data.
I reproduced this with a Streamable HTTP server on Codex app-server 0.160.0 (macOS arm64). The MCP server and model endpoint were both loopback fixtures. Each fresh thread received a greeting followed by a request for one tool result, with a 250 ms delay on tools/list.
For each of startup_readiness = "connection" and "catalog", the cold thread and two new warm threads all sent one initialize and one tools/list during the greeting, and zero tools/call. The follow-up made one tool call in every thread and the result reached the final reply. The first model request took 319 ms cold for both modes. Warm times overlapped (51–85 ms for connection, 54–76 ms for catalog). Cache readiness let the warm greeting proceed while the remote request was already underway.
In the native session startup selection, regular chats and subagents use different startup policies. A narrow way forward for warm chats is to reuse the existing identity-bound deferred HTTP client when the operator explicitly selects catalog readiness. Cold catalogs still need discovery. A first-use guarantee even for cold conversations would need an advertisement that can trigger discovery before exposing the live schema. Keeping tool execution in Codex also preserves the thread's native MCP policy and approvals.
An embedding integration can impose its own catalog wait before starting Codex. openclaw/openclaw#202199 tracks that separate stage.
I also tried that narrow implementation against native main at 45ace810. The production change selects the existing deferred client for eligible cached Streamable HTTP servers in regular chats that opt into catalog readiness. Six native integration cases passed, including the default connection mode, header-helper exclusion, subagent behavior and the model receiving the selected tool's actual output. The first cold discovery is still required.
For a timing comparison on the same Apple Silicon machine I used the same candidate binary for both modes and added 250 ms to the synthetic server's initialize response. Each new chat followed one warm-up discovery. In three runs the median greeting time was 418 ms with connection readiness and 139 ms with deferred catalog readiness. The first actual tool turn took 221 ms and 469 ms respectively. The greeting added zero HTTP requests in the deferred case; the later native call connected and returned its result in the original thread.
Activity
xqdd commentedon Dec 23, 2025
see also anthropics/claude-code#11364
dante01yoon commentedon Jan 17, 2026
This should be shipped soooooon...
Eriz1818 commentedon Feb 4, 2026
I implemented optional / lazy loading of MCP servers in my fork, xCodex (
xcodex), and shipped it in v0.3.5.xCodex: https://github.com/Eriz1818/xCodex
Release notes: https://github.com/Eriz1818/xCodex/blob/main/docs/xcodex/releases/0.3.5.md
Docs: https://github.com/Eriz1818/xCodex/blob/main/docs/xcodex/lazy-mcp-loading.md
What it adds:
/mcp load <name>(plus/mcpstatus +/mcp retry ...)xcodex --mcp-startup-mode lazy(or eager/manual)This keeps startup fast for sessions that don’t use MCP, while still making it easy to opt-in when you do. AND saving on context!
songunity commentedon Mar 27, 2026
Hitting the same issue on Windows with Codex CLI 0.116.0.
In my case I have multiple stdio MCP servers enabled in config at the same time, including
context7,chrome-devtools, and image tooling launched vianpx.The current workarounds are only partial:
enabled = falsedisables the server entirelystartup_timeout_seconly reduces how long startup waitsFor local CLI usage, this feels like the wrong default. Paying startup cost for unused MCP servers on every run makes Codex feel slower even in sessions where I only need plain coding help.
What would help:
--with-mcp=context7,chrome-devtoolsrequired = trueservers at startupThis is more of a local CLI UX issue than just a timeout tuning issue.
wintercounter commentedon Apr 24, 2026
+1 here. I'm running multiple codex instances, often 8-10 at a time, all of them running all mcp servers all the time for no reason, I have +10 chromium instances running because of chrome-devtools-mcp alone...
odlev commentedon May 26, 2026
Adding a current Codex CLI data point from
codex-cli 0.133.0.This is still a real UX issue for rarely used MCP servers. In my setup, browser-control and browser-screen-click MCPs are only needed occasionally, but Codex tries to initialize them during session startup. When one is unhealthy, startup prints warnings like:
The same applies to remote MCPs such as Atlassian: even if the current prompt does not need Jira/Confluence, the session still pays the startup/auth/network cost and can show unrelated MCP failures.
I checked the
rust-v0.133.0source to make sure this is not just configuration I missed:config/src/mcp_types.rs:McpServerConfighasenabled,required,startup_timeout_sec/ms, tool filters, auth fields, etc., but no server-level lazy/manual startup mode.core/src/session/session.rs: session setup callsMcpConnectionManager::new(...)for the effective MCP server set.codex-mcp/src/connection_manager.rs:McpConnectionManager::newiterates everyserver.enabled()and starts anAsyncManagedClientfor each.codex-mcp/src/rmcp_client.rs: startup performs MCPinitializeandtools/listbefore the server's tools are considered ready.tool_search_always_defer_mcp_toolsonly defers model-facing tool exposure behindtool_search; it does not defer server process/network startup.The behavior I would expect is a server-level mode, for example:
Possible semantics:
eager: current behavior.lazy: do not start the MCP server during session startup; start it on first tool/resource/template call, or whentool_searchselects one of its tools.manual: never auto-start; only start via something like/mcp load <server>or a CLI allowlist.required = truecan keep eager/blocking behavior, or at least fail the session if the required server cannot be started before first use.For
tool_search, it would be useful if Codex could search known tool metadata without requiring live server startup on every session. That could come from a cached priortools/list, plugin-provided/static tool metadata, or a placeholder entry that triggers server initialization when selected.Current workarounds (
enabled = false, profiles, lowerstartup_timeout_sec) are coarse. They either remove the tools entirely or require restarting/reprofiling Codex for a tool that might be needed once in a long-running session.sarendipitee commentedon Jun 29, 2026
This is so insane that there's no option to only start an MCP server when it's needed.
If I leave Codex running unchecked I have to go and manually kill literally hundreds of
node,uvandpythonprocesses that are taking up non inconsequential amounts of CPU and ram. Codex is instantiating these for every single sub agent even when they are only used maybe 1 out of 100 sessions. So I either have to constantly go in and out of config to enable/disable when I need each or just let them run and start up every time. Very frustrating.nezaboravi commentedon Aug 22, 2026
One more here with the same problem.
Codex connected to my MCP server, if it's enabled, handshaking my server by itself. Therefore it wakes up server out of hibernation and never let it hibernate.
It should ping server only when request is made.
That is same as you would load whole database table, just because you 'might need' some data.
shannon0430 commentedon Nov 20, 2026
I reproduced this with a Streamable HTTP server on Codex app-server 0.160.0 (macOS arm64). The MCP server and model endpoint were both loopback fixtures. Each fresh thread received a greeting followed by a request for one tool result, with a 250 ms delay on tools/list.
For each of
startup_readiness = "connection"and"catalog", the cold thread and two new warm threads all sent one initialize and one tools/list during the greeting, and zero tools/call. The follow-up made one tool call in every thread and the result reached the final reply. The first model request took 319 ms cold for both modes. Warm times overlapped (51–85 ms for connection, 54–76 ms for catalog). Cache readiness let the warm greeting proceed while the remote request was already underway.In the native session startup selection, regular chats and subagents use different startup policies. A narrow way forward for warm chats is to reuse the existing identity-bound deferred HTTP client when the operator explicitly selects catalog readiness. Cold catalogs still need discovery. A first-use guarantee even for cold conversations would need an advertisement that can trigger discovery before exposing the live schema. Keeping tool execution in Codex also preserves the thread's native MCP policy and approvals.
An embedding integration can impose its own catalog wait before starting Codex. openclaw/openclaw#202199 tracks that separate stage.
I also tried that narrow implementation against native main at
45ace810. The production change selects the existing deferred client for eligible cached Streamable HTTP servers in regular chats that opt into catalog readiness. Six native integration cases passed, including the default connection mode, header-helper exclusion, subagent behavior and the model receiving the selected tool's actual output. The first cold discovery is still required.For a timing comparison on the same Apple Silicon machine I used the same candidate binary for both modes and added 250 ms to the synthetic server's initialize response. Each new chat followed one warm-up discovery. In three runs the median greeting time was 418 ms with connection readiness and 139 ms with deferred catalog readiness. The first actual tool turn took 221 ms and 469 ms respectively. The greeting added zero HTTP requests in the deferred case; the later native call connected and returned its result in the original thread.