Skip to content

Commit d502557

Browse files
authored
feat: support experimental allowlist for navigate tool calls (#1935)
This PR adds an experimental allowlist for the page navigate tool call (requires `--experimentalNavigationAllowlist`, off by default). The feature uses a list of URLPatterns to decline navigations that land on disallowed URLs. If that happens, the client can update the allowlist and re-try. The purpose of the this feature is to offer additional guardrails on top of the MCP server. It does not restrict subresources or JS/iframe navigations in any way. The performance impact is minimized by turning off interception as soon as the navigation request is done.
1 parent 7bb1ca5 commit d502557

11 files changed

Lines changed: 452 additions & 212 deletions

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"tiktoken": "^1.0.22",
8181
"typescript": "^6.0.2",
8282
"typescript-eslint": "^8.43.0",
83+
"urlpattern-polyfill": "^10.1.0",
8384
"yargs": "18.0.0"
8485
},
8586
"engines": {

src/bin/chrome-devtools-mcp-cli-options.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ export const cliOptions = {
180180
'Whether to include all kinds of pages such as webviews or background pages as pages.',
181181
hidden: true,
182182
},
183+
experimentalNavigationAllowlist: {
184+
type: 'boolean',
185+
describe: 'Whether to enable navigation allowlist tool parameter.',
186+
hidden: true,
187+
},
183188
experimentalInteropTools: {
184189
type: 'boolean',
185190
describe: 'Whether to enable interoperability tools',

src/telemetry/flag_usage_metrics.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@
130130
"name": "experimental_memory_present",
131131
"flagType": "boolean"
132132
},
133+
{
134+
"name": "experimental_navigation_allowlist",
135+
"flagType": "boolean"
136+
},
137+
{
138+
"name": "experimental_navigation_allowlist_present",
139+
"flagType": "boolean"
140+
},
133141
{
134142
"name": "experimental_page_id_routing",
135143
"flagType": "boolean"

src/third_party/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import 'urlpattern-polyfill';
78
import 'core-js/modules/es.promise.with-resolvers.js';
89
import 'core-js/modules/es.set.union.v2.js';
910
import 'core-js/proposals/iterator-helpers.js';

0 commit comments

Comments
 (0)