Codex CLI on Windows 11: MCP server (Context7) fails with “request timed out”
What version of Codex is running?
0.23.0-0.31.0
Which model were you using?
GPT-5
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What steps can reproduce the bug?
OS: Windows 11 Pro (PowerShell 7 / Windows Terminal)
Codex CLI: 0.23.0
Node.js: 22.17.0, npm: 11.5.1
Context7 MCP: @upstash/context7-mcp (local)
Location of config: C:\Users\Name\\.codex\config.toml
I tried these variations in my config.toml:
[mcp_servers.context7]
args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
command = "npx"
=> 🖐 MCP client for context7 failed to start: program not found
[mcp_servers.context7]
command = "cmd"
args = ["/c","npx","-y","@upstash/context7-mcp"]
=> 🖐 MCP client for context7 failed to start: request timed out
[mcp_servers.context7]
command = "C:\\Program Files\\nodejs\\npx.cmd"
args = ["-y","@upstash/context7-mcp@latest","--transport","stdio"]
=> 🖐 MCP client for context7 failed to start: request timed out
[mcp_servers.context7]
command = "C:\\Program Files\\nodejs\\node.exe"
args = [
"C:\\Users\\Name\\AppData\\Roaming\\npm\\node_modules\\@upstash\\context7-mcp\\dist\\index.js",
"--transport","stdio"
]
[mcp_servers.context7.env]
LOCALAPPDATA = 'C:\\Users\\Name\\AppData\\Local'
APPDATA = 'C:\\Users\\Name\\AppData\\Roaming'
PROGRAMFILES = 'C:\\Program Files'
"PROGRAMFILES(X86)" = 'C:\\Program Files (x86)'
SYSTEMROOT = 'C:\\Windows'
WINDIR = 'C:\\Windows'
HOMEDRIVE = 'C:'
HOMEPATH = '\\Users\\Name'
HOME = 'C:\\Users\\Name'
=> 🖐 MCP client for context7 failed to start: request timed out
What is the expected behavior?
Using MCP Context7
What do you see instead?
MCP Errors
Additional information
Microsoft has invested so much in OpenAI, I don't understand why Windows is being treated so shabbily given its market share.
Showing cached comments. Read the full discussion on GitHub ↗
40 Comments
same issues
Temporary workaround:
Install Context7 globally and link to it directly:
npm i -g @upstash/context7-mcpConfig:
it works! you are my hero
@gurumnyang
But unfortunately, I keep getting errors like this :(
You too?
Added to the /mcp list, but when I tested it, I got the same error...
I now use it via Windows WSL. It works flawlessly there.
---
WSL
Open WSL:
wslEnable WSL 2:
wsl.exe --set-default-version 2Install Ubuntu 24.04 LTS:
wsl --install -d Ubuntu-24.04Set Ubuntu as default (for
wslstart):wsl --set-default Ubuntu-24.04List installed WSL distros:
wsl -l -vSwitch to a specific WSL distro:
wsl -d Ubuntu-24.04Execute a specific command directly:
wsl -d Ubuntu-24.04 ls -laExit WSL session:
exitShut down all WSL sessions:
wsl --shutdownTerminate a specific WSL session:
wsl --terminate Ubuntu-24.04---
Codex & Node.js
Check correct Linux version:
uname -aInstall updates:
sudo apt update && sudo apt upgrade -yInstall essential packages:
sudo apt install -y curl git build-essential unzipDownload and install fnm:
curl -o- https://fnm.vercel.app/install | bashDownload and install Node.js:
fnm install 22Reload shell:
source ~/.bashrcVerify Node.js version:
node -v(should print “v22.18.0”)Verify npm version:
npm -v(should print “10.9.3”)Update npm:
npm install -g npm@latestShow npm version:
npm --version(e.g. 11.5.2)Install Codex CLI:
npm install -g @openai/codexCheck Codex version:
codex --version---
MCP Context 7 Setup
Create config directory and file, then edit:
mkdir -p ~/.codex && touch ~/.codex/config.toml && nano ~/.codex/config.tomlAdd the following:
After spending (wasting) several hours troubleshooting this issue, I found a workaround:
1) install this http-stdio adapter: npm install -g mcp-remote
2) specify explicit environment variables in your: C:/Users/username/.codex/config.toml :
`
[mcp_servers.learn_mcp]
command = 'node'
args = [
'C:/Users/username/AppData/Roaming/npm/node_modules/mcp-remote/dist/proxy.js',
'https://learn.microsoft.com/api/mcp'
]
env = { APPDATA = 'C:\Users\username\AppData\Roaming', LOCALAPPDATA = 'C:\Users\username\AppData\Local', SystemRoot = 'C:\WINDOWS', COMSPEC = 'C:\WINDOWS\system32\cmd.exe' }
`
Hello, are there another install options?
Same issue here. The following is a quick way to fix it:
I was able to get this working with the server-memory MCP as well.
Update 1/9: I’m now using MCP-Router as the central gateway for all other MCP servers.
Then I only need to push this into config.toml:
I started to use Docker MCP Toolkit (you can find there Context7 MCP, Firecrawl, Playwrith and more). And it works for Codex CLI (and Codex VSCode extension).
<details><summary>Details</summary>
<p>
<img width="1151" height="1123" alt="Image" src="https://github.com/user-attachments/assets/17a3dc86-f445-4591-bcf9-e458783518b2" />
</p>
</details>
My config:
```toml**
[mcp_servers.toolkit]
command = "docker"
args = [
"mcp",
"gateway",
"run"
]
env = { "LOCALAPPDATA" = "C:\\Users\\<USER>\\AppData\\Local", "ProgramFiles" = "C:\\Program Files" }
Is there anyone who can resolve the error “Error searching libraries: TypeError: fetch failed” using Windows 11 cmd?
---------
It didn't work for me. Only the per-server entries below worked. Posting in case it helps others.
After a lot of failures trying to spawn MCP servers with
npxon Windows, I used ChatGPT to iterate on options and landed on a simple, reliable fix:---
Environment
---
Symptoms
npx @playwright/mcp@latestwould repeatedly “request timed out” when launched by Codex, even though it worked in MCP Inspector.---
What worked (Docker over STDIO)
Pre-pull (optional but speeds up first run):
docker pull mcp/playwright
docker pull mcp/fetch
Codex config: %USERPROFILE%\.codex\config.toml
[mcp_servers.fetch]
command = "docker"
args = ["run","--rm","-i","--init","--security-opt","no-new-privileges","mcp/fetch"]
[mcp_servers.fetch.env]
PYTHONIOENCODING = "utf-8"
PYTHONUNBUFFERED = "1" # avoids rare Python stdio stalls on Windows
[mcp_servers.playwright]
command = "docker"
args = ["run","--rm","-i","--init","--security-opt","no-new-privileges","mcp/playwright"]
Notes
Keep -i (STDIO attached). Don’t use -d.
Sanity checks
These should return help immediately:
docker run --rm -i mcp/playwright --help
docker run --rm -i mcp/fetch --help
To be fair, it should be noted that they do state that it is preferable to use it with WSL. However, now that the VS Code extension has been released, it is time for this to be implemented for Windows as well.
As mentioned, it runs very effectively with WSL, especially since it is already inclined to try Linux commands.
I think this PR could fix the timeout.
This may be helpful for anyone searching for help adding Dart and Firebase MCPs.
I was getting a related error: On Windows 11, Codex fails to start MCP servers with errors like:
🖐 MCP client for dart failed to start: program not found
🖐 MCP client for firebase failed to start: program not found
This happens because Codex spawns processes directly (no
cmd.exe), sodartandnpxon PATH aren’t found.For Firebase, running through
npxalso adds extra startup delay and prompts, causing Codex to time out.Fix
Wrap with
cmd.exe /c. No need for long paths.Also, pass a
--dirto Firebase so it doesn’t prompt at startup. (prompts cause timeout)As a workaround you can run mcp through docker;
Downside is to containerize every mcp you use
For example in ``
settings.toml``@medeiroshudson
=> MCP client for
context7failed to start: request timed out :(I just tested it again after the latest update (https://github.com/openai/codex/commit/cad37009e155b57697dced9795a2b04d7ec8fe3e). Unfortunately, the same error still occurs (timeout). Codex VS Code: Version
0.4.5 (from 2025-09-09). I no longer have Codex CLI on Windows, as I only use it under WSL now.
@wbdb i can confirm the latest codex cli (0.31) doesn't fix the issue on native Windows. But it doesn't seem like the latest version patch suppose to fix what's being discussed here, it's a separate bug.
https://github.com/openai/codex/releases/tag/rust-v0.31.0 now supports
startup_timeout_ms, so please use that!@bolinfest doesn't work on my end, all MCPs I configure still fail with timeout, but with a longer timeout now
config.toml
@bolinfest Several people have already tried it and it doesn't work? Why is it being made so difficult here?! That was exactly my fear, that the issue would simply be closed here. That's why I tested it right away. And before you close, you should read.
same here, latest codex and startup_timeout_ms set to 60000 and still timeout for all mcp clients.
The cil and plug-in made by OpenAI are semi-finished. I can't believe that such a big company has produced a semi-finished product, and the experience is really poor. Besides the model does not drop, I also have this problem. If it is used in the plug-in, it will also be super.
I'm on a Mac with the newest codex version and this keeps happening to me as well. Codex 0.36.0
MCP client for
context7failed to start: request timed out.I have tried to add the tolm multi ways like and none of them work:
Hi @tekn0x . It works for me via the installed global
mcp-remote. Here is the configuration (I use APi Key, but it should probably work without it):Unfortunately, that is not working and produces a new error:
MCP client for
context7failed to start: No such file or directory (os error 2)I wonder if it's a bug. Everything is working fine in other products.
@tekn0x Please tell me, did you install
mcp-remoteglobally in advance?Not the first time, but I just did now and it is working. Thank you so much. I really appreciate your help. I will have to test with some other MCP's tomorrow.
I hope the codex team figures out the issues with the other syntax using npx.
I also wanted to follow up if anyone else finds this thread. Thanks to the guidance of @VladimirLevadnij I was also able to get the "local" and "remote" mcp's running. Just use one or the other. For some reason, the node module got uninstalled. So if anyone else is having this issue, try this solution. First install the module in your project, then add the code to your config file, lastly start codex, wait a few seconds, and verify with /mcp
Install in project
npm install -g @upstash/context7-mcp
Add to ~/.codex/config.toml
[mcp_servers.context7]
args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
command = "npx"
Install in project
npm install -g mcp-remote
Add to ~/.codex/config.toml
[mcp_servers.context7]
command = "mcp-remote"
args = [
"https://mcp.context7.com/mcp",
"--header",
"CONTEXT7_API_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
]
disabled = false
I hope this helps someone.
@tekn0x I'm glad to hear that everything worked out for you. I hope that everything else in your life is fine, except for this problem. Everything works out, everything is moving towards a bright future, you are not being abducted by aliens👽, there is no evil dog living next to you 🐕 and so on 😁
For Windows users, this works for me with Codex 0.38.0:
I configured it successfully, as shown below:
@Opawn thanks man
YOU SAVED MY LIFE
This one worked for me, if anyone is interested, supabase communication would work similarly:
[mcp_servers.supabase]
command = "cmd"
args = [
"/c",
"npx",
"-y",
"@supabase/mcp-server-supabase@latest",
"--read-only",
"--project-ref=project_ref"
]
env = { SystemRoot="C:\\Windows", "SUPABASE_ACCESS_TOKEN" = "your_key" }
startup_timeout_ms = 20_000
If u r using uv, what works for me is declaring the python of the project used, for example:
nice work!
Fetching comments for context
Despite trying the solutions in this thead for Windows (no WSL), I landed on the working config below:
Working Solution for Codex v0.45.0
Run npm install -g mcp-remote