Description
v0.20.1 breaks all tool calls when connecting to Electron apps (e.g. Obsidian) via --browser-url. Every tool call fails with:
Protocol error (Target.getDevToolsTarget): 'Target.getDevToolsTarget' wasn't found
v0.20.0 works fine with the same setup.
Root cause
PR #1150 replaced the loop-based DevTools window detection with page.hasDevTools(), which calls Target.getDevToolsTarget — a CDP method that Electron's CDP implementation doesn't expose.
The call happens in McpContext.detectOpenDevToolsWindows() (line 475), which runs on every list_pages and page selection, making the entire MCP unusable.
Environment
- chrome-devtools-mcp: 0.20.1
- Electron: 39.7.0 (Chrome 142.0.7444.265)
- App: Obsidian 1.12.4
- Connection:
--browser-url=http://127.0.0.1:9222
Workaround
Wrap the hasDevTools() call in a try-catch in build/src/McpContext.js:
try {
if (await page.hasDevTools()) {
mcpPage.devToolsPage = await page.openDevTools();
} else {
mcpPage.devToolsPage = undefined;
}
} catch {
// Target.getDevToolsTarget not supported (e.g. Electron)
mcpPage.devToolsPage = undefined;
}
Expected behavior
list_pages and other tools should work with Electron apps that don't support Target.getDevToolsTarget, gracefully skipping DevTools window detection.
🤖 Generated with Claude Code
Description
v0.20.1 breaks all tool calls when connecting to Electron apps (e.g. Obsidian) via
--browser-url. Every tool call fails with:v0.20.0 works fine with the same setup.
Root cause
PR #1150 replaced the loop-based DevTools window detection with
page.hasDevTools(), which callsTarget.getDevToolsTarget— a CDP method that Electron's CDP implementation doesn't expose.The call happens in
McpContext.detectOpenDevToolsWindows()(line 475), which runs on everylist_pagesand page selection, making the entire MCP unusable.Environment
--browser-url=http://127.0.0.1:9222Workaround
Wrap the
hasDevTools()call in a try-catch inbuild/src/McpContext.js:Expected behavior
list_pagesand other tools should work with Electron apps that don't supportTarget.getDevToolsTarget, gracefully skipping DevTools window detection.🤖 Generated with Claude Code