claude-code - 💡(How to fix) Fix [Windows Bug] Claude in Chrome MCP fails to connect - named pipe timing/architecture issue on Windows [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47167Fetched 2026-04-13 05:39:40
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

The claude-in-chrome MCP server fails to connect on Windows. All browser tool calls return:

"Browser extension is not connected. Please ensure the Claude browser extension is installed and running..."

This happens even when:

  • The browser extension is correctly installed and enabled
  • The native messaging registry keys are correctly configured (both Chrome and Edge)
  • The chrome-native-host.bat file exists and points to the correct path
  • The user is logged into claude.ai with the same account

Root Cause

Root Cause (code analysis)

Code Example

function zyA() {
  if (S45() === "win32") return `\\.\pipe\${V42()}`;
  return kb(x45(), V42()); // Mac/Linux: uses tmpdir with unique path
}
function V42() {
  return `claude-mcp-browser-bridge-${k45()}`; // e.g. claude-mcp-browser-bridge-Admin
}

---

Claude Code startup → zW9()B.connect(G)  [tries to connect to pipe as CLIENT]
                         \.\pipe\claude-mcp-browser-bridge-Admin
                                     (no server exists yet)
                               CONNECTION FAILS

---

async function NW9() {
  let A = new wW9, Q = new LW9;
  await A.start(); // creates pipe SERVER at zyA()
  while (true) {
    let B = await Q.read(); // reads Chrome native messaging from stdin
    if (B === null) break;  // exits when stdin closes (i.e. when Chrome disconnects)
    await A.handleMessage(B);
  }
  await A.stop(); // DESTROYS pipe server
}
RAW_BUFFERClick to expand / collapse

Environment

  • OS: Windows 11 Home 10.0.26200
  • Claude Code version: 2.1.9 (also reproduced on 2.1.104)
  • Browsers tested: Google Chrome, Microsoft Edge
  • Shell: bash (Git Bash / terminal)

Description

The claude-in-chrome MCP server fails to connect on Windows. All browser tool calls return:

"Browser extension is not connected. Please ensure the Claude browser extension is installed and running..."

This happens even when:

  • The browser extension is correctly installed and enabled
  • The native messaging registry keys are correctly configured (both Chrome and Edge)
  • The chrome-native-host.bat file exists and points to the correct path
  • The user is logged into claude.ai with the same account

Root Cause (code analysis)

After analyzing cli.js, the issue is an architectural timing problem on Windows:

The pipe name generation (zyA())

function zyA() {
  if (S45() === "win32") return `\\.\pipe\${V42()}`;
  return kb(x45(), V42()); // Mac/Linux: uses tmpdir with unique path
}
function V42() {
  return `claude-mcp-browser-bridge-${k45()}`; // e.g. claude-mcp-browser-bridge-Admin
}

On Mac/Linux: uses os.tmpdir() which can produce unique paths per session.
On Windows: always produces a fixed pipe name: \.\pipe\claude-mcp-browser-bridge-Admin

The connection flow

Claude Code startup → zW9() → B.connect(G)  [tries to connect to pipe as CLIENT]
                         \.\pipe\claude-mcp-browser-bridge-Admin
                                    ↓ (no server exists yet)
                               CONNECTION FAILS

The native host (NW9() / wW9.start()) only creates the pipe SERVER when Chrome/Edge invokes it via native messaging. But zW9() tries to connect as CLIENT during Claude Code startup — before any browser interaction has occurred.

Why this doesn't affect Mac/Linux

On Mac/Linux the socket file persists on disk and the MCP client can likely detect it and retry. On Windows, named pipes are ephemeral kernel objects — if the server isn't running, the client gets an immediate connection refused with no retry.

The wW9 native host (SERVER side)

async function NW9() {
  let A = new wW9, Q = new LW9;
  await A.start(); // creates pipe SERVER at zyA()
  while (true) {
    let B = await Q.read(); // reads Chrome native messaging from stdin
    if (B === null) break;  // exits when stdin closes (i.e. when Chrome disconnects)
    await A.handleMessage(B);
  }
  await A.stop(); // DESTROYS pipe server
}

The native host is designed to be short-lived — it exists only while Chrome has an active native messaging connection. The MCP client needs the server to be alive at startup, which creates a race condition.

What was verified

  • ✅ Registry key HKCU\Software\Google\Chrome\NativeMessagingHosts\com.anthropic.claude_code_browser_extension → correct JSON path
  • ✅ Registry key HKCU\Software\Microsoft\Edge\NativeMessagingHosts\com.anthropic.claude_code_browser_extension → correct JSON path
  • com.anthropic.claude_code_browser_extension.json → correct path to .bat file and correct allowed_origins
  • chrome-native-host.bat → correctly invokes cli.js --chrome-native-host
  • ✅ Extension installed and enabled in both Chrome and Edge
  • ✅ No conflicting chrome-native-host.exe processes running
  • ✅ No Claude-related named pipes exist at connection time (confirmed via Get-ChildItem \.\pipe\)
  • ✅ Works correctly from the Claude Code desktop app (which maintains its own persistent native host daemon)

Proposed Fix

The fix should make the MCP client lazy-connect or retry instead of connecting once at startup:

Option A (minimal): In zW9(), wrap B.connect(G) with retry logic — attempt to connect when a tool is actually called, retrying for a few seconds to allow the native host to start.

Option B (better): On Windows, use a different IPC mechanism that doesn't require the server to be running first (e.g., mailslots, or a persistent daemon mode).

Option C (simplest for users): Add a --chrome-native-host-daemon flag that keeps the native host running without requiring an active Chrome native messaging connection, allowing it to be started via a SessionStart hook.

The desktop app already implements something like Option C — exposing this as a CLI flag would make it work in terminal sessions too.

Additional Notes

The desktop app (Claude.ai) works because it maintains a persistent native host process. The CLI needs equivalent behavior.

This bug affects all Windows users trying to use claude-in-chrome from the terminal/CLI.

extent analysis

TL;DR

Implement a lazy-connect or retry mechanism in the MCP client to handle the architectural timing problem on Windows.

Guidance

  • Identify the connection flow and timing issues in the zW9() function, which attempts to connect to the pipe as a client during Claude Code startup.
  • Consider implementing retry logic in zW9() to attempt to connect when a tool is actually called, retrying for a few seconds to allow the native host to start.
  • Explore alternative IPC mechanisms, such as mailslots or a persistent daemon mode, that don't require the server to be running first.
  • Evaluate the feasibility of adding a --chrome-native-host-daemon flag to keep the native host running without requiring an active Chrome native messaging connection.

Example

// Example retry logic in zW9()
async function zW9() {
  const maxRetries = 5;
  const retryDelay = 1000; // 1 second
  let retries = 0;
  while (retries < maxRetries) {
    try {
      await B.connect(G);
      break;
    } catch (error) {
      retries++;
      await new Promise(resolve => setTimeout(resolve, retryDelay));
    }
  }
  if (retries === maxRetries) {
    throw new Error('Failed to connect to pipe after retries');
  }
}

Notes

The proposed fix should address the root cause of the issue, which is the architectural timing problem on Windows. However, the best approach may depend on the specific requirements and constraints of the project.

Recommendation

Apply workaround by implementing retry logic in zW9() to handle the connection timing issue, as this is a relatively simple and non-invasive change that can help mitigate the problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Windows Bug] Claude in Chrome MCP fails to connect - named pipe timing/architecture issue on Windows [1 comments, 2 participants]