Skip to content

Commit 4ca58a5

Browse files
authored
Merge branch 'main' into breakpoints
2 parents 55105dd + 48a2c68 commit 4ca58a5

6 files changed

Lines changed: 65 additions & 45 deletions

File tree

CONTRIBUTING.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sign a new one.
2323
This project follows
2424
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
2525

26-
## Contribution process
26+
## Development process
2727

2828
### Code reviews
2929

@@ -53,6 +53,13 @@ completed:
5353
features (we want to avoid features that offer some tools but cannot be used
5454
successfully to debug things).
5555

56+
### Release process
57+
58+
Releasing `chrome-devtools-mcp` is automated by GitHub Actions. To release a new
59+
version, [search for a PR titled `chore(main): release chrome-devtools-mcp`](https://github.com/ChromeDevTools/chrome-devtools-mcp/pulls?q=is%3Apr+is%3Aopen+%22chore%28main%29%3A+release+chrome-devtools-mcp%22)
60+
and review, test, and land it. The release PR is automatically opened if there
61+
are any changes on the main branch that show up in the changelog.
62+
5663
## Installation
5764

5865
Check that you are using node version specified in .nvmrc, then run following commands:
@@ -67,7 +74,7 @@ npm run build
6774
### Testing with @modelcontextprotocol/inspector
6875

6976
```sh
70-
npx @modelcontextprotocol/inspector node build/src/index.js
77+
npx @modelcontextprotocol/inspector node /build/src/bin/chrome-devtools-mcp.js
7178
```
7279

7380
### Testing with an MCP client
@@ -79,7 +86,7 @@ Add the MCP server to your client's config.
7986
"mcpServers": {
8087
"chrome-devtools": {
8188
"command": "node",
82-
"args": ["/path-to/build/src/index.js"]
89+
"args": ["/path-to/build/src/bin/chrome-devtools-mcp.js"]
8390
}
8491
}
8592
}
@@ -95,7 +102,7 @@ Usually VS Code automatically detects and forwards `6274` but fails to detect `6
95102
To write debug logs to `log.txt` in the working directory, run with the following commands:
96103

97104
```sh
98-
npx @modelcontextprotocol/inspector node build/src/index.js --log-file=/your/desired/path/log.txt
105+
npx @modelcontextprotocol/inspector node /build/src/bin/chrome-devtools-mcp.js --log-file=/your/desired/path/log.txt
99106
```
100107

101108
You can use the `DEBUG` environment variable as usual to control categories that are logged.

package-lock.json

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

src/bin/chrome-devtools.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ y.command('status', 'Checks if chrome-devtools-mcp is running', async () => {
114114
socketPath: string;
115115
startDate: string;
116116
version: string;
117+
args: string[];
117118
};
118119
console.log(
119120
`pid=${data.pid} socket=${data.socketPath} start-date=${data.startDate} version=${data.version}`,
120121
);
122+
console.log(`args=${JSON.stringify(data.args)}`);
121123
} else {
122124
console.error('Error:', response.error);
123125
process.exit(1);

src/daemon/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export async function startDaemon(mcpArgs: string[] = []) {
8585
stdio: 'ignore',
8686
env: process.env,
8787
cwd: process.cwd(),
88+
windowsHide: true,
8889
});
8990
child.unref();
9091

src/daemon/daemon.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ logger(`Writing ${process.pid.toString()} to ${pidFilePath}`);
4444
const socketPath = getSocketPath();
4545

4646
const startDate = new Date();
47+
const mcpServerArgs = process.argv.slice(2);
4748

4849
let mcpClient: Client | null = null;
4950
let mcpTransport: StdioClientTransport | null = null;
@@ -52,11 +53,14 @@ let server: Server | null = null;
5253
async function setupMCPClient() {
5354
console.log('Setting up MCP client connection...');
5455

55-
const args = process.argv.slice(2);
5656
// Create stdio transport for chrome-devtools-mcp
57+
// Workaround for https://github.com/modelcontextprotocol/typescript-sdk/blob/v1.x/src/client/stdio.ts#L128
58+
// which causes the console window to show on Windows.
59+
// @ts-expect-error no types for type.
60+
process.type = 'mcp-client';
5761
mcpTransport = new StdioClientTransport({
5862
command: process.execPath,
59-
args: [INDEX_SCRIPT_PATH, ...args],
63+
args: [INDEX_SCRIPT_PATH, ...mcpServerArgs],
6064
env: process.env as Record<string, string>,
6165
});
6266
mcpClient = new Client(
@@ -118,6 +122,7 @@ async function handleRequest(msg: DaemonMessage) {
118122
socketPath,
119123
startDate: startDate.toISOString(),
120124
version: VERSION,
125+
args: mcpServerArgs,
121126
}),
122127
};
123128
}

tests/tools/pages.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,18 @@ describe('pages', () => {
162162

163163
assert.ok(extensionId);
164164

165-
const _sidePanelPage = await context.newPage();
166-
await _sidePanelPage.pptrPage.goto(
165+
const sidePanelPage = await context.newPage();
166+
await sidePanelPage.pptrPage.goto(
167167
`chrome-extension://${extensionId}/sidepanel.html`,
168168
);
169169

170170
await context.waitForTextOnPage(['Side Panel']);
171171

172+
// Wait for service worker used in the snapshot.
173+
await context.browser.waitForTarget(
174+
target => target.type() === 'service_worker',
175+
);
176+
172177
const listPageDef = listPages({
173178
categoryExtensions: true,
174179
} as ParsedArguments);

0 commit comments

Comments
 (0)