Description of the bug
Console messages from Chrome extension content scripts (which run in isolated execution contexts) are not captured by list_console_messages. Only main-world logs (from page scripts or evaluate_script) are visible.
Environment
chrome-devtools-mcp v0.17.3
- Chrome stable channel
- Using via Claude Code
Observed behavior
Content scripts that write to the DOM work fine — attributes set by content scripts are visible via snapshots. However, console.log() calls from those same content scripts are never surfaced by list_console_messages.
| Source |
Captured? |
| Page scripts (main world) |
✅ Yes |
evaluate_script calls |
✅ Yes |
Content script console.log (isolated world) |
❌ No |
| Content script DOM writes |
✅ Yes (via snapshots) |
Root cause
This appears to be a CDP configuration gap rather than a bug. Chrome content scripts run in isolated execution contexts, and Runtime.enable only subscribes to main-world console output by default. To capture logs from content scripts, the server would need to:
- Listen for
Runtime.executionContextCreated events
- Call
Runtime.enable for each new isolated execution context (where context.auxData.isDefault === false)
The CDP plumbing for this exists — it's just not currently wired up in the MCP server.
Use case
Developing and debugging Chrome extensions with an AI coding agent. The agent needs to verify that content scripts are loading and executing correctly, which currently requires workarounds like bridging content script output to the main world via DOM attributes and MutationObservers.
Current workaround
A MutationObserver bridge in the main world that watches for DOM attribute changes made by the content script, then re-emits them as main-world console.log calls — making them visible to list_console_messages. This works but adds complexity.
Suggested implementation
In the CDP session setup, subscribe to execution context creation and enable runtime reporting for isolated worlds:
client.on('Runtime.executionContextCreated', ({ context }) => {
if (!context.auxData?.isDefault) {
// This is an isolated world (content script)
client.send('Runtime.enable', {}, context.id);
}
});
This would make list_console_messages capture logs from all execution contexts, not just the main world.
Reproduction
No response
Expectation
No response
MCP configuration
No response
Chrome DevTools MCP version
0.17.3
Chrome version
146
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
24
Operating system
macOS
Extra checklist
Description of the bug
Console messages from Chrome extension content scripts (which run in isolated execution contexts) are not captured by
list_console_messages. Only main-world logs (from page scripts orevaluate_script) are visible.Environment
chrome-devtools-mcpv0.17.3Observed behavior
Content scripts that write to the DOM work fine — attributes set by content scripts are visible via snapshots. However,
console.log()calls from those same content scripts are never surfaced bylist_console_messages.evaluate_scriptcallsconsole.log(isolated world)Root cause
This appears to be a CDP configuration gap rather than a bug. Chrome content scripts run in isolated execution contexts, and
Runtime.enableonly subscribes to main-world console output by default. To capture logs from content scripts, the server would need to:Runtime.executionContextCreatedeventsRuntime.enablefor each new isolated execution context (wherecontext.auxData.isDefault === false)The CDP plumbing for this exists — it's just not currently wired up in the MCP server.
Use case
Developing and debugging Chrome extensions with an AI coding agent. The agent needs to verify that content scripts are loading and executing correctly, which currently requires workarounds like bridging content script output to the main world via DOM attributes and MutationObservers.
Current workaround
A MutationObserver bridge in the main world that watches for DOM attribute changes made by the content script, then re-emits them as main-world
console.logcalls — making them visible tolist_console_messages. This works but adds complexity.Suggested implementation
In the CDP session setup, subscribe to execution context creation and enable runtime reporting for isolated worlds:
This would make
list_console_messagescapture logs from all execution contexts, not just the main world.Reproduction
No response
Expectation
No response
MCP configuration
No response
Chrome DevTools MCP version
0.17.3
Chrome version
146
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
24
Operating system
macOS
Extra checklist