@mcp-b/chrome-devtools-mcp 1.5.7 → 1.5.8
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 +24 -1
- package/build/src/main.js +27 -0
- package/package.json +1 -1
package/build/src/McpContext.js
CHANGED
|
@@ -380,7 +380,6 @@ export class McpContext {
|
|
|
380
380
|
url: 'about:blank',
|
|
381
381
|
newWindow: true,
|
|
382
382
|
});
|
|
383
|
-
await cdpSession.detach();
|
|
384
383
|
// Wait for the new page to be available
|
|
385
384
|
const target = await this.browser.waitForTarget(target => {
|
|
386
385
|
// @ts-expect-error _targetId is internal but stable
|
|
@@ -390,6 +389,30 @@ export class McpContext {
|
|
|
390
389
|
if (!page) {
|
|
391
390
|
throw new Error('Failed to get page from new window target');
|
|
392
391
|
}
|
|
392
|
+
// Set window to nearly full screen (large size that fits most displays)
|
|
393
|
+
try {
|
|
394
|
+
// Get window ID for this target
|
|
395
|
+
const { windowId } = await cdpSession.send('Browser.getWindowForTarget', {
|
|
396
|
+
targetId,
|
|
397
|
+
});
|
|
398
|
+
// Set to large dimensions (works well on 1920x1080 and larger displays)
|
|
399
|
+
// This is ~95% of common display sizes without being truly fullscreen
|
|
400
|
+
await cdpSession.send('Browser.setWindowBounds', {
|
|
401
|
+
windowId,
|
|
402
|
+
bounds: {
|
|
403
|
+
left: 20,
|
|
404
|
+
top: 20,
|
|
405
|
+
width: 1800,
|
|
406
|
+
height: 1200,
|
|
407
|
+
windowState: 'normal',
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
catch (err) {
|
|
412
|
+
// Non-fatal: window sizing is best-effort
|
|
413
|
+
this.logger('Failed to resize window:', err);
|
|
414
|
+
}
|
|
415
|
+
await cdpSession.detach();
|
|
393
416
|
await this.createPagesSnapshot();
|
|
394
417
|
// Mark as explicitly selected so this session sticks to this window
|
|
395
418
|
this.selectPage(page, true);
|
package/build/src/main.js
CHANGED
|
@@ -128,6 +128,33 @@ async function getContext() {
|
|
|
128
128
|
// Mark it as explicitly selected so this session stays pinned to it
|
|
129
129
|
context.selectPage(context.getSelectedPage(), true);
|
|
130
130
|
logger('Using existing window for this MCP session');
|
|
131
|
+
// Resize the window to nearly full screen
|
|
132
|
+
try {
|
|
133
|
+
const page = context.getSelectedPage();
|
|
134
|
+
const browserTarget = browser.target();
|
|
135
|
+
const cdpSession = await browserTarget.createCDPSession();
|
|
136
|
+
// @ts-expect-error _targetId is internal but stable
|
|
137
|
+
const targetId = page.target()._targetId;
|
|
138
|
+
const { windowId } = await cdpSession.send('Browser.getWindowForTarget', {
|
|
139
|
+
targetId,
|
|
140
|
+
});
|
|
141
|
+
await cdpSession.send('Browser.setWindowBounds', {
|
|
142
|
+
windowId,
|
|
143
|
+
bounds: {
|
|
144
|
+
left: 20,
|
|
145
|
+
top: 20,
|
|
146
|
+
width: 1800,
|
|
147
|
+
height: 1200,
|
|
148
|
+
windowState: 'normal',
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
await cdpSession.detach();
|
|
152
|
+
logger('Resized window to nearly full screen');
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
// Non-fatal: window sizing is best-effort
|
|
156
|
+
logger('Failed to resize window:', err);
|
|
157
|
+
}
|
|
131
158
|
}
|
|
132
159
|
else {
|
|
133
160
|
// Connected to existing browser - create new window for isolation
|