Skip to content

Cannot connect to the Chrome-devtools mcp server using the claude code #182

Closed

Description

@codeugar

Describe the bug
claude code showed it's failed to reconnect to chrome-devtools when I reconnect it.

Image

To Reproduce

  1. exec command:
    claude mcp add chrome-devtools npx chrome-devtools-mcp@latest
  2. exec command:
    claude code
  3. found 1 mcp failed
Image

Chrome version: 140.0.7339.187
Coding agent version: 1.0.77

Activity

  1. ronantakizawa commented on Sep 27, 2025

    @ronantakizawa

    @codeugar Check to make sure you are running Node version >=v22.12.0 as required in the project. That fixed it for me.

  2. allenzhuyi commented on Sep 28, 2025

    @allenzhuyi

    I have the same problem. I use claude code in windows,node version is v22.17.1

    Image
  3. imxiaohan commented on Sep 28, 2025

    @imxiaohan

    I have the same problem. I use claude code in MacOS, node version is v24.9.0

    Image
  4. cenyuus commented on Sep 28, 2025

    @cenyuus

    @codeugar Check to make sure you are running Node version >=v22.12.0 as required in the project. That fixed it for me.

    this solve my problem 👍

  5. kurdin commented on Sep 28, 2025

    @kurdin

    on Mac, I did:
    $ sudo npx chrome-devtools-mcp@latest

    then CTRL + C

    then started claude and I now I see no errors

    Image

    I think, the error was because when mcp starts npx chrome-devtools-mcp@latest without sudo it throw the error
    EACCES: permission denied, mkdir '/Users/username/.npm/_cacache/content-v2/sha512/51/20'

  6. imxiaohan commented on Sep 29, 2025

    @imxiaohan

    on Mac, I did: $ sudo npx chrome-devtools-mcp@latest

    then CTRL + C

    then started claude and I now I see no errors

    Image I think, the error was because when mcp starts `npx chrome-devtools-mcp@latest` without sudo it throw the error `EACCES: permission denied, mkdir '/Users/username/.npm/_cacache/content-v2/sha512/51/20'`

    You generally shouldn’t use sudo with npx or npm commands. Running with sudo executes everything as root, which introduces several problems:

    • Security risk: Any package pulled from npm will have full system privileges, which is dangerous if dependencies are compromised.

    • Permission issues: It can create root-owned files inside your ~/.npm or node_modules folders, leading to “permission denied” errors when you run npm as a normal user later.

    • Bad practice: It forces you into a cycle where you always need sudo for npm, instead of fixing the underlying permission problem.

    A better approach is to fix the ownership of your npm cache and global directories (chown -R $(whoami) ~/.npm), or use a Node version manager like nvm so everything runs under your normal user account.

  7. imxiaohan commented on Sep 29, 2025

    @imxiaohan

    I have the same problem. I use claude code in MacOS, node version is v24.9.0

    Image

    I think I solved the problem using the following steps:

    1. Check the npm version and run npm doctor:

      npm -v
      npm doctor

      npm doctor should show all green. If not, you need to fix the reported issues.
      In my case, it complained about an outdated version, so I upgraded npm.
      My current version is npm v11.6.1, and my node version is v24.9.0.

    2. Run:

      npx chrome-devtools-mcp@latest --help

      to see if it works.
      If not, run:

      claude mcp remove chrome-devtools

      to remove chrome-devtools first.

    3. Clear the npm cache:

      npm cache clean --force  # clear cache
      npm cache verify         # verify if it worked
    4. After that, reinstall chrome-devtools.
      I didn’t use Claude Code for installation, instead I used Gemini for a global install:

      gemini mcp add -s user chrome-devtools npx chrome-devtools-mcp@latest
    5. Once installation is done, run it again to check if there are errors.
      At this point, it should work normally:

      npx chrome-devtools-mcp@latest --help
    6. Then install it again in Claude Code:

      claude mcp add chrome-devtools npx chrome-devtools-mcp@latest

    ✅ At this stage, whether you use Claude Code or Gemini, your chrome-devtools MCP should show as connected.

    Image
  8. sebastianbenz commented on Sep 29, 2025

    @sebastianbenz
    Collaborator

    Closing as the issues seem to be resolved.

  9. ikushlianski commented on Oct 1, 2025

    @ikushlianski

    I was using 22.5.1 and it was failing. Updating to 22.20 (basically latest) fixed the issue.

  10. nkovacic commented on Oct 4, 2025

    @nkovacic

    @codeugar Check to make sure you are running Node version >=v22.12.0 as required in the project. That fixed it for me.

    Using latest node 22 version solved this issue for me as well.

  11. MarkEdmondson1234 commented on Oct 14, 2025

    @MarkEdmondson1234

    I will just add the above solved the issue ( #182 (comment) ) but I did have to restart VSCode / Claude Code to see it work. Before the restart, even after running all the steps it was reporting failure still.

  12. Sayvai commented on Oct 15, 2025

    @Sayvai

    TLDR: My root cause was due to a permissions issue, and I just had to make the locally installed Chrome MCP binary executable.


    I resolved my MCP connection error (i..e. Failed to reconnect to chrome-devtools.) on my MacOS, despite having the bare minimum supported version of Node (at this time of writing) installed (v20.19.3), with thanks in part to the above comment.

    My steps from error to resolution are the following:

    1. Ran the following to see if the MCP server can run at all in isolation.

      npx chrome-devtools-mcp@latest --help
    2. Received a permissions error, which indicates that the MCP binary does not have executable permissions 🔴 📜 :

      sh: /Users/local_username/.npm/_npx/15c61037b1978c83/node_modules/.bin/chrome-devtools-mcp: Permission denied
    3. Copied and pasted the personal unique path to the binary from the error output above, and ran the following to make the binary executable:

      chmod +x /Users/local_username/.npm/_npx/15c61037b1978c83/node_modules/.bin/chrome-devtools-mcp
    4. Ran the following to see whether I get the proper help options output (which did output successfully ✅):

      npx chrome-devtools-mcp@latest --help
    5. Go back to Claude Code terminal chat session, and run the following to verify connection to the MCP server:

      • /mcp command
      • select chrome-devtools from the options
      • select Reconnect
    6. You should now see the successful message 👉 Reconnected to chrome-devtools. 👈 output within your Claude Code chat session 🎉


    PS: At no point did i have to restart Claude Code or VS Code, nor run a single sudo command.

  13. 4 remaining items

  14. iamlakshya commented on Nov 11, 2025

    @iamlakshya

    Nothing worked for me, @TheXienator comment pointed me in the right direction.

    Used nvm to list down the install version and removed the unsupported version. It worked fine after that. Didn't need to reinstall Claude, but solved the issue where Claude was internally invoking mcp using an outdated node version.

  15. steviemcg commented on Dec 19, 2025

    @steviemcg

    For people in my situation where we are stuck using Windows without WSL2, I had to solve it this way:

        "chrome-devtools": {
          "type": "stdio",
          "command": "node",
          "args": [
            "C:/Users/Steve/AppData/Roaming/npm/node_modules/chrome-devtools-mcp/build/src/index.js"
          ]
        }
    

    Claude Code itself fixed the issue and explained it like so:

    When Claude Code calls spawn('npx', [...]) without shell: true, Node tries to execute npx as a direct binary - but it's a .cmd file that requires cmd.exe to interpret it.

    The fix works because node.exe is an actual executable binary, not a batch wrapper. So spawn('node', ['path/to/script.js', ...]) works without needing a shell.

    TL;DR: Any MCP server that relies on .cmd wrappers (npx, npm scripts, globally installed npm packages) will fail on Windows unless you invoke node directly with the JS entrypoint path.

  16. josharagon commented on Jan 13, 2026

    @josharagon

    @codeugar Check to make sure you are running Node version >=v22.12.0 as required in the project. That fixed it for me.

    cheers

  17. baurine commented on Jan 23, 2026

    @baurine

    Switch node from 20 to 24 resolved my issue.

  18. Rabbitzzc commented on Feb 25, 2026

    @Rabbitzzc

    like trae...

    {
      "mcpServers": {
        "chrome-devtools-mcp": {
          "command": "npx",
          "args": [
            "-y",
            "chrome-devtools-mcp@latest",
            "--browser-url=http://127.0.0.1:port"
          ],
          "env": {
            "HOME": "/Users/userName",
            "PATH": "/Users/userName/.nvm/versions/node/v22.14.0/bin:/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin"
          }
        }
      }
    }
  19. siddiqss commented on Mar 2, 2026

    @siddiqss

    For me, the root cause was that Node was installed via nvm, so node/npm weren’t available in the global PATH that the app/automation tooling relies on. I fixed it by installing Node through Homebrew (system-wide) and upgrading from v20 to v24. After that, everything worked as expected.

  20. zirtrex commented on Mar 21, 2026

    @zirtrex

    Para mi, habia instalado con una version de nodejs 22.10 y necesitaba 22.11 actualice mi node 22.22 desinstale opencode, volvi a instalar y funcionó el mcp de chrome.

  21. Ishannaik commented on Mar 26, 2026

    @Ishannaik

    🪟 Windows + nvm-windows (nvm4w): Definitive Fix for "Failed to connect"

    Spent a while debugging this silent failure and wanted to document the full picture since there's zero error output — just ✗ Failed to connect in claude mcp list. The server even logs Chrome DevTools MCP Server connected to its log file, making it look like everything's fine.

    This affects anyone on Windows using nvm-windows with npx-based MCP configs — not just chrome-devtools-mcp. I had both chrome-devtools and shadcn MCPs failing silently for the same root cause, while every .exe-based MCP (context7, sequential-thinking, etc.) worked fine.

    Posting here because this issue has great Windows-specific discussion already (especially @steviemcg's .cmd shim finding ☝️), and it's where people land when searching "chrome-devtools-mcp failed to connect."


    🔍 Environment

    OS Windows 11
    Node v24.8.0 via nvm-windows
    Chrome Stable (latest)
    Package chrome-devtools-mcp v0.20.3
    Client Claude Code CLI

    🧩 Root Cause

    Claude Code spawns MCP servers via child_process.spawn(), which does not load your shell profile or nvm-windows environment. Three things compound into a silent failure:

    # What happens Why it breaks
    1 npx on Windows is a .cmd shim spawn('npx', [...]) without a shell can't execute .cmd files — they need cmd.exe to interpret them
    2 Even with cmd /c npx, nvm-windows' PATH shimming is missing The subprocess doesn't inherit nvm's environment, so npx may resolve to the wrong Node or fail silently
    3 The server starts but never responds It hangs during initialization — no error, no crash, no timeout message. Just eternal silence on stdout

    The key insight: if claude mcp list shows all your .exe-based MCPs working but all npx-based ones failing, this is almost certainly the cause.


    ✅ Fix: Bypass npx entirely — use absolute paths

    Step 1: Install globally

    npm install -g chrome-devtools-mcp@latest

    Step 2: Find your paths

    where node       # e.g. C:\nvm4w\nodejs\node.exe
    npm root -g      # e.g. C:\Users\<YOU>\AppData\Roaming\npm\node_modules

    Step 3: Update your MCP config (~/.mcp.json or ~/.claude/.mcp.json)

    {
      "mcpServers": {
        "chrome-devtools": {
          "command": "C:\nvm4w\nodejs\node.exe",
          "args": [
            "C:\Users\<YOU>\AppData\Roaming\npm\node_modules\chrome-devtools-mcp\build\src\bin\chrome-devtools-mcp.js",
            "--isolated",
            "--no-usage-statistics"
          ]
        }
      }
    }

    Note: C:\nvm4w\nodejs\node.exe is nvm-windows' symlink to the active Node version, so it auto-updates when you nvm use a different version.


    🧪 Verify before restarting Claude Code

    You can test the MCP handshake manually:

    echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'   | node "C:\Users\<YOU>\AppData\Roaming\npm\node_modules\chrome-devtools-mcp\build\src\bin\chrome-devtools-mcp.js" --headless --isolated

    ✅ Working — you'll see:

    {"result":{"protocolVersion":"2024-11-05","capabilities":{"logging":{},"tools":{"listChanged":true}},"serverInfo":{"name":"chrome_devtools","version":"0.20.3"}},"jsonrpc":"2.0","id":1}

    ❌ Broken — no output at all (the exact symptom of the bug).


    📌 TL;DR

    On Windows with nvm-windows, never use npx in MCP configs. Use absolute paths to node.exe + the package's bin script. This applies to all npx-based MCP servers, not just chrome-devtools-mcp.

    Related issues: modelcontextprotocol/servers#64, modelcontextprotocol/servers#3460, modelcontextprotocol/servers#40

  22. AllardQuek commented on Apr 1, 2026

    @AllardQuek

    Hi I'm still facing the issue on MacOS goose CLI, despite using what I think are appropriate npm and node versions. Any ideas?

    Image
  23. Sayvai commented on Apr 1, 2026

    @Sayvai

    Hi I'm still facing the issue on MacOS goose CLI, despite using what I think are appropriate npm and node versions. Any ideas?

    Image

    The error message from your screenshot states that it detects node v.18.15.0 and encouraging you to upgrade the version to at least Node 20.19.0 (current minimum supported version), and this contradicts your statement that you think you have the appropriate node version.

    Have you verified your node version? Which version of node do you claim to have that contradicts the error message?

    You should be able to find this out by running node -v in your terminal.

    For reference, the project README file also states the currently supported version.

  24. AllardQuek commented on Apr 1, 2026

    @AllardQuek

    Hi I'm still facing the issue on MacOS goose CLI, despite using what I think are appropriate npm and node versions. Any ideas?
    Image

    The error message from your screenshot states that it detects node v.18.15.0 and encouraging you to upgrade the version to at least Node 20.19.0 (current minimum supported version), and this contradicts your statement that you think you have the appropriate node version.

    Have you verified your node version? Which version of node do you claim to have that contradicts the error message?

    You should be able to find this out by running node -v in your terminal.

    For reference, the project README file also states the currently supported version.

    As per my screenshot, my node version is 24.4.1

  25. Sayvai commented on Apr 1, 2026

    @Sayvai

    @AllardQuek - Ah ok, i missed the above node -v commands from your screenshot.

    I've never used goose. So after some googling, you could try to find out which node binary the goose context is referencing node to.

    Apparently you may be able to run the following commands to find out:

    goose run "which node"
    goose run "node -v"

    And see if the node binary path matches your OS context node path, to which i suspect not; which node, and if paths are different then you may need to somehow figure out how to either update the node version from within the goose contex? Or reference to the OS node binary path?

  26. AllardQuek commented on Apr 2, 2026

    @AllardQuek

    @AllardQuek - Ah ok, i missed the above node -v commands from your screenshot.

    I've never used goose. So after some googling, you could try to find out which node binary the goose context is referencing node to.

    Apparently you may be able to run the following commands to find out:

    goose run "which node"
    goose run "node -v"
    And see if the node binary path matches your OS context node path, to which i suspect not; which node, and if paths are different then you may need to somehow figure out how to either update the node version from within the goose contex? Or reference to the OS node binary path?

    Thanks for the tips! I managed to resolve the issue after

    1. Running these commands
    goose run --text "node -v"
    goose run --text "which node"
    which node

    Which led me to realise that I have node installed in multiple locations. Goose was using the one at /usr/local/bin/node (installed by brew) whereas my default CLI uses the one at ~.nvm/versions/node/ (installed by nvm).

    1. I uninstalled and remove the node files at /usr/local/bin/node and goose now defaults to the nvm node path which is of a valid version for me.

    Thanks for your help!

  27. void0x14 commented on Apr 25, 2026

    @void0x14

    This damn MCP crashes 2-3 times a month without fail, and it's starting to annoy me. Why don't I just not jump through hoops and mess around when I'm not connected to it? What kind of MCP are you making, Google?.I use it via opencode btw

    I test it and it works, but as soon as I start working, suddenly in the middle of my workflow it says "not connected" or times out. I swear, I'm losing my patience.

  28. kashif-kwanso commented on Jul 10, 2026

    @kashif-kwanso

    @codeugar Check to make sure you are running Node version >=v22.12.0 as required in the project. That fixed it for me.

    Following up on this, if you have done this, also restart the editor so it reflects the newly used node inside it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions