Client roots from a WSL2 client are dropped by a Windows-side server (fileURLToPath ERR_INVALID_FILE_URL_PATH)

Author: baarbehCreated Sep 25, 2026Updated Sep 25, 2026

Description of the bug

When a client running in WSL2 (Claude Code, for example) launches chrome-devtools-mcp on the Windows side through WSL interop (Windows node.exe, Windows Chrome), the client's MCP roots are POSIX file URLs such as file:///home/user/project. On Windows, Node's fileURLToPath rejects these with ERR_INVALID_FILE_URL_PATH: File URL path must be absolute. The failed roots are dropped silently, only os.tmpdir() is left, and every filePath inside the project is refused:

Access denied: path /home/user/project/shot.png (canonical: \\wsl.localhost\Ubuntu-24.04\home\\\user\project\shot.png) is not within any of the configured workspace roots.

The requested path resolves correctly, against the server's UNC working directory, to \\wsl.localhost\…. Only the root never makes it into the allowed list.

Reproduction

  1. In WSL2, register the server with a Windows command, for example "command": "node.exe", "args": ["C:\\…\\chrome-devtools-mcp\\build\\src\\bin\\chrome-devtools-mcp.js"].
  2. Start the client in a WSL project directory (/home/user/project). The client advertises roots.
  3. Call take_screenshot with filePath: "/home/user/project/shot.png".
  4. The call is refused as above. The same call with a path under Windows %TEMP% succeeds.

Where

In 1.9.0, McpContext.js:

javascript
const rootPath = path.resolve(fileURLToPath(rootPathUri));

This runs inside Promise.allSettled, so the throw only logs Could not resolve configured root … and the root is skipped. Checked on Windows Node 24.20.0:

> require('url').fileURLToPath('file:///home/user/project')
Uncaught TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute

Possible fix

Parse client roots with fileURLToPath(uri, { windows: false }) when the URI has no drive letter or host, then path.resolve the result. With the server's working directory on \\wsl.localhost\<distro>\…, path.resolve('/home/user/project') gives \\wsl.localhost\<distro>\home\\\user\project, which is the same canonical form validatePath produces for the requested file. playwright-mcp hit the identical bug and fixed it with the same pattern: microsoft/playwright-mcp#1172.

Workaround

--workspace=\\wsl.localhost\<distro>\home\<user> on the server's args. It works because the server-side root is a Windows path.

Environment

  • chrome-devtools-mcp 1.9.0 (1.10.x's CHANGELOG lists no roots change)
  • Windows Node 24.20.0, Windows 11 build 26200
  • WSL 2.6.3 (Ubuntu 24.04)
  • Claude Code 2.1.282 in WSL2

Related but distinct: #2808, a / root that doubles the separator.

Source: ChromeDevTools/chrome-devtools-mcp