Skip to content

[Bug] Windows: Antigravity CDP adapter fails due to MCP path discovery, npx spawn, and page targeting issues #55

@dengshu2

Description

@dengshu2

Environment

  • OS: Windows 10/11 (Git Bash)
  • Node.js: v22.18.0 (via NVM for Windows / nvm4w)
  • OpenCLI: v0.9.0
  • Antigravity: v1.107.0 (Electron 39.2.3 / Chrome 142)
  • @playwright/mcp: globally installed

Summary

When using opencli antigravity commands on Windows with NVM, I encountered 3 related issues that prevent the CDP adapter from working out of the box. All three are specific to the Windows + NVM environment.

Bug 1: findMcpServerPath() fails to detect globally installed @playwright/mcp on Windows + NVM

Steps to reproduce:

  1. Install Node via NVM for Windows (nvm4w)
  2. npm install -g @playwright/mcp
  3. export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9224"
  4. opencli antigravity status -v

Expected: OpenCLI finds the globally installed MCP server
Actual: Logs Playwright MCP not found locally; bootstrapping via npx @playwright/mcp@latest, then fails

Root cause (discover.js):
The global path check uses path.join(nodePrefix, 'lib', 'node_modules', ...), but on Windows with NVM the actual path is:

C:/Users/<user>/AppData/Local/nvm/v22.18.0/node_modules/@playwright/mcp/cli.js

There is no lib/ directory in the NVM prefix on Windows. The npm root -g fallback also fails because the 2>/dev/null redirect does not work properly in Windows shell context.

Workaround: Manually set OPENCLI_MCP_SERVER_PATH:

export OPENCLI_MCP_SERVER_PATH="C:/Users/<user>/AppData/Local/nvm/v22.18.0/node_modules/@playwright/mcp/cli.js"

Bug 2: npx fallback spawn fails on Windows with "系统找不到指定的路径"

When findMcpServerPath() returns null, the fallback buildMcpLaunchSpec() tries to spawn npx directly:

{ command: 'npx', args: ['-y', '@playwright/mcp@latest', ...] }

On Windows (Git Bash), this produces:

系统找不到指定的路径。  (The system cannot find the path specified.)
Error: Playwright MCP process exited before the browser connection was established.

Likely cause: spawn('npx', ...) on Windows needs either shell: true or the explicit npx.cmd extension.

Bug 3: Multi-window Antigravity connects to wrong page (Launchpad)

When Antigravity has multiple windows open (e.g., several projects + Launchpad), the CDP connection defaults to the Launchpad page (workbench-jetski-agent.html) which does not have the agentSidePanelInputBox element.

Steps to reproduce:

  1. Launch Antigravity with --remote-debugging-port=9224
  2. Open multiple project windows
  3. opencli antigravity send "hello"

Expected: Connects to a workbench page that has the chat panel
Actual: Connects to Launchpad → Error: Could not find antigravity.agentSidePanelInputBox

Diagnostic output (curl http://127.0.0.1:9224/json/list) shows multiple pages available, but Playwright MCP selects the wrong default target.

Suggestion: The Antigravity adapter could filter pages by checking:

  • URL contains workbench.html but NOT jetski-agent
  • Or verify agentSidePanelInputBox exists before proceeding

My Workaround

I wrote a direct CDP script (cdp_antigravity.mjs) that:

  1. Scans all CDP pages via /json/list
  2. Checks each workbench page for agentSidePanelInputBox
  3. Connects to the first page that has the chat panel

This successfully sends/reads messages. Happy to contribute a PR if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions