Skip to content

Commit 5692081

Browse files
committed
fix: change default screen size in headless
1 parent 098a904 commit 5692081

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ The Chrome DevTools MCP server supports the following configuration option:
280280
- **Type:** string
281281

282282
- **`--viewport`**
283-
Initial viewport size for the Chrome instances started by the server. For example, `1280x720`
283+
Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.
284284
- **Type:** string
285285

286286
- **`--proxyServer`**

src/browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
9595
const args: LaunchOptions['args'] = [
9696
...(options.args ?? []),
9797
'--hide-crash-restore-bubble',
98+
'--screen-info={3840x2160}',
9899
];
99100
if (customDevTools) {
100101
args.push(`--custom-devtools-frontend=file://${customDevTools}`);

src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const cliOptions = {
6565
viewport: {
6666
type: 'string',
6767
describe:
68-
'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`',
68+
'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',
6969
coerce: (arg: string | undefined) => {
7070
if (arg === undefined) {
7171
return;

tests/browser.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ describe('browser', () => {
5252
userDataDir: folderPath,
5353
executablePath: executablePath(),
5454
viewport: {
55-
width: 700,
56-
height: 500,
55+
width: 1501,
56+
height: 801,
5757
},
5858
});
5959
try {
@@ -62,8 +62,8 @@ describe('browser', () => {
6262
return {width: window.innerWidth, height: window.innerHeight};
6363
});
6464
assert.deepStrictEqual(result, {
65-
width: 700,
66-
height: 500,
65+
width: 1501,
66+
height: 801,
6767
});
6868
} finally {
6969
await browser.close();

0 commit comments

Comments
 (0)