chromedevtools--chrome-devtools-mcp
1.4 KiB
1.4 KiB
This repository contains an MCP server and CLI for Chrome DevTools.
Instructions
- Use only scripts from
package.jsonto run commands. - Use
npm run buildto run tsc and test build. - Use
npm run testto build and run tests, run all tests to verify correctness. - Use
npm run test path-to-test.tsto build and run a single test file, for example,npm run test tests/McpContext.test.ts. - Use
npm run formatto fix formatting and get linting errors.
Rules for TypeScript
- Do not use
anytype. - Do not use
askeyword for type casting. - Do not use
!operator for type assertion. - Do not use
// @ts-ignorecomments. - Do not use
// @ts-nocheckcomments. - Do not use
// @ts-expect-errorcomments. - Prefer
for..ofinstead offorEach.
Testing Layering
When writing tests, follow this layered approach:
- Tool Tests (
tests/tools/*.test.ts): Should test that tools correctly configure theMcpResponsebased on their inputs. - Data Fetching Tests (
tests/McpResponse.test.ts): Should test that data is correctly fetched from the browser based on theMcpResponseconfiguration. These tests should use snapshots. Data fetching should happen in McpResponse ONLY if it is used by more than one tool. - Formatter Tests (
tests/formatters/*.test.ts): Should test that mock data is formatted and output correctly by the formatters. These tests should use snapshots.