@mcp-b/chrome-devtools-mcp 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/McpContext.js +27 -0
- package/build/src/cli.js +1 -1
- package/build/src/index.js +0 -0
- package/build/src/main.js +4 -0
- package/build/src/tools/webmcp.js +1 -1
- package/package.json +27 -26
package/build/src/McpContext.js
CHANGED
|
@@ -364,6 +364,33 @@ export class McpContext {
|
|
|
364
364
|
this.#setupWebMCPAutoDetection(page);
|
|
365
365
|
return page;
|
|
366
366
|
}
|
|
367
|
+
async newWindow() {
|
|
368
|
+
// Use CDP to create a new browser window instead of just a tab
|
|
369
|
+
const browserTarget = this.browser.target();
|
|
370
|
+
const cdpSession = await browserTarget.createCDPSession();
|
|
371
|
+
// Create a new target with newWindow: true
|
|
372
|
+
const { targetId } = await cdpSession.send('Target.createTarget', {
|
|
373
|
+
url: 'about:blank',
|
|
374
|
+
newWindow: true,
|
|
375
|
+
});
|
|
376
|
+
await cdpSession.detach();
|
|
377
|
+
// Wait for the new page to be available
|
|
378
|
+
const target = await this.browser.waitForTarget(target => {
|
|
379
|
+
// @ts-expect-error _targetId is internal but stable
|
|
380
|
+
return target._targetId === targetId;
|
|
381
|
+
}, { timeout: 5000 });
|
|
382
|
+
const page = await target.page();
|
|
383
|
+
if (!page) {
|
|
384
|
+
throw new Error('Failed to get page from new window target');
|
|
385
|
+
}
|
|
386
|
+
await this.createPagesSnapshot();
|
|
387
|
+
this.selectPage(page);
|
|
388
|
+
this.#networkCollector.addPage(page);
|
|
389
|
+
this.#consoleCollector.addPage(page);
|
|
390
|
+
// Set up WebMCP auto-detection for the new page
|
|
391
|
+
this.#setupWebMCPAutoDetection(page);
|
|
392
|
+
return page;
|
|
393
|
+
}
|
|
367
394
|
async closePage(pageIdx) {
|
|
368
395
|
if (this.#pages.length === 1) {
|
|
369
396
|
throw new Error(CLOSE_PAGE_ERROR);
|
package/build/src/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ export const cliOptions = {
|
|
|
8
8
|
autoConnect: {
|
|
9
9
|
type: 'boolean',
|
|
10
10
|
description: 'If specified, automatically connects to a browser (Chrome 145+) running in the user data directory identified by the channel param. Falls back to launching a new instance if no running browser is found.',
|
|
11
|
-
default:
|
|
11
|
+
default: true,
|
|
12
12
|
coerce: (value) => {
|
|
13
13
|
if (value === false) {
|
|
14
14
|
return false;
|
package/build/src/index.js
CHANGED
|
File without changes
|
package/build/src/main.js
CHANGED
|
@@ -120,6 +120,10 @@ async function getContext() {
|
|
|
120
120
|
experimentalDevToolsDebugging: devtools,
|
|
121
121
|
experimentalIncludeAllPages: args.experimentalIncludeAllPages,
|
|
122
122
|
});
|
|
123
|
+
// Always create a new window for this MCP session
|
|
124
|
+
// This ensures multiple MCP clients don't step on each other's toes
|
|
125
|
+
await context.newWindow();
|
|
126
|
+
logger('Created new window for this MCP session');
|
|
123
127
|
// Initialize WebMCP tool hub for dynamic tool registration
|
|
124
128
|
const toolHub = new WebMCPToolHub(server, context);
|
|
125
129
|
context.setToolHub(toolHub);
|
|
@@ -81,7 +81,7 @@ import { defineTool } from './ToolDefinition.js';
|
|
|
81
81
|
* Show all WebMCP tools registered across all pages, with diff since last call.
|
|
82
82
|
* First call returns full list. Subsequent calls return only added/removed tools.
|
|
83
83
|
*/
|
|
84
|
-
export const
|
|
84
|
+
export const listWebMCPTools = defineTool({
|
|
85
85
|
name: 'list_webmcp_tools',
|
|
86
86
|
description: 'List all WebMCP tools registered across all pages, with diff since last call. ' +
|
|
87
87
|
'First call returns full list. Subsequent calls return only added/removed tools. ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/chrome-devtools-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "MCP server for Chrome DevTools with WebMCP integration for connecting to website MCP tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -47,21 +47,40 @@
|
|
|
47
47
|
"LICENSE",
|
|
48
48
|
"!*.tsbuildinfo"
|
|
49
49
|
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc && node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/post-build.ts",
|
|
52
|
+
"bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs",
|
|
53
|
+
"check-format": "eslint --cache . && prettier --check --cache .;",
|
|
54
|
+
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
|
|
55
|
+
"docs": "npm run build && npm run docs:generate && npm run format",
|
|
56
|
+
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
|
|
57
|
+
"format": "eslint --cache --fix . && prettier --write --cache .",
|
|
58
|
+
"prepare": "node --experimental-strip-types scripts/prepare.ts",
|
|
59
|
+
"start": "npm run build && node build/src/index.js",
|
|
60
|
+
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
|
|
61
|
+
"test": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
|
|
62
|
+
"test:node20": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test build/tests",
|
|
63
|
+
"test:only": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
|
|
64
|
+
"test:only:no-build": "node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
|
|
65
|
+
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts"
|
|
68
|
+
},
|
|
50
69
|
"dependencies": {
|
|
51
|
-
"@composio/json-schema-to-zod": "
|
|
52
|
-
"@
|
|
70
|
+
"@composio/json-schema-to-zod": "catalog:",
|
|
71
|
+
"@mcp-b/global": "workspace:*",
|
|
72
|
+
"@modelcontextprotocol/sdk": "catalog:",
|
|
53
73
|
"core-js": "3.47.0",
|
|
54
74
|
"debug": "4.4.3",
|
|
55
75
|
"esbuild": "^0.24.2",
|
|
56
76
|
"puppeteer": "24.32.0",
|
|
57
77
|
"puppeteer-core": "24.32.0",
|
|
58
78
|
"yargs": "18.0.0",
|
|
59
|
-
"zod": "
|
|
60
|
-
"@mcp-b/global": "0.0.0-beta-20260109203913"
|
|
79
|
+
"zod": "catalog:"
|
|
61
80
|
},
|
|
62
81
|
"devDependencies": {
|
|
63
82
|
"@eslint/js": "^9.35.0",
|
|
64
|
-
"@modelcontextprotocol/sdk": "
|
|
83
|
+
"@modelcontextprotocol/sdk": "catalog:",
|
|
65
84
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
66
85
|
"@rollup/plugin-json": "^6.1.0",
|
|
67
86
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
@@ -90,7 +109,7 @@
|
|
|
90
109
|
"typescript": "^5.9.2",
|
|
91
110
|
"typescript-eslint": "^8.43.0",
|
|
92
111
|
"yargs": "18.0.0",
|
|
93
|
-
"zod": "
|
|
112
|
+
"zod": "catalog:"
|
|
94
113
|
},
|
|
95
114
|
"engines": {
|
|
96
115
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
@@ -102,23 +121,5 @@
|
|
|
102
121
|
"upstream": {
|
|
103
122
|
"repository": "https://github.com/ChromeDevTools/chrome-devtools-mcp",
|
|
104
123
|
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp"
|
|
105
|
-
},
|
|
106
|
-
"scripts": {
|
|
107
|
-
"build": "tsc && node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/post-build.ts",
|
|
108
|
-
"bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs",
|
|
109
|
-
"check-format": "eslint --cache . && prettier --check --cache .;",
|
|
110
|
-
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
|
|
111
|
-
"docs": "npm run build && npm run docs:generate && npm run format",
|
|
112
|
-
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
|
|
113
|
-
"format": "eslint --cache --fix . && prettier --write --cache .",
|
|
114
|
-
"start": "npm run build && node build/src/index.js",
|
|
115
|
-
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
|
|
116
|
-
"test": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
|
|
117
|
-
"test:node20": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test build/tests",
|
|
118
|
-
"test:only": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
|
|
119
|
-
"test:only:no-build": "node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
|
|
120
|
-
"test:update-snapshots": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-force-exit --test --test-update-snapshots \"build/tests/**/*.test.js\"",
|
|
121
|
-
"typecheck": "tsc --noEmit",
|
|
122
|
-
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts"
|
|
123
124
|
}
|
|
124
|
-
}
|
|
125
|
+
}
|