Skip to content

WSL pw-mcp integration #231

@FerEnoch

Description

@FerEnoch

Setup:

  • Windows 10
  • WSL v2
  • Ubuntu 24
  • Node.js 22 (in WSL - no Node.js in Windows)
  • VSCode running on Windows with remote connection to wsl this way

Issue

The official docs about the pw-mcp add on to the user settings json file in vscode doesn't seem to work in WSL.
This config:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}

Is giving me this error:

[info] Starting server playwright
[info] Connection state: Starting
[info] Starting server from LocalProcess extension host
[info] Connection state: Starting
[info] Connection state: Error spawn npx ENOENT

Same thing replacing the "npx" command with the complete absolute path.

Solution I found (although partial)

This article tells about Server Sent Events (SSE), so I got it working like this:

  1. After installing the Playwright/mcp server, get it up and running with a port:
npx @playwright/mcp@latest --port 8931
  1. Then, configure the client settings with your endpoint:
{
  "mcpServers": {
    "playwright": {
     "type": "sse",
      "url": "http://localhost:8931/sse"
    }
  }
}
  1. Reload vscode window and reestart the client.

Question

Is there any other solution to make vscode automatically start the server without any problems? Please, let me know.

Metadata

Metadata

Assignees

No one assigned

    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