codex - 💡(How to fix) Fix Codex App starts a full local MCP process stack per opened chat/thread, causing memory and process growth [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20980Fetched 2026-05-05 05:55:04
View on GitHub
Comments
2
Participants
3
Timeline
12
Reactions
0
Author
Timeline (top)
labeled ×7commented ×2cross-referenced ×2closed ×1

Code Example

Baseline after restart:
Codex + descendants: 98 processes
Working set: ~5.14 GB
Direct app-server children: mostly 2 instances per MCP server, chrome-devtools 3

After opening one old Codex chat and returning to the original chat:
Codex + descendants: 142 processes
Working set: ~7.46 GB
Direct app-server children: mostly 3 instances per MCP server, chrome-devtools 4

Delta from just opening another chat:
+44 processes
+~2.33 GB working set
+1 local MCP stack

---

node.exe      24 -> 36
python.exe    16 -> 24
uv.exe         8 -> 12
cmd.exe       22 -> 33

---

MCP: chrome-devtools   16 processes   ~951 MB
MCP: firebase          12 processes   ~720 MB
MCP: yfinance          15 processes   ~708 MB
MCP: shadcn            12 processes   ~679 MB
MCP: markitdown        15 processes   ~679 MB
MCP: postman           12 processes   ~640 MB
MCP: context7          12 processes   ~560 MB
MCP: avanza            15 processes   ~492 MB
MCP: excel             15 processes   ~443 MB
MCP: tauri              6 processes   ~205 MB

---

[mcp_servers.chrome_devtools]
command = "npx"
args = [
  "--registry",
  "https://registry.npmjs.org",
  "[email protected]",
  "--browser-url=http://127.0.0.1:9222"
]

[mcp_servers.markitdown]
command = "uvx"
args = [ "markitdown-mcp" ]
enabled = true

[mcp_servers.excel]
command = "uvx"
args = [ "excel-mcp-server", "stdio" ]

[mcp_servers.shadcn]
command = "npx"
args = [ "shadcn@latest", "mcp" ]

[mcp_servers.zotero]
command = "uvx"
args = [ "--upgrade", "zotero-mcp", "--transport", "stdio" ]
enabled = false

[mcp_servers.notion]
url = "https://mcp.notion.com/mcp"
enabled = false

[mcp_servers.postman]
command = "npx"
args = [ "@postman/postman-mcp-server", "--minimal" ]
enabled = true

[mcp_servers.context7]
command = "npx"
args = [ "-y", "@upstash/context7-mcp", "--api-key", "[REDACTED]" ]

[mcp_servers.firebase]
command = "npx"
args = [ "-y", "firebase-tools@latest", "mcp" ]

[mcp_servers.tauri_mcp_server]
command = "mcp-server-tauri"
enabled = true

[mcp_servers.yfinance]
command = "uvx"
args = [ "--with", "tabulate", "yfmcp@latest" ]

[mcp_servers.avanza]
command = "uvx"
args = [ "--prerelease=allow", "avanza-mcp==1.3.0" ]

---

Codex App version from About Codex dialog: 26.429.30905
Windows package version from Get-AppxPackage: 26.429.3425.0
Platform field: Microsoft Windows NT 10.0.26200.0 x64
Windows edition/build: Microsoft Windows 11 Home, version 10.0.26200, build 26200
Physical RAM: 31.2 GB
RAW_BUFFERClick to expand / collapse

What version of the Codex App are you using (From “About Codex” dialog)?

26.429.30905

What subscription do you have?

ChatGPT Pro ($100/month)

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Opening a second/old Codex App chat appears to initialize another full local stdio MCP process stack and keep it alive after returning to the original chat. This causes process count and memory usage to grow even when no MCP tools are used directly in that opened chat.

Observed after a fresh Codex restart:

Baseline after restart:
Codex + descendants: 98 processes
Working set: ~5.14 GB
Direct app-server children: mostly 2 instances per MCP server, chrome-devtools 3

After opening one old Codex chat and returning to the original chat:
Codex + descendants: 142 processes
Working set: ~7.46 GB
Direct app-server children: mostly 3 instances per MCP server, chrome-devtools 4

Delta from just opening another chat:
+44 processes
+~2.33 GB working set
+1 local MCP stack

This was measured from the Windows process tree under the Codex app/core process. The process growth was visible in node.exe, python.exe, uv.exe/uvx.exe, cmd.exe, and MCP-specific processes.

Examples from the before/after measurement:

node.exe      24 -> 36
python.exe    16 -> 24
uv.exe         8 -> 12
cmd.exe       22 -> 33

MCP role grouping after opening the old chat:

MCP: chrome-devtools   16 processes   ~951 MB
MCP: firebase          12 processes   ~720 MB
MCP: yfinance          15 processes   ~708 MB
MCP: shadcn            12 processes   ~679 MB
MCP: markitdown        15 processes   ~679 MB
MCP: postman           12 processes   ~640 MB
MCP: context7          12 processes   ~560 MB
MCP: avanza            15 processes   ~492 MB
MCP: excel             15 processes   ~443 MB
MCP: tauri              6 processes   ~205 MB

This feels like MCP servers are scoped to each chat/thread/session runtime rather than shared at the Codex app level, or old chat runtimes are not being torn down promptly.

What steps can reproduce the bug?

  1. Configure multiple local stdio MCP servers in %USERPROFILE%\.codex\config.toml.
  2. Fully restart the Codex desktop app.
  3. In the first Codex chat/thread, measure the process tree under the Codex app/core process.
  4. Open one older Codex chat/thread from the Codex app UI.
  5. Return to the original chat/thread.
  6. Measure the process tree again.

Actual result: opening the older chat adds another local MCP stack. In my case the process tree grew from 98 processes / ~5.14 GB to 142 processes / ~7.46 GB.

The relevant MCP config, with secrets redacted, is:

[mcp_servers.chrome_devtools]
command = "npx"
args = [
  "--registry",
  "https://registry.npmjs.org",
  "[email protected]",
  "--browser-url=http://127.0.0.1:9222"
]

[mcp_servers.markitdown]
command = "uvx"
args = [ "markitdown-mcp" ]
enabled = true

[mcp_servers.excel]
command = "uvx"
args = [ "excel-mcp-server", "stdio" ]

[mcp_servers.shadcn]
command = "npx"
args = [ "shadcn@latest", "mcp" ]

[mcp_servers.zotero]
command = "uvx"
args = [ "--upgrade", "zotero-mcp", "--transport", "stdio" ]
enabled = false

[mcp_servers.notion]
url = "https://mcp.notion.com/mcp"
enabled = false

[mcp_servers.postman]
command = "npx"
args = [ "@postman/postman-mcp-server", "--minimal" ]
enabled = true

[mcp_servers.context7]
command = "npx"
args = [ "-y", "@upstash/context7-mcp", "--api-key", "[REDACTED]" ]

[mcp_servers.firebase]
command = "npx"
args = [ "-y", "firebase-tools@latest", "mcp" ]

[mcp_servers.tauri_mcp_server]
command = "mcp-server-tauri"
enabled = true

[mcp_servers.yfinance]
command = "uvx"
args = [ "--with", "tabulate", "yfmcp@latest" ]

[mcp_servers.avanza]
command = "uvx"
args = [ "--prerelease=allow", "avanza-mcp==1.3.0" ]

What is the expected behavior?

I would expect local MCP servers to either be shared at the Codex app/app-server level when possible, or for inactive chat/thread runtimes to tear down their stdio MCP processes promptly when the user leaves the thread.

At minimum, opening an old chat and returning should not permanently increase the app's baseline by another full MCP stack (~2.3 GB on my machine) unless that chat remains actively running work that needs those tools.

Additional information

Machine/environment:

Codex App version from About Codex dialog: 26.429.30905
Windows package version from Get-AppxPackage: 26.429.3425.0
Platform field: Microsoft Windows NT 10.0.26200.0 x64
Windows edition/build: Microsoft Windows 11 Home, version 10.0.26200, build 26200
Physical RAM: 31.2 GB

Related issues I found before filing:

  • #12491 reported large numbers of Codex/node processes and high RSS/swap usage from unreaped Codex workers/MCP child processes.
  • #12976 reported Windows-specific MCP child processes remaining after subagents closed.
  • #14233 reported long-lived sessions accumulating repeated stdio MCP stacks.
  • #18333 described Codex Desktop starting full MCP stacks for new sessions/subagents and memory pressure increasing.

I also saw PR #19753, "Terminate stdio MCP servers on shutdown to avoid process leaks", merged Apr 28 2026. My current observation is on Codex App 26.429.30905 after a fresh restart. This may be different from shutdown leaks: the extra MCP stack is created simply by opening another existing chat/thread and does not disappear immediately after returning to the original chat.

The main user-visible impact is that browsing between old chats can grow Codex from about 5 GB to 7.5 GB with one additional chat, and previously I observed about 11 GB after more chat/thread switching.

extent analysis

TL;DR

The issue can be mitigated by implementing a mechanism to share local MCP servers at the Codex app level or to tear down inactive chat/thread runtimes promptly.

Guidance

  1. Review MCP server configuration: Examine the config.toml file to ensure that MCP servers are properly configured to be shared or torn down when not in use.
  2. Investigate Codex app architecture: Understand how the Codex app manages MCP servers and chat/thread runtimes to identify potential areas for improvement.
  3. Monitor process creation and termination: Use tools like the Windows process tree to monitor the creation and termination of processes when opening and closing chats to identify any issues with process management.
  4. Test with different chat/thread scenarios: Test the app with different chat/thread scenarios to see if the issue persists and to identify any patterns or triggers.
  5. Consider implementing a cleanup mechanism: Implement a mechanism to periodically clean up inactive MCP servers and chat/thread runtimes to prevent process accumulation.

Example

No code snippet is provided as the issue is related to the Codex app's architecture and configuration.

Notes

The issue may be related to the way the Codex app manages MCP servers and chat/thread runtimes. Further investigation is needed to determine the root cause and to identify the best solution.

Recommendation

Apply a workaround by implementing a cleanup mechanism to periodically clean up inactive MCP servers and chat/thread runtimes. This can help mitigate the issue until a more permanent solution is found.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING