Codex extension in vscode: MCP server (Context7) fails with “request timed out”
What version of Codex is running?
0.4.3
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?
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 = "C:\Program Files\nodejs\npx.cmd" args = ["-y","@upstash/context7-mcp@latest","--transport","stdio"] => 🖐 MCP client for context7 failed to start: request timed out
So i change: Install Context7 globally and link to it directly:
npm i -g @upstash/context7-mcp
Config:
[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","st
=> i work but unfortunately, I keep getting errors like this :( "result": { "Ok": { "content": [ { "text": "Error searching libraries: TypeError: fetch failed", "type": "text" } ] }
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
Almost all mcps servers encounter this problem in windows, I believe it's related to a winsocket error.
@ahSOLO This isn't the main issue. The core problem is that codex's MCP timeout defaults to 10 seconds. Even when we manually execute "npx -y @upstash/context7-mcp" in the terminal, it exceeds 10 seconds.
same here:
>_ You are using OpenAI Codex in ~/code/lobe-chat
To get started, describe a task or try one of these commands:
/status - show current session configuration and token usage
/approvals - choose what Codex can do without approval
/model - choose what model and reasoning effort to use
🖐 MCP client for `SearXNG` failed to start: request timed out
🖐 MCP client for `vscode-mcp` failed to start: request timed out
🖐 MCP client for `context7` failed to start: request timed out
🖐 MCP client for `chrome-mcp` failed to start: request timed out
@ahSOLO This isn't the main issue. The core problem is that codex's MCP timeout defaults to 10 seconds. Even when we manually execute "npx -y @upstash/context7-mcp" in the terminal, it exceeds 10 seconds.
Yeah I understand the timeout is too low, but even if you find a way around that (local installation, proxy server), you'll still get that error on a native Windows environment due to the winsocket error. For me I had to use WSL to escape it.
Same problem here.
It was working ok in my 2 computers, but after a few days stopped working in both.
没用的,我设置超时为600秒,照样超时
@luodaoyi Check out my solution! 😉 https://github.com/openai/codex/issues/3385
Thanks @sfz009900, TLDR; just add startup_timeout_ms = XXXXX for each mcp
# example
[mcp_servers.playwright]
command = "npx"
startup_timeout_ms = 20_000
args = ["@playwright/mcp@latest"]
because some MCP installations take longer than the codex default timeout.
Thanks @sfz009900, TLDR; just add
startup_timeout_ms = XXXXXfor each mcp# example [mcp_servers.playwright] command = "npx" startup_timeout_ms = 20_000 args = ["@playwright/mcp@latest"]because some MCP installations take longer than the codex default timeout.
不是timeout的问题是环境变量的问题!环境变量设置后期才可以正常启动mcp,否则timeout不管改多少都会超时
I'm using mac and same things happen to me as well....
For Windows users, this works for me with Codex 0.38.0:
[mcp_servers.context7]
command = "cmd"
args = [
"/c",
"npx",
"-y",
"@upstash/context7-mcp",
"--api-key",
"your-key",
]
env = { SystemRoot="C:\\Windows" }
startup_timeout_ms = 20_000
@wbdb env = { SystemRoot="C:\Windows" } ,This method is effective, very good
After testing, I found the following three feasible solutions:
- Start context7-mcp directly (context7 must be installed in advance):
[mcp_servers.context7]
command = "C:\\Users\\{Your Windows Username}\\AppData\\Roaming\\npm\\context7-mcp.cmd"
args = []
- Use the absolute path for npx (using
npxinstead of path will result in an error stating that the program not found):
[mcp_servers.context7]
command = "C:\\Users\\{Your Windows Username}\\AppData\\Roaming\\npm\\npx.cmd"
args = [
"-y",
"@upstash/context7-mcp"
]
env = { SystemRoot="C:\\Windows", APPDATA="C:\\Users\\{Your Windows Username}\\AppData\\Roaming" }
- Use cmd:
[mcp_servers.context7]
command = "cmd"
args = [
"/c",
"npx",
"-y",
"@upstash/context7-mcp"
]
env = { SystemRoot="C:\\Windows", APPDATA="C:\\Users\\{Your Windows Username}\\AppData\\Roaming" }
Among them, the env configuration is required for the 2nd and 3rd plans. If you still receive a "request timed out" message, add the following line: startup_timeout_ms = 20_000 to resolve the issue.
The direct cause of this issue is the environment variable whitelist.
codex-rs/mcp-client/src/mcp_client.rs:435
https://github.com/openai/codex/issues/4180
I think this issue is now addressed by the changes to the environment variable whitelist. If you see any further problems related to this, please let us know.