VS Code extension leaks and duplicates local stdio MCP processes on Windows

Resolved 💬 4 comments Opened Apr 22, 2026 by huandao-gonglu Closed Apr 22, 2026

What version of the IDE extension are you using?

openai.chatgpt-26.417.40842 (bundled codex-cli 0.122.0-alpha.13)

What subscription do you have?

Personal paid ChatGPT plan

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26200 x64

What issue are you seeing?

On native Windows, the VS Code Codex extension appears to leak and duplicate local stdio MCP server processes.

I have a single configured local MCP server:

[mcp_servers.my-mcp]
command = 'E:\WORK\myMcp\.venv\Scripts\python.exe'
args = ['E:\WORK\myMcp\server.py']

Observed behavior:

  1. Old codex.exe app-server --analytics-default-enabled processes remain alive after previous VS Code extension sessions/windows.
  2. Those stale app-server processes keep their MCP child processes alive.
  3. If I manually kill the stale Python children, the stale app-server processes respawn them.
  4. A single fresh app-server can also start the same configured MCP server more than once.

This causes the same local MCP server to accumulate multiple orphaned process trees over time.

What steps can reproduce the bug?

  1. Configure one local stdio MCP server in ~/.codex/config.toml:
[mcp_servers.my-mcp]
command = 'E:\WORK\myMcp\.venv\Scripts\python.exe'
args = ['E:\WORK\myMcp\server.py']
  1. Start the Codex VS Code extension and use a workspace that has this MCP enabled.
  2. Open/close VS Code windows or restart the extension a few times.
  3. Inspect processes on Windows, for example with:
Get-CimInstance Win32_Process |
  Where-Object { $_.Name -match '^(python|pythonw|codex)(\.exe)?$' } |
  Select-Object ProcessId,ParentProcessId,Name,CommandLine,CreationDate |
  Sort-Object Name,CreationDate | Format-List

What I observed:

  • stale codex.exe app-server processes from older sessions remain alive
  • those stale parents keep or respawn the MCP child processes
  • one fresh app-server can spawn the same MCP server twice

Example of one fresh extension process spawning the same configured MCP twice:

19236 codex.exe app-server --analytics-default-enabled
├─ 38708 "E:\WORK\myMcp\.venv\Scripts\python.exe" E:\WORK\myMcp\server.py
│  └─ 44412 "D:\ProgramData\miniconda3\python.exe" E:\WORK\myMcp\server.py
└─ 23156 "E:\WORK\myMcp\.venv\Scripts\python.exe" E:\WORK\myMcp\server.py
   └─ 45180 "D:\ProgramData\miniconda3\python.exe" E:\WORK\myMcp\server.py

What is the expected behavior?

For a single configured stdio MCP server, I would expect:

  • at most one live MCP process tree per live app-server owner
  • MCP child processes to exit when their owning app-server or VS Code session exits
  • stale app-server processes not to remain alive and not to respawn old MCP children

Additional information

Extension version: openai.chatgpt-26.417.40842
Bundled extension Codex binary: codex-cli 0.122.0-alpha.13
OS: Microsoft Windows NT 10.0.26200 x64

Notes:

  • The duplicate/leaked process ownership looks like the main bug.
  • The nested two-Python chain (.venv\python.exe -> miniconda3\python.exe -> server.py) may be environment-specific, but even if that part is expected, the extension still appears to be leaking and duplicating MCP process trees on Windows.
  • I can provide a fuller before/after process dump with PIDs and timestamps if needed.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗