How to allow or block URLs in chrome-devtools-mcp (allowed origins equivalent)?
We want to adopt Chrome DevTools MCP in a corporate environment, but we need to restrict browser access to known URLs, similar to Playwright MCP's
--allowed-originsand--blocked-origins. What CLI flags or configuration does chrome-devtools-mcp now support for this?Originally asked on GitHub: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/239
4 answers
As of June 16, 2026, the feature was implemented and merged. You can restrict network access in browser sessions using URL patterns with the CLI options
--blocked-url-pattern(block traffic) and--allowed-url-pattern(allow specific endpoints).Example configuration from the thread for blocking endpoints:
json{ "mcpServers": { "chrome-devtools": { "command": "npx", "args": [ "chrome-devtools-mcp@latest", "--blocked-url-pattern", "*://example.com/*", "*://*.another-blocked-example.com/*" ] } } }A maintainer explained that URLs are matched using DevTools Protocol's
Network.setBlockedURLsURL patterns, which also covers origins and other patterns. Full option details are in the project’s Configuration Documentation.Known limitations stated in the thread:
- Network throttling/emulation is disabled when a blocklist or allowlist is configured. Using the
emulatetool to modifynetworkConditions(e.g., settingOffline) throws:Network throttling is not supported when network blocking (allowlist/blocklist) is configured.Other emulation settings (cpuThrottlingRate,geolocation,viewport) still work. - Service worker-initiated fetches bypass these restrictions and are not blocked.
Did this work for you?- Network throttling/emulation is disabled when a blocklist or allowlist is configured. Using the
What @OrKoN tried on GitHub (Worked)
A maintainer suggested expressing allowed and blocked URLs via CDP's
Network.setBlockedURLswith URL patterns, implemented in Puppeteer and then consumed by the MCP server. This approach shipped.Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The issue body proposed origin filtering via request interception, similar to Playwright MCP's
context.route()and Puppeteer'ssetRequestInterception(). This was a proposal, not a testable workaround.Source: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/239 (opens external site)
Did this work for you?What @edgeq tried on GitHub (Outcome unclear)
One user considered a Claude Code hooks-based approach to guard some of the MCP server's tools but noted it 'might get pretty unmaintainable pretty quickly.' The thread does not report whether it was tried.
Did this work for you?
Related questions
- Why does chrome-devtools-mcp snapshot miss table/ARIA semantics?
- Why is --load-extension ignored by chrome-devtools-mcp?
- How do I use chrome-devtools-mcp from WSL when Chrome is installed on Windows?
- chrome-devtools-mcp --autoConnect times out on every tool call with Chrome 144
- How to select which Chrome profile chrome-devtools-mcp automates when several are open?