Skip to content

Codex CLI on Windows 11: MCP server (Context7) fails with “request timed out” #2555

Closed

Description

@wbdb

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.

Activity

  1. added
    bug
    on Aug 21, 2025
  2. added
    windows-os
    on Aug 21, 2025
  3. gurumnyang commented on Aug 21, 2025

    @gurumnyang

    same issues

  4. wbdb commented on Aug 21, 2025

    @wbdb
    Author

    Temporary workaround:

    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","stdio"]
    
  5. gurumnyang commented on Aug 21, 2025

    @gurumnyang

    it works! you are my hero

  6. wbdb commented on Aug 21, 2025

    @wbdb
    Author

    @gurumnyang

    But unfortunately, I keep getting errors like this :(

    tool running... context7.resolve-library-id({"libraryName":"CodeIgniter Shield"})
    tool success, duration: 84ms
    
    context7.resolve-library-id({"libraryName":"CodeIgniter Shield"})
    Error searching libraries: TypeError: fetch failed
    

    You too?

  7. gurumnyang commented on Aug 21, 2025

    @gurumnyang

    Added to the /mcp list, but when I tested it, I got the same error...

  8. wbdb commented on Aug 22, 2025

    @wbdb
    Author

    I now use it via Windows WSL. It works flawlessly there.


    WSL

    Open WSL: wsl
    Enable WSL 2: wsl.exe --set-default-version 2
    Install Ubuntu 24.04 LTS: wsl --install -d Ubuntu-24.04
    Set Ubuntu as default (for wsl start): wsl --set-default Ubuntu-24.04
    List installed WSL distros: wsl -l -v
    Switch to a specific WSL distro: wsl -d Ubuntu-24.04
    Execute a specific command directly: wsl -d Ubuntu-24.04 ls -la
    Exit WSL session: exit
    Shut down all WSL sessions: wsl --shutdown
    Terminate a specific WSL session: wsl --terminate Ubuntu-24.04


    Codex & Node.js

    Check correct Linux version: uname -a
    Install updates: sudo apt update && sudo apt upgrade -y
    Install essential packages: sudo apt install -y curl git build-essential unzip

    Download and install fnm:
    curl -o- https://fnm.vercel.app/install | bash

    Download and install Node.js:
    fnm install 22

    Reload shell: source ~/.bashrc

    Verify 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@latest
    Show npm version: npm --version (e.g. 11.5.2)

    Install Codex CLI: npm install -g @openai/codex
    Check 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.toml

    Add the following:

    [mcp_servers.context7]
    command = "npx"
    args = ["-y", "@upstash/context7-mcp"]
  9. evgenyop commented on Aug 25, 2025

    @evgenyop

    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' }
    `

  10. edulml98 commented on Aug 30, 2025

    @edulml98

    Hello, are there another install options?

  11. sting8k commented on Aug 30, 2025

    @sting8k

    Same issue here. The following is a quick way to fix it:

    [mcp_servers.context7]
    command = "C:\\.....\\nodejs\\node.exe"
    args = ["C:\\Users\\.....\\AppData\\Local\\npm-cache\\_npx\\.....\\node_modules\\@upstash\\context7-mcp\\dist\\index.js"]

    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:

    [mcp_servers.mcp-router]
    command = "C:\\...\\bin\\bun.exe" # Or node.exe
    args = [".....\\mcpr-cli\\dist\\mcpr.js", "connect"]
    env = { SystemRoot = 'C:\WINDOWS', COMSPEC = 'C:\WINDOWS\system32\cmd.exe' , MCPR_TOKEN = "<key>" } # Thanks @evgenyop 
    
  12. Xopoko commented on Aug 31, 2025

    @Xopoko

    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

    Image

    My config:

    [mcp_servers.toolkit]
    command = "docker"
    args = [
        "mcp",
        "gateway",
        "run"
    ]
    env = { "LOCALAPPDATA" = "C:\\Users\\<USER>\\AppData\\Local", "ProgramFiles" = "C:\\Program Files" }
    
  13. eburakars commented on Aug 31, 2025

    @eburakars

    Is there anyone who can resolve the error “Error searching libraries: TypeError: fetch failed” using Windows 11 cmd?

  14. hbiaou commented on Sep 1, 2025

    @hbiaou

    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
    My config:

    [mcp_servers.toolkit]
    command = "docker"
    args = [
        "mcp",
        "gateway",
        "run"
    ]
    env = { "LOCALAPPDATA" = "C:\\Users\\<USER>\\AppData\\Local", "ProgramFiles" = "C:\\Program Files" }
    

    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 npx on Windows, I used ChatGPT to iterate on options and landed on a simple, reliable fix:


    Environment

    • Windows 11
    • PowerShell 7.x
    • Docker Desktop
    • Codex CLI (latest at time of writing)

    Symptoms

    • npx @playwright/mcp@latest would 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

  15. wbdb commented on Sep 2, 2025

    @wbdb
    Author

    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.

  16. 20 remaining items

  17. tekn0x commented on Sep 16, 2025

    @tekn0x

    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

    • Local Version -
      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"

    • Remote Version -
      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.

  18. VladimirLevadnij commented on Sep 16, 2025

    @VladimirLevadnij

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

  19. wbdb commented on Sep 17, 2025

    @wbdb
    Author

    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
    
  20. Opawn commented on Sep 18, 2025

    @Opawn

    I configured it successfully, as shown below:

    [mcp_servers.Playwright]
    command = "cmd"
    args = ["/c", "npx", "@playwright/mcp@latest"]
    startup_timeout_ms = 20000
    
    [mcp_servers.Playwright.env]
    SystemRoot = 'C:\\Windows'
    
    [mcp_servers.context7]
    command = "cmd"
    args = ["/c", "npx", "-y", "@upstash/context7-mcp"]
    startup_timeout_ms = 30000
    
    [mcp_servers.context7.env]
    SystemRoot = 'C:\\Windows'
    
    [mcp_servers.serena]
    command = "uv"
    args = ["run", "--directory", 'D:\\mcp\\Serena\\serena', "serena-mcp-server"]
    startup_timeout_ms = 30000
    
    [mcp_servers.serena.env]
    SystemRoot = 'C:\\Windows'
    
    
    [mcp_servers.shadcn-ui]
    command = "cmd"
    args = ["/c", "npx", "shadcn@latest", "mcp"]
    startup_timeout_ms = 30000
    
    [mcp_servers.shadcn-ui.env]
    SystemRoot = 'C:\\Windows'
    
    /mcp
    
    🔌  MCP Tools
    
      • Server: context7
        • Command: cmd /c npx -y @upstash/context7-mcp
        • Tools: get-library-docs, resolve-library-id
    
      • Server: serena
        • Command: uv run --directory D:\\mcp\\Serena\\serena serena-mcp-server
        • Tools: activate_project, check_onboarding_performed, create_text_file, delete_lines, delete_memory,
    execute_shell_command, find_file, find_referencing_symbols, find_symbol, get_current_config, get_symbols_overview,
    initial_instructions, insert_after_symbol, insert_at_line, insert_before_symbol, list_dir, list_memories, onboarding,       
    prepare_for_new_conversation, read_file, read_memory, remove_project, replace_lines, replace_regex, replace_symbol_body,    
    restart_language_server, search_for_pattern, summarize_changes, switch_modes, think_about_collected_information,
    think_about_task_adherence, think_about_whether_you_are_done, write_memory
    
      • Server: Playwright
        • Command: cmd /c npx @playwright/mcp@latest
        • Tools: browser_click, browser_close, browser_console_messages, browser_drag, browser_evaluate, browser_file_upload,   
    browser_fill_form, browser_handle_dialog, browser_hover, browser_install, browser_navigate, browser_navigate_back,
    browser_network_requests, browser_press_key, browser_resize, browser_select_option, browser_snapshot, browser_tabs,
    browser_take_screenshot, browser_type, browser_wait_for
    
      • Server: shadcn-ui
        • Command: cmd /c npx shadcn@latest mcp
        • Tools: get_add_command_for_items, get_audit_checklist, get_item_examples_from_registries, get_project_registries,     
    list_items_in_registries, search_items_in_registries, view_items_in_registries
    
  21. DanielTrindade commented on Sep 21, 2025

    @DanielTrindade

    @Opawn thanks man

  22. just-pthai-it commented on Sep 21, 2025

    @just-pthai-it

    I configured it successfully, as shown below:

    [mcp_servers.Playwright]
    command = "cmd"
    args = ["/c", "npx", "@playwright/mcp@latest"]
    startup_timeout_ms = 20000
    
    [mcp_servers.Playwright.env]
    SystemRoot = 'C:\\Windows'
    
    [mcp_servers.context7]
    command = "cmd"
    args = ["/c", "npx", "-y", "@upstash/context7-mcp"]
    startup_timeout_ms = 30000
    
    [mcp_servers.context7.env]
    SystemRoot = 'C:\\Windows'
    
    [mcp_servers.serena]
    command = "uv"
    args = ["run", "--directory", 'D:\\mcp\\Serena\\serena', "serena-mcp-server"]
    startup_timeout_ms = 30000
    
    [mcp_servers.serena.env]
    SystemRoot = 'C:\\Windows'
    
    
    [mcp_servers.shadcn-ui]
    command = "cmd"
    args = ["/c", "npx", "shadcn@latest", "mcp"]
    startup_timeout_ms = 30000
    
    [mcp_servers.shadcn-ui.env]
    SystemRoot = 'C:\\Windows'
    
    /mcp
    
    🔌  MCP Tools
    
      • Server: context7
        • Command: cmd /c npx -y @upstash/context7-mcp
        • Tools: get-library-docs, resolve-library-id
    
      • Server: serena
        • Command: uv run --directory D:\\mcp\\Serena\\serena serena-mcp-server
        • Tools: activate_project, check_onboarding_performed, create_text_file, delete_lines, delete_memory,
    execute_shell_command, find_file, find_referencing_symbols, find_symbol, get_current_config, get_symbols_overview,
    initial_instructions, insert_after_symbol, insert_at_line, insert_before_symbol, list_dir, list_memories, onboarding,       
    prepare_for_new_conversation, read_file, read_memory, remove_project, replace_lines, replace_regex, replace_symbol_body,    
    restart_language_server, search_for_pattern, summarize_changes, switch_modes, think_about_collected_information,
    think_about_task_adherence, think_about_whether_you_are_done, write_memory
    
      • Server: Playwright
        • Command: cmd /c npx @playwright/mcp@latest
        • Tools: browser_click, browser_close, browser_console_messages, browser_drag, browser_evaluate, browser_file_upload,   
    browser_fill_form, browser_handle_dialog, browser_hover, browser_install, browser_navigate, browser_navigate_back,
    browser_network_requests, browser_press_key, browser_resize, browser_select_option, browser_snapshot, browser_tabs,
    browser_take_screenshot, browser_type, browser_wait_for
    
      • Server: shadcn-ui
        • Command: cmd /c npx shadcn@latest mcp
        • Tools: get_add_command_for_items, get_audit_checklist, get_item_examples_from_registries, get_project_registries,     
    list_items_in_registries, search_items_in_registries, view_items_in_registries
    

    YOU SAVED MY LIFE

  23. malore350 commented on Sep 21, 2025

    @malore350

    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
    

    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

  24. dszdsxc19 commented on Sep 27, 2025

    @dszdsxc19

    If u r using uv, what works for me is declaring the python of the project used, for example:

    [mcp_servers.serena]
    command = "uv"
    args = ["run", "--python", "path to serena venv", "--directory", "path to serena project", "serena", "start-mcp-server", "--context", "codex"]
    # https://github.com/openai/codex/blob/main/docs/config.md#mcp_servers
    startup_timeout_sec = 30
  25. Voilett commented on Sep 30, 2025

    @Voilett

    Hi @tekn0x . It works for me via the installed global . Here is the configuration (I use APi Key, but it should probably work without it):mcp-remote

    [mcp_servers.context7]
    command = "mcp-remote"
    args = [
      "https://mcp.context7.com/mcp",
      "--header",
      "CONTEXT7_API_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    ]
    disabled = false
    

    nice work!

  26. AndreyElyan commented on Oct 5, 2025

    @AndreyElyan

    Fetching comments for context

  27. kingbluetooth commented on Oct 8, 2025

    @kingbluetooth

    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

    1. Run npm install -g mcp-remote
    2. Copy the below into C:/Users/yourname/.codex/config.toml
    [mcp_servers.context7]
    command = "C:\\Program Files\\nodejs\\npx.cmd"
    args = [
      "-y",
      "mcp-remote",
      "https://mcp.context7.com/mcp",
      "--header",
      "--quiet",
      "CONTEXT7_API_KEY: yourkey"
    ]
    startup_timeout_ms = 30000
    disabled = false
    
    [mcp_servers.context7.env]
    APPDATA = "C:\\Users\\yourname\\AppData\\Roaming"
    LOCALAPPDATA = "C:\\Users\\yourname\\AppData\\Local"
    COMSPEC = "C:\\Windows\\System32\\cmd.exe"
    SYSTEMROOT = "C:\\Windows"
    PROGRAMFILES = "C:\\Program Files"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions