chrome-devtools-mcp
Scaffolds the setup needed to inspect authenticated network traffic through
chrome-devtools-mcp (Google's official CDP MCP server - not Playwright). Generates:
scripts/launch-chrome.sh - opens a dedicated Chrome instance with --remote-debugging-port
and an isolated --user-data-dir profile that persists login state across runs.
docs/chrome-mcp-setup.md - the usage flow: launch, log in once, register the MCP server,
capture requests, turn them into probe scripts.
scripts/probe/ - dir (with a .gitkeep) where each captured request later becomes a
minimal fetch-based reproduction script.
When to use
- Reverse-engineering an app's API by watching what the browser actually sends when logged in.
- Capturing real
Authorization/Cookie/CSRF headers to wire up an integration or MCP tool.
- Any task that needs
list_pages, navigate_page, get_network_requests, or
evaluate_script against an authenticated session.
Do NOT use when the target API is already documented, or when an existing
scripts/launch-chrome.sh / docs/chrome-mcp-setup.md is present for this project - diff
manually instead, this skill refuses to overwrite unless FORCE=1.
Inputs to ask the user (in this order)
- Project slug (kebab-case) - names the isolated profile dir (
~/.chrome-<slug>-profile)
and titles the doc.
- CDP port - e.g.
9222. Ask if another project's Chrome is already using it; each
project should get its own port so instances don't collide.
- Start URL - the app URL to open on launch (login page or the target feature).
- Target dir - project root to scaffold into (default
.).
How to scaffold
Run the scaffold script from the target project root:
PROJECT=myapp PORT=9222 START_URL=https://app.example.com/login \
TARGET_DIR=. ~/.claude/skills/chrome-devtools-mcp/scripts/scaffold.sh
The script:
- Renders
templates/scripts/launch-chrome.sh.tmpl to scripts/launch-chrome.sh (executable).
- Renders
templates/docs/chrome-mcp-setup.md.tmpl to docs/chrome-mcp-setup.md.
- Creates
scripts/probe/ for later per-request reproduction scripts.
- Refuses to overwrite existing files unless
FORCE=1.
Register the MCP server
Edit (or create) .mcp.json at the project root directly - merge into any existing
mcpServers, don't overwrite other entries:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--browserUrl", "http://127.0.0.1:9222"]
}
}
}
Then tell the user to restart Claude Code so the tools (list_pages, navigate_page,
get_network_requests, evaluate_script, etc) appear.
After scaffold
Tell the user, in order:
./scripts/launch-chrome.sh - opens the dedicated Chrome instance.
- Log in manually (user/password/2FA) once in that window; the isolated profile keeps it
logged in on later launches.
- Restart Claude Code to pick up the new MCP server.
- Use
list_pages to confirm the right tab, then get_network_requests filtered by the
target domain while exercising the feature.
- For each interesting request, write a
scripts/probe/<name>.mjs using plain fetch
with the same headers, to validate reproducibility outside the browser before wrapping
it as an MCP tool under src/.
Full walkthrough lives in the generated docs/chrome-mcp-setup.md.
Known constraints baked in
- CDP is Chrome's own protocol - the MCP server talks straight to it, no Playwright layer.
- The isolated profile is the whole point: it is what makes login persist between runs
without re-authenticating on every session.
- One port and one profile per project, so multiple projects' dedicated Chrome instances
don't collide.
Security notes
- The CDP port has no authentication of its own - it is only safe because it binds to
localhost. Never expose it through a tunnel or a public interface.
- The profile dir (
~/.chrome-<project>-profile) holds real session cookies. It lives
outside the repo; never commit it, never let it sync through Dropbox/iCloud/etc.
- No token, cookie, or captured response body may enter the repo - not in probe scripts,
not in commit messages, not in the generated doc.
Common mistakes
| Mistake |
Fix |
| Reusing one port/profile across projects |
Give each project its own PORT and PROJECT slug; instances collide otherwise. |
Overwriting another .mcp.json server entry |
Merge the chrome-devtools key in, don't replace the whole file. |
| Committing a probe script with a real captured token |
Read secrets from env vars or a gitignored local file, never hardcode them. |
Forgetting to restart Claude Code after editing .mcp.json |
New MCP tools only appear after a restart. |
1---2name: chrome-devtools-mcp3description: Scaffolds a dedicated Chrome instance with an isolated, persistent profile plus a chrome-devtools-mcp (CDP) server registration, so Claude can inspect authenticated network traffic in a web app - list open tabs, navigate, and read real requests (method, URL, sensitive headers, body, response shape) to reverse-engineer an API. Use when the user wants to inspect authenticated traffic in a browser, capture real headers/cookies for an integration, reverse-engineer a web app's undocumented API, or asks to set up chrome-devtools-mcp / CDP debugging.4---56# chrome-devtools-mcp78Scaffolds the setup needed to inspect authenticated network traffic through9`chrome-devtools-mcp` (Google's official CDP MCP server - not Playwright). Generates:1011- `scripts/launch-chrome.sh` - opens a dedicated Chrome instance with `--remote-debugging-port`12 and an isolated `--user-data-dir` profile that persists login state across runs.13- `docs/chrome-mcp-setup.md` - the usage flow: launch, log in once, register the MCP server,14 capture requests, turn them into probe scripts.15- `scripts/probe/` - dir (with a `.gitkeep`) where each captured request later becomes a16 minimal `fetch`-based reproduction script.1718## When to use1920- Reverse-engineering an app's API by watching what the browser actually sends when logged in.21- Capturing real `Authorization`/`Cookie`/CSRF headers to wire up an integration or MCP tool.22- Any task that needs `list_pages`, `navigate_page`, `get_network_requests`, or23 `evaluate_script` against an authenticated session.2425**Do NOT use** when the target API is already documented, or when an existing26`scripts/launch-chrome.sh` / `docs/chrome-mcp-setup.md` is present for this project - diff27manually instead, this skill refuses to overwrite unless `FORCE=1`.2829## Inputs to ask the user (in this order)30311. **Project slug (kebab-case)** - names the isolated profile dir (`~/.chrome-<slug>-profile`)32 and titles the doc.332. **CDP port** - e.g. `9222`. Ask if another project's Chrome is already using it; each34 project should get its own port so instances don't collide.353. **Start URL** - the app URL to open on launch (login page or the target feature).364. **Target dir** - project root to scaffold into (default `.`).3738## How to scaffold3940Run the scaffold script from the **target project root**:4142```bash43PROJECT=myapp PORT=9222 START_URL=https://app.example.com/login \44 TARGET_DIR=. ~/.claude/skills/chrome-devtools-mcp/scripts/scaffold.sh45```4647The script:48491. Renders `templates/scripts/launch-chrome.sh.tmpl` to `scripts/launch-chrome.sh` (executable).502. Renders `templates/docs/chrome-mcp-setup.md.tmpl` to `docs/chrome-mcp-setup.md`.513. Creates `scripts/probe/` for later per-request reproduction scripts.524. Refuses to overwrite existing files unless `FORCE=1`.5354## Register the MCP server5556Edit (or create) `.mcp.json` at the project root directly - merge into any existing57`mcpServers`, don't overwrite other entries:5859```json60{61 "mcpServers": {62 "chrome-devtools": {63 "command": "npx",64 "args": ["-y", "chrome-devtools-mcp@latest", "--browserUrl", "http://127.0.0.1:9222"]65 }66 }67}68```6970Then tell the user to restart Claude Code so the tools (`list_pages`, `navigate_page`,71`get_network_requests`, `evaluate_script`, etc) appear.7273## After scaffold7475Tell the user, in order:76771. `./scripts/launch-chrome.sh` - opens the dedicated Chrome instance.782. Log in manually (user/password/2FA) once in that window; the isolated profile keeps it79 logged in on later launches.803. Restart Claude Code to pick up the new MCP server.814. Use `list_pages` to confirm the right tab, then `get_network_requests` filtered by the82 target domain while exercising the feature.835. For each interesting request, write a `scripts/probe/<name>.mjs` using plain `fetch`84 with the same headers, to validate reproducibility outside the browser before wrapping85 it as an MCP tool under `src/`.8687Full walkthrough lives in the generated `docs/chrome-mcp-setup.md`.8889## Known constraints baked in9091- CDP is Chrome's own protocol - the MCP server talks straight to it, no Playwright layer.92- The isolated profile is the whole point: it is what makes login persist between runs93 without re-authenticating on every session.94- One port and one profile per project, so multiple projects' dedicated Chrome instances95 don't collide.9697## Security notes9899- The CDP port has no authentication of its own - it is only safe because it binds to100 localhost. Never expose it through a tunnel or a public interface.101- The profile dir (`~/.chrome-<project>-profile`) holds real session cookies. It lives102 outside the repo; never commit it, never let it sync through Dropbox/iCloud/etc.103- No token, cookie, or captured response body may enter the repo - not in probe scripts,104 not in commit messages, not in the generated doc.105106## Common mistakes107108| Mistake | Fix |109|--------|-----|110| Reusing one port/profile across projects | Give each project its own `PORT` and `PROJECT` slug; instances collide otherwise. |111| Overwriting another `.mcp.json` server entry | Merge the `chrome-devtools` key in, don't replace the whole file. |112| Committing a probe script with a real captured token | Read secrets from env vars or a gitignored local file, never hardcode them. |113| Forgetting to restart Claude Code after editing `.mcp.json` | New MCP tools only appear after a restart. |