chromedevtools--chrome-devtools-mcp
1ac574e715
This PR enables an alternative CLI interface for Chrome DevTools MCP. `chrome-devtools` can be used in shell scripts to automate the Chrome DevTools MCP session running as a daemon process. Currently, a single session is shared between all `chrome-devtools` calls. All tools available by default are included into the CLI. Examples: ```bash ❯ chrome-devtools navigate_page --url https://example.com Successfully navigated to https://example.com. ## Pages 1: https://example.com/ [selected] ❯ chrome-devtools lighthouse_audit ## Lighthouse Audit Results Mode: navigation Device: desktop URL: https://example.com/ ### Category Scores - Accessibility: 96 (accessibility) - Best Practices: 96 (best-practices) - SEO: 80 (seo) ### Audit Summary Passed: 30 Failed: 4 Total Timing: 4107.22ms ### Reports - /var/folders/hq/m1wr43z9665g5pghys7gkc2w00r23k/T/chrome-devtools-mcp-l5LRIT/report.json - /var/folders/hq/m1wr43z9665g5pghys7gkc2w00r23k/T/chrome-devtools-mcp-3o6rcM/report.htm ``` ```sh ❯ chrome-devtools lighthouse_audit --format=json | jq { "lighthouseResult": { "summary": { "mode": "navigation", "device": "desktop", "url": "https://example.com/", "scores": [ { "id": "accessibility", "title": "Accessibility", "score": 0.96 }, { "id": "best-practices", "title": "Best Practices", "score": 0.96 }, { "id": "seo", "title": "SEO", "score": 0.8 } ], "audits": { "failed": 4, "passed": 30 }, "timing": { "total": 3754.87 } }, "reports": [ "/var/folders/hq/m1wr43z9665g5pghys7gkc2w00r23k/T/chrome-devtools-mcp-nbLj82/report.json", "/var/folders/hq/m1wr43z9665g5pghys7gkc2w00r23k/T/chrome-devtools-mcp-VTp35b/report.html" ] } } ``` To test: ```sh npm ci npm run clean npm run bundle npm pack npm i chrome-devtools-mcp-0.18.1.tgz -g # to install globally ``` --------- Co-authored-by: Mathias Bynens <mathias@qiwi.be>
879 B
879 B
Installation
Install the package globally to make the chrome-devtools command available. You only need to do this the first time you use it.
npm i chrome-devtools-mcp@latest -g
chrome-devtools status # check if install worked.
Troubleshooting
- Command not found: If
chrome-devtoolsis not recognized, ensure your global npmbindirectory is in your system'sPATH. Restart your terminal or source your shell configuration file (e.g.,.bashrc,.zshrc). - Permission errors: If you encounter
EACCESor permission errors during installation, avoid usingsudo. Instead, use a node version manager likenvm, or configure npm to use a different global directory. - Old version running: Run
chrome-devtools stop && npm uninstall -g chrome-devtools-mcpbefore reinstalling, or ensure the latest version is being picked up by your path.