|
| 1 | +--- |
| 2 | +name: troubleshooting |
| 3 | +description: Uses Chrome DevTools MCP and documentation to troubleshoot connection and target issues. Trigger this skill when list_pages, new_page, or navigate_page fail, or when the server initialization fails. |
| 4 | +--- |
| 5 | + |
| 6 | +## Troubleshooting Wizard |
| 7 | + |
| 8 | +You are acting as a troubleshooting wizard to help the user configure and fix their Chrome DevTools MCP server setup. When this skill is triggered (e.g., because `list_pages`, `new_page`, or `navigate_page` failed, or the server wouldn't start), follow this step-by-step diagnostic process: |
| 9 | + |
| 10 | +### Step 1: Find and Read Configuration |
| 11 | + |
| 12 | +Your first action should be to locate and read the MCP configuration file. Search for the following files in the user's workspace: `.mcp.json`, `gemini-extension.json`, `.claude/settings.json`, `.vscode/launch.json`, or `.gemini/settings.json`. |
| 13 | + |
| 14 | +If you find a configuration file, read and interpret it to identify potential issues such as: |
| 15 | + |
| 16 | +- Incorrect arguments or flags. |
| 17 | +- Missing environment variables. |
| 18 | +- Usage of `--autoConnect` in incompatible environments. |
| 19 | + |
| 20 | +If you cannot find any of these files, only then should you ask the user to provide their configuration file content. |
| 21 | + |
| 22 | +### Step 2: Triage Common Connection Errors |
| 23 | + |
| 24 | +Before reading documentation or suggesting configuration changes, check if the error message matches one of the following common patterns. |
| 25 | + |
| 26 | +#### Error: `Could not find DevToolsActivePort` |
| 27 | + |
| 28 | +This error is highly specific to the `--autoConnect` feature. It means the MCP server cannot find the file created by a running, debuggable Chrome instance. This is not a generic connection failure. |
| 29 | + |
| 30 | +Your primary goal is to guide the user to ensure Chrome is running and properly configured. Do not immediately suggest switching to `--browserUrl`. Follow this exact sequence: |
| 31 | + |
| 32 | +1. **Ask the user to confirm that the correct Chrome version** (e.g., "Chrome Canary" if the error mentions it) is currently running. |
| 33 | +2. **If the user confirms it is running, instruct them to enable remote debugging.** Be very specific about the URL and the action: "Please open a new tab in Chrome, navigate to `chrome://inspect/#remote-debugging`, and make sure the 'Enable remote debugging' checkbox is checked." |
| 34 | +3. **Once the user confirms both steps, your only next action should be to call the `list_pages` tool.** This is the simplest and safest way to verify if the connection is now successful. Do not retry the original, more complex command yet. |
| 35 | +4. **If `list_pages` succeeds, the problem is resolved.** If it still fails with the same error, then you can proceed to the more advanced steps like suggesting `--browserUrl` or checking for sandboxing issues. |
| 36 | + |
| 37 | +#### Symptom: Server starts but creates a new empty profile |
| 38 | + |
| 39 | +If the server starts successfully but `list_pages` returns an empty list or creates a new profile instead of connecting to the existing Chrome instance, check for typos in the arguments. |
| 40 | + |
| 41 | +- **Check for flag typos:** For example, `--autoBronnect` instead of `--autoConnect`. |
| 42 | +- **Verify the configuration:** Ensure the arguments match the expected flags exactly. |
| 43 | + |
| 44 | +#### Other Common Errors |
| 45 | + |
| 46 | +Identify other error messages from the failed tool call or the MCP initialization logs: |
| 47 | + |
| 48 | +- `Target closed` |
| 49 | +- "Tool not found" (check if they are using `--slim` which only enables navigation and screenshot tools). |
| 50 | +- `ProtocolError: Network.enable timed out` or `The socket connection was closed unexpectedly` |
| 51 | +- `Error [ERR_MODULE_NOT_FOUND]: Cannot find module` |
| 52 | +- Any sandboxing or host validation errors. |
| 53 | + |
| 54 | +### Step 3: Read Known Issues |
| 55 | + |
| 56 | +Read the contents of https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/troubleshooting.md to map the error to a known issue. Pay close attention to: |
| 57 | + |
| 58 | +- Sandboxing restrictions (macOS Seatbelt, Linux containers). |
| 59 | +- WSL requirements. |
| 60 | +- `--autoConnect` handshakes, timeouts, and requirements (requires **running** Chrome 144+). |
| 61 | + |
| 62 | +### Step 4: Formulate a Configuration |
| 63 | + |
| 64 | +Based on the exact error and the user's environment (OS, MCP client), formulate the correct MCP configuration snippet. Check if they need to: |
| 65 | + |
| 66 | +- Pass `--browser-url=http://127.0.0.1:9222` instead of `--autoConnect` (e.g. if they are in a sandboxed environment like Claude Desktop). |
| 67 | +- Enable remote debugging in Chrome (`chrome://inspect/#remote-debugging`) and accept the connection prompt. **Ask the user to verify this is enabled if using `--autoConnect`.** |
| 68 | +- Add `--logFile <absolute_path_to_log_file>` to capture debug logs for analysis. |
| 69 | +- Increase `startup_timeout_ms` (e.g. to 20000) if using Codex on Windows. |
| 70 | + |
| 71 | +_If you are unsure of the user's configuration, ask the user to provide their current MCP server JSON configuration._ |
| 72 | + |
| 73 | +### Step 5: Run Diagnostic Commands |
| 74 | + |
| 75 | +If the issue is still unclear, run diagnostic commands to test the server directly: |
| 76 | + |
| 77 | +- Run `npx chrome-devtools-mcp@latest --help` to verify the installation and Node.js environment. |
| 78 | +- If you need more information, run `DEBUG=* npx chrome-devtools-mcp@latest --logFile=/tmp/cdm-test.log` to capture verbose logs. Analyze the output for errors. |
| 79 | + |
| 80 | +### Step 6: Check GitHub for Existing Issues |
| 81 | + |
| 82 | +If https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/troubleshooting.md does not cover the specific error, check if the `gh` (GitHub CLI) tool is available in the environment. If so, search the GitHub repository for similar issues: |
| 83 | +`gh issue list --repo ChromeDevTools/chrome-devtools-mcp --search "<error snippet>" --state all` |
| 84 | + |
| 85 | +Alternatively, you can recommend that the user checks https://github.com/ChromeDevTools/chrome-devtools-mcp/issues and https://github.com/ChromeDevTools/chrome-devtools-mcp/discussions for help. |
0 commit comments