Skip to content

[Bug]: Playwright MCP Server Fails in LM Studio: Browser Version Mismatch + Electron Env Var Propagation Failure #41871

Closed as not planned

Description

@stevecs

Version

1.61.1

Steps to reproduce

Install @playwright/mcp globally: npm install -g @playwright/mcp
Install browsers: npx playwright install chromium firefox
Configure mcp.json with Playwright MCP entry
Launch LM Studio, enable the MCP server
Send a query requiring browser navigation
Observe error: Browser "firefox" is not installed

Expected behavior

npx playwright install should install browser versions compatible with the MCP server's bundled playwright-core, OR the documentation should explicitly state that browsers must be installed via the MCP server's own CLI
Environment variables set in mcp.json env blocks should propagate through the entire process tree, including grandchild processes spawned by the MCP server
The error message should identify the actual missing executable and path, not generically state "Browser X is not installed"

Actual behavior

Version mismatch causes silent failure — browsers are installed but in the wrong versioned directories
Electron sandbox strips environment variables from child process trees
Misleading error message provides no diagnostic value

Additional context

Documentation: Add explicit installation instructions stating that browsers must be installed using the MCP server's bundled playwright-core, not the standalone playwright package
Error messages: Preserve and surface the original "Executable doesn't exist at [path]" message instead of rethrowing as a generic "Browser not installed" (playwright#40862)
Version alignment: Consider pinning playwright-core to a stable release version rather than an alpha, or provide a browser_install tool that works before browser launch

Two compounding issues prevent Playwright MCP from functioning in LM Studio on Windows:

Issue 1: Browser Version Mismatch (Playwright/MCP)

When users follow the documented installation steps:

npm install -g @playwright/mcp
npx playwright install chromium firefox
The npx playwright install command uses the standalone [email protected] package, which downloads browser binaries with version numbers matching playwright 1.61.1 (e.g., chromium-1228, firefox-1532).

However, @playwright/[email protected] bundles [email protected], which expects different browser version numbers (e.g., chromium-1232, firefox-1534).

Result: The MCP server starts successfully, connects to LM Studio, and registers tools — but when the LLM calls browser_navigate, Playwright's browser registry cannot find the expected versioned directory and throws:

Error: Browser "firefox" is not installed. Run npx @playwright/mcp install-browser firefox to install
Root cause: The MCP server's browserFactory.ts catches any "Executable doesn't exist" error and rethrows it as a generic "Browser X is not installed" message, which is misleading (see playwright#40862).

Workaround: Install browsers using the MCP server's bundled playwright-core:

cd C:\ProgramData\npm\node_modules@playwright\mcp
node node_modules/playwright-core/cli.js install chromium firefox

Issue 2: Electron Sandbox Drops Environment Variables (LM Studio)
LM Studio is an Electron app. Its MCP bridge worker spawns child processes in a sandboxed environment where:

The env block in mcp.json is not reliably propagated to grandchild processes (the browser launch subprocess)
Machine-level and user-level Windows environment variables (e.g., PLAYWRIGHT_BROWSERS_PATH) are not inherited by Electron-spawned child processes
The process.env object available to wrapper scripts is a frozen snapshot that doesn't include custom variables
Result: Even when PLAYWRIGHT_BROWSERS_PATH is set at the Machine, User, and session levels — and even when hardcoded in a wrapper script's spawn() env option — the variable is not available to Playwright's internal browser-launch subprocess.

Workaround: Use a Node.js wrapper script that explicitly constructs the full env object for the spawn() call, bypassing process.env inheritance entirely.

Environment

## Environment

| Component | Version |
|---|---|
| OS | Windows Server 2022 |
| LM Studio | v0.4.19 |
| Node.js | v24.18.0 |
| `@playwright/mcp` | 0.0.78 |
| `playwright-core` (bundled) | 1.62.0-alpha-1783623505000 |
| Standalone `playwright` (from `npx`) | 1.61.1 |

Activity

  1. dcrousso commented on Jul 23, 2026

    @dcrousso
    Contributor

    to clarify, did the npx @playwright/mcp install-browser firefox mentioned in the error not fix the issue?

  2. stevecs commented on Jul 23, 2026

    @stevecs
    Author

    Firefox was installed. the problem(s) as mentioned is in pathing for a multi-user system and not able to send an over-ride path string to explicitly state what browser to use and that the version(s) of the browsers installed as mentioned that npx playwright install uses the standalone [email protected] package but the @playwright/[email protected] bundles [email protected] so both expect different browser version numbers.

  3. dgozman commented on Jul 27, 2026

    @dgozman
    Collaborator

    This works as intended - the error message is clear and the suggested command fixes the issue.

    Note that in v1.62 release you can use npx playwright mcp which is available with the playwright package. This should help with the versioning.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions