Codex extension in vscode: MCP server (Context7) fails with “request timed out”

Resolved 💬 17 comments Opened Sep 8, 2025 by CongDon1207 Closed Nov 18, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

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_

View original on GitHub ↗

17 Comments

ahSOLO · 10 months ago

Almost all mcps servers encounter this problem in windows, I believe it's related to a winsocket error.

sfz009900 · 10 months ago

@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.

tjx666 · 10 months ago

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 · 10 months ago
@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.

RodrigoMunozP · 10 months ago

Same problem here.

It was working ok in my 2 computers, but after a few days stopped working in both.

luodaoyi · 10 months ago

没用的,我设置超时为600秒,照样超时

sfz009900 · 10 months ago

@luodaoyi
Check out my solution! 😉
https://github.com/openai/codex/issues/3385

luodaoyi · 10 months ago
@luodaoyi Check out my solution! 😉 #3385

It work‘s ! Thanks ,

CongDon1207 · 10 months ago
@luodaoyi Check out my solution! 😉 #3385

I tried your solution and it worked, thanks.

suraneti · 10 months ago
@luodaoyi Check out my solution! 😉 #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.

luodaoyi · 10 months ago
> @luodaoyi Check out my solution! 😉 #3385 Thanks @sfz009900, TLDR; just add startup_timeout_ms = XXXXX for each mcp ``toml # 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不管改多少都会超时

ryoppippi · 10 months ago

I'm using mac and same things happen to me as well....

wbdb · 10 months ago

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
Opawn · 10 months ago

@wbdb env = { SystemRoot="C:\\Windows" } ,This method is effective, very good

kv-chiu · 9 months ago

After testing, I found the following three feasible solutions:

  1. 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 = []
  1. Use the absolute path for npx (using npx instead 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" }
  1. 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.

kv-chiu · 9 months ago

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

etraut-openai contributor · 8 months ago

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.