@gabrielbryk/arc-devtools-mcp 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +977 -0
- package/build/src/HeapSnapshotManager.js +148 -0
- package/build/src/McpContext.js +737 -0
- package/build/src/McpPage.js +315 -0
- package/build/src/McpResponse.js +990 -0
- package/build/src/Mutex.js +38 -0
- package/build/src/PageCollector.js +297 -0
- package/build/src/ServiceWorkerCollector.js +171 -0
- package/build/src/SlimMcpResponse.js +19 -0
- package/build/src/TextSnapshot.js +236 -0
- package/build/src/ToolHandler.js +223 -0
- package/build/src/WaitForHelper.js +190 -0
- package/build/src/bin/check-latest-version.js +50 -0
- package/build/src/bin/chrome-devtools-cli-options.js +978 -0
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +412 -0
- package/build/src/bin/chrome-devtools-mcp-main.js +72 -0
- package/build/src/bin/chrome-devtools-mcp.js +23 -0
- package/build/src/bin/chrome-devtools.js +189 -0
- package/build/src/browser.js +253 -0
- package/build/src/daemon/client.js +160 -0
- package/build/src/daemon/daemon.js +261 -0
- package/build/src/daemon/types.js +7 -0
- package/build/src/daemon/utils.js +115 -0
- package/build/src/devtools/DevToolsConnectionAdapter.js +70 -0
- package/build/src/devtools/DevtoolsUtils.js +369 -0
- package/build/src/devtools/McpHostBindingAdapter.js +165 -0
- package/build/src/formatters/ConsoleFormatter.js +288 -0
- package/build/src/formatters/HeapSnapshotFormatter.js +97 -0
- package/build/src/formatters/IssueFormatter.js +193 -0
- package/build/src/formatters/NetworkFormatter.js +238 -0
- package/build/src/formatters/SnapshotFormatter.js +135 -0
- package/build/src/index.js +153 -0
- package/build/src/issue-descriptions.js +40 -0
- package/build/src/logger.js +37 -0
- package/build/src/polyfill.js +8 -0
- package/build/src/telemetry/ClearcutLogger.js +169 -0
- package/build/src/telemetry/WatchdogClient.js +61 -0
- package/build/src/telemetry/errors.js +18 -0
- package/build/src/telemetry/flagUtils.js +89 -0
- package/build/src/telemetry/metricsRegistry.js +89 -0
- package/build/src/telemetry/persistence.js +72 -0
- package/build/src/telemetry/transformation.js +134 -0
- package/build/src/telemetry/types.js +31 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
- package/build/src/telemetry/watchdog/main.js +128 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +3637 -0
- package/build/src/third_party/bundled-packages.json +12 -0
- package/build/src/third_party/devtools-formatter-worker.js +15301 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +9870 -0
- package/build/src/third_party/index.js +159597 -0
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +7 -0
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +6 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +4 -0
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +18 -0
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +19 -0
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +8 -0
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +9 -0
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +13 -0
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +12 -0
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +10 -0
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +11 -0
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +8 -0
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +61598 -0
- package/build/src/tools/ToolDefinition.js +73 -0
- package/build/src/tools/categories.js +36 -0
- package/build/src/tools/console.js +98 -0
- package/build/src/tools/emulation.js +84 -0
- package/build/src/tools/extensions.js +101 -0
- package/build/src/tools/input.js +469 -0
- package/build/src/tools/lighthouse.js +136 -0
- package/build/src/tools/memory.js +227 -0
- package/build/src/tools/network.js +125 -0
- package/build/src/tools/pages.js +419 -0
- package/build/src/tools/performance.js +200 -0
- package/build/src/tools/screencast.js +117 -0
- package/build/src/tools/screenshot.js +169 -0
- package/build/src/tools/script.js +151 -0
- package/build/src/tools/slim/tools.js +88 -0
- package/build/src/tools/snapshot.js +61 -0
- package/build/src/tools/thirdPartyDeveloper.js +85 -0
- package/build/src/tools/tools.js +56 -0
- package/build/src/tools/webmcp.js +66 -0
- package/build/src/trace-processing/parse.js +85 -0
- package/build/src/types.js +7 -0
- package/build/src/utils/check-for-updates.js +74 -0
- package/build/src/utils/files.js +61 -0
- package/build/src/utils/id.js +16 -0
- package/build/src/utils/keyboard.js +297 -0
- package/build/src/utils/pagination.js +50 -0
- package/build/src/utils/string.js +37 -0
- package/build/src/utils/types.js +7 -0
- package/build/src/version.js +10 -0
- package/package.json +100 -0
- package/skills/a11y-debugging/SKILL.md +89 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/chrome-devtools/SKILL.md +72 -0
- package/skills/chrome-devtools-cli/SKILL.md +153 -0
- package/skills/chrome-devtools-cli/references/installation.md +14 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/memory-leak-debugging/SKILL.md +50 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/memory-leak-debugging/references/compare_snapshots.js +109 -0
- package/skills/memory-leak-debugging/references/memlab.md +29 -0
- package/skills/troubleshooting/SKILL.md +98 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-optimize-lcp
|
|
3
|
+
description: Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions "largest contentful paint", "page load speed", "CWV", or wants to improve how fast their hero image or main content renders.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## What is LCP and why it matters
|
|
7
|
+
|
|
8
|
+
Largest Contentful Paint (LCP) measures how quickly a page's main content becomes visible. It's the time from navigation start until the largest image or text block renders in the viewport.
|
|
9
|
+
|
|
10
|
+
- **Good**: 2.5 seconds or less
|
|
11
|
+
- **Needs improvement**: 2.5–4.0 seconds
|
|
12
|
+
- **Poor**: greater than 4.0 seconds
|
|
13
|
+
|
|
14
|
+
LCP is a Core Web Vital that directly affects user experience and search ranking. On 73% of mobile pages, the LCP element is an image.
|
|
15
|
+
|
|
16
|
+
## LCP Subparts Breakdown
|
|
17
|
+
|
|
18
|
+
Every page's LCP breaks down into four sequential subparts with no gaps or overlaps. Understanding which subpart is the bottleneck is the key to effective optimization.
|
|
19
|
+
|
|
20
|
+
| Subpart | Ideal % of LCP | What it measures |
|
|
21
|
+
| ----------------------------- | -------------- | ---------------------------------------------- |
|
|
22
|
+
| **Time to First Byte (TTFB)** | ~40% | Navigation start → first byte of HTML received |
|
|
23
|
+
| **Resource load delay** | <10% | TTFB → browser starts loading the LCP resource |
|
|
24
|
+
| **Resource load duration** | ~40% | Time to download the LCP resource |
|
|
25
|
+
| **Element render delay** | <10% | LCP resource downloaded → LCP element rendered |
|
|
26
|
+
|
|
27
|
+
The "delay" subparts should be as close to zero as possible. If either delay subpart is large relative to the total LCP, that's the first place to optimize.
|
|
28
|
+
|
|
29
|
+
**Common Pitfall**: Optimizing one subpart (like compressing an image to reduce load duration) without checking others. If render delay is the real bottleneck, a smaller image won't help — the saved time just shifts to render delay.
|
|
30
|
+
|
|
31
|
+
## Debugging Workflow
|
|
32
|
+
|
|
33
|
+
Follow these steps in order. Each step builds on the previous one.
|
|
34
|
+
|
|
35
|
+
### Step 1: Record a Performance Trace
|
|
36
|
+
|
|
37
|
+
Navigate to the page, then record a trace with reload to capture the full page load including LCP:
|
|
38
|
+
|
|
39
|
+
1. `navigate_page` to the target URL.
|
|
40
|
+
2. `performance_start_trace` with `reload: true` and `autoStop: true`.
|
|
41
|
+
|
|
42
|
+
The trace results will include LCP timing and available insight sets. Note the insight set IDs from the output — you'll need them in the next step.
|
|
43
|
+
|
|
44
|
+
### Step 2: Analyze LCP Insights
|
|
45
|
+
|
|
46
|
+
Use `performance_analyze_insight` to drill into LCP-specific insights. Look for these insight names in the trace results:
|
|
47
|
+
|
|
48
|
+
- **LCPBreakdown** — Shows the four LCP subparts with timing for each.
|
|
49
|
+
- **DocumentLatency** — Server response time issues affecting TTFB.
|
|
50
|
+
- **RenderBlocking** — Resources blocking the LCP element from rendering.
|
|
51
|
+
- **LCPDiscovery** — Whether the LCP resource was discoverable early.
|
|
52
|
+
|
|
53
|
+
Call `performance_analyze_insight` with the insight set ID and the insight name from the trace results.
|
|
54
|
+
|
|
55
|
+
### Step 3: Identify the LCP Element
|
|
56
|
+
|
|
57
|
+
Use `evaluate_script` with the **"Identify LCP Element" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to reveal the LCP element's tag, resource URL, and raw timing data.
|
|
58
|
+
|
|
59
|
+
The `url` field tells you what resource to look for in the network waterfall. If `url` is empty, the LCP element is text-based (no resource to load).
|
|
60
|
+
|
|
61
|
+
### Step 4: Check the Network Waterfall
|
|
62
|
+
|
|
63
|
+
Use `list_network_requests` to see when the LCP resource loaded relative to other resources:
|
|
64
|
+
|
|
65
|
+
- Call `list_network_requests` filtered by `resourceTypes: ["Image", "Font"]` (adjust based on Step 3).
|
|
66
|
+
- Then use `get_network_request` with the LCP resource's request ID for full details.
|
|
67
|
+
|
|
68
|
+
**Key Checks:**
|
|
69
|
+
|
|
70
|
+
- **Start Time**: Compare against the HTML document and the first resource. If the LCP resource starts much later than the first resource, there's resource load delay to eliminate.
|
|
71
|
+
- **Duration**: A large resource load duration suggests the file is too big or the server is slow.
|
|
72
|
+
|
|
73
|
+
### Step 5: Inspect HTML for Common Issues
|
|
74
|
+
|
|
75
|
+
Use `evaluate_script` with the **"Audit Common Issues" snippet** found in [references/lcp-snippets.md](references/lcp-snippets.md) to check for lazy-loaded images in the viewport, missing fetchpriority, and render-blocking scripts.
|
|
76
|
+
|
|
77
|
+
## Optimization Strategies
|
|
78
|
+
|
|
79
|
+
After identifying the bottleneck subpart, apply these prioritized fixes.
|
|
80
|
+
|
|
81
|
+
### 1. Eliminate Resource Load Delay (target: <10%)
|
|
82
|
+
|
|
83
|
+
The most common bottleneck. The LCP resource should start loading immediately.
|
|
84
|
+
|
|
85
|
+
- **Root Cause**: LCP image loaded via JS/CSS, `data-src` usage, or `loading="lazy"`.
|
|
86
|
+
- **Fix**: Use standard `<img>` with `src`. **Never** lazy-load the LCP image.
|
|
87
|
+
- **Fix**: Add `<link rel="preload" fetchpriority="high">` if the image isn't discoverable in HTML.
|
|
88
|
+
- **Fix**: Add `fetchpriority="high"` to the LCP `<img>` tag.
|
|
89
|
+
|
|
90
|
+
### 2. Eliminate Element Render Delay (target: <10%)
|
|
91
|
+
|
|
92
|
+
The element should render immediately after loading.
|
|
93
|
+
|
|
94
|
+
- **Root Cause**: Large stylesheets, synchronous scripts in `<head>`, or main thread blocking.
|
|
95
|
+
- **Fix**: Inline critical CSS, defer non-critical CSS/JS.
|
|
96
|
+
- **Fix**: Break up long tasks blocking the main thread.
|
|
97
|
+
- **Fix**: Use Server-Side Rendering (SSR) so the element exists in initial HTML.
|
|
98
|
+
|
|
99
|
+
### 3. Reduce Resource Load Duration (target: ~40%)
|
|
100
|
+
|
|
101
|
+
Make the resource smaller or faster to deliver.
|
|
102
|
+
|
|
103
|
+
- **Fix**: Use modern formats (WebP, AVIF) and responsive images (`srcset`).
|
|
104
|
+
- **Fix**: Serve from a CDN.
|
|
105
|
+
- **Fix**: Set `Cache-Control` headers.
|
|
106
|
+
- **Fix**: Use `font-display: swap` if LCP is text blocked by a web font.
|
|
107
|
+
|
|
108
|
+
### 4. Reduce TTFB (target: ~40%)
|
|
109
|
+
|
|
110
|
+
The HTML document itself takes too long to arrive.
|
|
111
|
+
|
|
112
|
+
- **Fix**: Minimize redirects and optimize server response time.
|
|
113
|
+
- **Fix**: Cache HTML at the edge (CDN).
|
|
114
|
+
- **Fix**: Ensure pages are eligible for back/forward cache (bfcache).
|
|
115
|
+
|
|
116
|
+
## Verifying Fixes & Emulation
|
|
117
|
+
|
|
118
|
+
- **Verification**: Re-run the trace (`performance_start_trace` with `reload: true`) and compare the new subpart breakdown. The bottleneck should shrink.
|
|
119
|
+
- **Emulation**: Lab measurements differ from real-world experience. Use `emulate` to test under constraints:
|
|
120
|
+
- `emulate` with `networkConditions: "Fast 3G"` and `cpuThrottlingRate: 4`.
|
|
121
|
+
- This surfaces issues visible only on slower connections/devices.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Elements and Size for LCP
|
|
2
|
+
|
|
3
|
+
## What Elements are Considered?
|
|
4
|
+
|
|
5
|
+
The types of elements considered for Largest Contentful Paint (LCP) are:
|
|
6
|
+
|
|
7
|
+
- **`<img>` elements**: The first frame presentation time is used for animated content like GIFs.
|
|
8
|
+
- **`<image>` elements** inside an `<svg>` element.
|
|
9
|
+
- **`<video>` elements**: The poster image load time or first frame presentation time, whichever is earlier.
|
|
10
|
+
- **Background images**: Elements with a background image loaded using `url()`.
|
|
11
|
+
- **Block-level elements**: Containing text nodes or other inline-level text element children.
|
|
12
|
+
|
|
13
|
+
## Heuristics to Exclude Non-Contentful Elements
|
|
14
|
+
|
|
15
|
+
Chromium-based browsers use heuristics to exclude:
|
|
16
|
+
|
|
17
|
+
- Elements with **opacity of 0**.
|
|
18
|
+
- Elements that **cover the full viewport** (likely background).
|
|
19
|
+
- **Placeholder images** or low-entropy images.
|
|
20
|
+
|
|
21
|
+
## How is an Element's Size Determined?
|
|
22
|
+
|
|
23
|
+
- **Visible Area**: Typically the size visible within the viewport. Extending outside, clipped, or overflow portions don't count.
|
|
24
|
+
- **Image Elements**: Either the visible size or the intrinsic size, whichever is smaller.
|
|
25
|
+
- **Text Elements**: The smallest rectangle containing all text nodes.
|
|
26
|
+
- **Exclusions**: Margin, padding, and borders are not considered toward the size.
|
|
27
|
+
- **Containment**: Every text node belongs to its closest block-level ancestor element.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Largest Contentful Paint (LCP) Breakdown
|
|
2
|
+
|
|
3
|
+
LCP measures the time from when the user initiates loading the page until the largest image or text block is rendered within the viewport. To provide a good user experience, sites should strive to have an LCP of 2.5 seconds or less for at least 75% of page visits.
|
|
4
|
+
|
|
5
|
+
## The Four Subparts of LCP
|
|
6
|
+
|
|
7
|
+
Every page's LCP consists of these four subcategories. There's no gap or overlap between them, and they add up to the full LCP time.
|
|
8
|
+
|
|
9
|
+
| LCP subpart | % of LCP (Optimal) | Description |
|
|
10
|
+
| ----------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
11
|
+
| **Time to First Byte (TTFB)** | ~40% | The time from when the user initiates loading the page until the browser receives the first byte of the HTML document response. |
|
|
12
|
+
| **Resource load delay** | <10% | The time between TTFB and when the browser starts loading the LCP resource. If the LCP element doesn't require a resource load (e.g., system font text), this time is 0. |
|
|
13
|
+
| **Resource load duration** | ~40% | The duration of time it takes to load the LCP resource itself. If the LCP element doesn't require a resource load, this time is 0. |
|
|
14
|
+
| **Element render delay** | <10% | The time between when the LCP resource finishes loading and the LCP element rendering fully. |
|
|
15
|
+
|
|
16
|
+
## Why the Breakdown Matters
|
|
17
|
+
|
|
18
|
+
Optimizing for LCP requires identifying which of these subparts is the bottleneck:
|
|
19
|
+
|
|
20
|
+
- **Large delta between TTFB and FCP**: Indicates the browser needs to download a lot of render-blocking assets or complete a lot of work (e.g., client-side rendering).
|
|
21
|
+
- **Large delta between FCP and LCP**: Indicates the LCP resource is not immediately available for the browser to prioritize or the browser is completing other work before it can display the LCP content.
|
|
22
|
+
- **Large resource load delay**: Indicates the resource is not discoverable early or is deprioritized.
|
|
23
|
+
- **Large element render delay**: Indicates rendering is blocked by stylesheets, scripts, or long tasks.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# LCP Debugging Snippets
|
|
2
|
+
|
|
3
|
+
Use these JavaScript snippets with the `evaluate_script` tool to extract deep insights from the page.
|
|
4
|
+
|
|
5
|
+
## 1. Identify LCP Element
|
|
6
|
+
|
|
7
|
+
Use this snippet to identify the LCP element and get raw timing data from the Performance API.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
async () => {
|
|
11
|
+
return await new Promise(resolve => {
|
|
12
|
+
new PerformanceObserver(list => {
|
|
13
|
+
const entries = list.getEntries();
|
|
14
|
+
const last = entries[entries.length - 1];
|
|
15
|
+
resolve({
|
|
16
|
+
element: last.element?.tagName,
|
|
17
|
+
id: last.element?.id,
|
|
18
|
+
className: last.element?.className,
|
|
19
|
+
url: last.url,
|
|
20
|
+
startTime: last.startTime,
|
|
21
|
+
renderTime: last.renderTime,
|
|
22
|
+
loadTime: last.loadTime,
|
|
23
|
+
size: last.size,
|
|
24
|
+
});
|
|
25
|
+
}).observe({type: 'largest-contentful-paint', buffered: true});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 2. Audit Common Issues
|
|
31
|
+
|
|
32
|
+
Use this snippet to check for common DOM-based LCP issues (lazy loading, priority).
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
() => {
|
|
36
|
+
const issues = [];
|
|
37
|
+
|
|
38
|
+
// Check for lazy-loaded images in viewport
|
|
39
|
+
document.querySelectorAll('img[loading="lazy"]').forEach(img => {
|
|
40
|
+
const rect = img.getBoundingClientRect();
|
|
41
|
+
if (rect.top < window.innerHeight) {
|
|
42
|
+
issues.push({
|
|
43
|
+
issue: 'lazy-loaded image in viewport',
|
|
44
|
+
element: img.outerHTML.substring(0, 200),
|
|
45
|
+
fix: 'Remove loading="lazy" from this image — it is in the initial viewport and may be the LCP element',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Check for LCP-candidate images missing fetchpriority
|
|
51
|
+
document.querySelectorAll('img:not([fetchpriority])').forEach(img => {
|
|
52
|
+
const rect = img.getBoundingClientRect();
|
|
53
|
+
if (rect.top < window.innerHeight && rect.width * rect.height > 50000) {
|
|
54
|
+
issues.push({
|
|
55
|
+
issue: 'large viewport image without fetchpriority',
|
|
56
|
+
element: img.outerHTML.substring(0, 200),
|
|
57
|
+
fix: 'Add fetchpriority="high" to this image — it is large and visible in the initial viewport',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Check for render-blocking scripts in head
|
|
63
|
+
document
|
|
64
|
+
.querySelectorAll(
|
|
65
|
+
'head script:not([async]):not([defer]):not([type="module"])',
|
|
66
|
+
)
|
|
67
|
+
.forEach(script => {
|
|
68
|
+
if (script.src) {
|
|
69
|
+
issues.push({
|
|
70
|
+
issue: 'render-blocking script in head',
|
|
71
|
+
element: script.outerHTML.substring(0, 200),
|
|
72
|
+
fix: 'Add async or defer attribute, or move to end of body',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {issueCount: issues.length, issues};
|
|
78
|
+
};
|
|
79
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# LCP Optimization Strategies
|
|
2
|
+
|
|
3
|
+
## 1. Eliminate Resource Load Delay
|
|
4
|
+
|
|
5
|
+
**Goal**: Ensure the LCP resource starts loading as early as possible.
|
|
6
|
+
|
|
7
|
+
- **Early Discovery**: Ensure the LCP resource is discoverable in the initial HTML document response (not dynamically added by JS or hidden in `data-src`).
|
|
8
|
+
- **Preload**: Use `<link rel="preload">` with `fetchpriority="high"` for critical images or fonts.
|
|
9
|
+
- **Avoid Lazy Loading**: Never set `loading="lazy"` on the LCP image.
|
|
10
|
+
- **Fetch Priority**: Use `fetchpriority="high"` on the `<img>` tag.
|
|
11
|
+
- **Same Origin**: Host critical resources on the same origin or use `<link rel="preconnect">`.
|
|
12
|
+
|
|
13
|
+
## 2. Eliminate Element Render Delay
|
|
14
|
+
|
|
15
|
+
**Goal**: Ensure the LCP element can render immediately after its resource has finished loading.
|
|
16
|
+
|
|
17
|
+
- **Minimize Render-Blocking CSS**: Inline critical CSS and defer non-critical CSS. Ensure the stylesheet is smaller than the LCP resource.
|
|
18
|
+
- **Minimize Render-Blocking JS**: Avoid synchronous scripts in the `<head>`. Inline very small scripts.
|
|
19
|
+
- **Server-Side Rendering (SSR)**: Deliver the full HTML markup from the server so image resources are discoverable immediately.
|
|
20
|
+
- **Break Up Long Tasks**: Prevent large JavaScript tasks from blocking the main thread during rendering.
|
|
21
|
+
|
|
22
|
+
## 3. Reduce Resource Load Duration
|
|
23
|
+
|
|
24
|
+
**Goal**: Reduce the time spent transferring the bytes of the resource.
|
|
25
|
+
|
|
26
|
+
- **Optimize Resource Size**: Serve optimal image sizes, use modern formats (AVIF, WebP), and compress images/fonts.
|
|
27
|
+
- **Geographic Proximity (CDN)**: Use a Content Delivery Network to get servers closer to users.
|
|
28
|
+
- **Reduce Contention**: Use `fetchpriority="high"` to prevent lower-priority resources from competing for bandwidth.
|
|
29
|
+
- **Caching**: Use efficient `Cache-Control` policies.
|
|
30
|
+
|
|
31
|
+
## 4. Reduce Time to First Byte (TTFB)
|
|
32
|
+
|
|
33
|
+
**Goal**: Deliver the initial HTML as quickly as possible.
|
|
34
|
+
|
|
35
|
+
- **Minimize Redirects**: Avoid multiple redirects from advertisements or shortened links.
|
|
36
|
+
- **CDN Caching**: Cache static HTML documents at the edge.
|
|
37
|
+
- **Edge Computing**: Move dynamic logic to the edge to avoid trips to the origin server.
|
|
38
|
+
- **Back/Forward Cache**: Ensure pages are eligible for bfcache.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory-leak-debugging
|
|
3
|
+
description: Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to analyze heapsnapshots or run memory leak detection tools like memlab.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory Leak Debugging
|
|
7
|
+
|
|
8
|
+
This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
- **Prefer `memlab`:** Do NOT attempt to read raw `.heapsnapshot` files directly, as they are extremely large and will consume too many tokens. Always recommend and use `memlab` to process snapshots and identify leak traces.
|
|
13
|
+
- **Isolate the Leak:** Determine if the leak is in the browser (client-side) or Node.js (server-side).
|
|
14
|
+
- **Common Culprits:** Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. _Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them._
|
|
15
|
+
|
|
16
|
+
## Workflows
|
|
17
|
+
|
|
18
|
+
### 1. Capturing Snapshots
|
|
19
|
+
|
|
20
|
+
When investigating a frontend web application memory leak, utilize the `chrome-devtools-mcp` tools to interact with the application and take snapshots.
|
|
21
|
+
|
|
22
|
+
- Use tools like `click`, `navigate_page`, `fill`, etc., to manipulate the page into the desired state.
|
|
23
|
+
- Revert the page back to the original state after interactions to see if memory is released.
|
|
24
|
+
- Repeat the same user interactions 10 times to amplify the leak.
|
|
25
|
+
- Use `take_heapsnapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
|
|
26
|
+
|
|
27
|
+
### 2. Using Memlab to Find Leaks (Recommended)
|
|
28
|
+
|
|
29
|
+
Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, use `memlab` to automatically find memory leaks.
|
|
30
|
+
|
|
31
|
+
- Read [references/memlab.md](references/memlab.md) for how to use `memlab` to analyze the generated heapsnapshots.
|
|
32
|
+
- Do **not** read raw `.heapsnapshot` files using `read_file` or `cat`.
|
|
33
|
+
|
|
34
|
+
### 3. Identifying Common Leaks
|
|
35
|
+
|
|
36
|
+
When you have found a leak trace (e.g., via `memlab` output), you must identify the root cause in the code.
|
|
37
|
+
|
|
38
|
+
- Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them.
|
|
39
|
+
|
|
40
|
+
### 4. Fallback: Comparing Snapshots Manually
|
|
41
|
+
|
|
42
|
+
If `memlab` is not available, you MUST use the fallback script in the references directory to compare two `.heapsnapshot` files and identify the top growing objects and common leak types.
|
|
43
|
+
|
|
44
|
+
Run the script using Node.js:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
node skills/memory-leak-debugging/references/compare_snapshots.js <baseline.heapsnapshot> <target.heapsnapshot>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The script will analyze and output the top growing objects by size and highlight the 3 most common types of memory leaks (e.g., Detached DOM nodes, closures, Contexts) if they are present.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Common Memory Leaks
|
|
2
|
+
|
|
3
|
+
When analyzing a retainer trace from `memlab`, look for these common patterns in the codebase:
|
|
4
|
+
|
|
5
|
+
## 1. Uncleared Event Listeners
|
|
6
|
+
|
|
7
|
+
Event listeners attached to global objects (like `window` or `document`) or long-living objects prevent garbage collection of the objects referenced in their callbacks.
|
|
8
|
+
|
|
9
|
+
**Fix:** Always call `removeEventListener` when a component unmounts or the listener is no longer needed.
|
|
10
|
+
|
|
11
|
+
## 2. Detached DOM Nodes
|
|
12
|
+
|
|
13
|
+
A DOM node is removed from the document tree but is still referenced by a JavaScript variable. While detachedness is a good signal for a memory leak, it's not always a bug. For example, websites sometimes intentionally cache detached navigation trees.
|
|
14
|
+
|
|
15
|
+
**Fix:** Signal the detached nodes to the user first. **Ask the user first** before nulling the references or changing the code, as the detached nodes might be part of an intentional cache. If confirmed as a leak, ensure variables holding DOM references are set to `null` when the node is removed, or limit their scope.
|
|
16
|
+
|
|
17
|
+
## 3. Unintentional Global Variables
|
|
18
|
+
|
|
19
|
+
Variables declared without `var`, `let`, or `const` (in non-strict mode) or explicitly attached to `window` remain in memory forever.
|
|
20
|
+
|
|
21
|
+
**Fix:** Use strict mode, properly declare variables, and avoid global state.
|
|
22
|
+
|
|
23
|
+
## 4. Closures
|
|
24
|
+
|
|
25
|
+
Closures can unintentionally keep references to large objects in their outer scope.
|
|
26
|
+
|
|
27
|
+
**Fix:** Nullify large objects when they are no longer needed, or refactor the closure to not capture unnecessary variables.
|
|
28
|
+
|
|
29
|
+
## 5. Unbounded Caches or Arrays
|
|
30
|
+
|
|
31
|
+
Data structures used for caching (like objects, Arrays, or Maps) that grow without limits.
|
|
32
|
+
|
|
33
|
+
**Fix:** Implement caching limits, use LRU caches, or use `WeakMap`/`WeakSet` for data associated with object lifecycles.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from 'node:fs';
|
|
8
|
+
|
|
9
|
+
function parseSnapshot(filePath) {
|
|
10
|
+
console.log(`Loading ${filePath}...`);
|
|
11
|
+
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
12
|
+
const strings = data.strings;
|
|
13
|
+
const nodes = data.nodes;
|
|
14
|
+
const nodeFields = data.snapshot.meta.node_fields;
|
|
15
|
+
const nodeFieldCount = nodeFields.length;
|
|
16
|
+
|
|
17
|
+
const typeOffset = nodeFields.indexOf('type');
|
|
18
|
+
const nameOffset = nodeFields.indexOf('name');
|
|
19
|
+
const sizeOffset = nodeFields.indexOf('self_size');
|
|
20
|
+
|
|
21
|
+
const nodeTypes = data.snapshot.meta.node_types[typeOffset];
|
|
22
|
+
|
|
23
|
+
const counts = {};
|
|
24
|
+
const sizes = {};
|
|
25
|
+
|
|
26
|
+
for (let i = 0; i < nodes.length; i += nodeFieldCount) {
|
|
27
|
+
const typeIdx = nodes[i + typeOffset];
|
|
28
|
+
const typeName = nodeTypes[typeIdx];
|
|
29
|
+
const nameIdx = nodes[i + nameOffset];
|
|
30
|
+
const name = typeof nameIdx === 'number' ? strings[nameIdx] : nameIdx;
|
|
31
|
+
const size = nodes[i + sizeOffset];
|
|
32
|
+
|
|
33
|
+
// Ignore native primitives/arrays that clutter the output unless specifically looking for them
|
|
34
|
+
if (
|
|
35
|
+
typeName === 'string' ||
|
|
36
|
+
typeName === 'number' ||
|
|
37
|
+
typeName === 'array'
|
|
38
|
+
) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const key = `${typeName}::${name}`;
|
|
43
|
+
counts[key] = (counts[key] || 0) + 1;
|
|
44
|
+
sizes[key] = (sizes[key] || 0) + size;
|
|
45
|
+
}
|
|
46
|
+
return {counts, sizes};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const [, , file1, file2] = process.argv;
|
|
50
|
+
if (!file1 || !file2) {
|
|
51
|
+
console.error(
|
|
52
|
+
'Usage: node compare_snapshots.js <baseline.heapsnapshot> <target.heapsnapshot>',
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const snap1 = parseSnapshot(file1);
|
|
59
|
+
const snap2 = parseSnapshot(file2);
|
|
60
|
+
|
|
61
|
+
const diffs = [];
|
|
62
|
+
for (const key in snap2.counts) {
|
|
63
|
+
const count1 = snap1.counts[key] || 0;
|
|
64
|
+
const count2 = snap2.counts[key];
|
|
65
|
+
const size1 = snap1.sizes[key] || 0;
|
|
66
|
+
const size2 = snap2.sizes[key];
|
|
67
|
+
|
|
68
|
+
if (count2 > count1) {
|
|
69
|
+
diffs.push({
|
|
70
|
+
key,
|
|
71
|
+
countDiff: count2 - count1,
|
|
72
|
+
sizeDiff: size2 - size1,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
diffs.sort((a, b) => b.sizeDiff - a.sizeDiff);
|
|
78
|
+
|
|
79
|
+
console.log('\n--- Top 10 growing objects by size ---');
|
|
80
|
+
diffs.slice(0, 10).forEach(d => {
|
|
81
|
+
console.log(`${d.key}: +${d.countDiff} objects, +${d.sizeDiff} bytes`);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Look for common leak indicators
|
|
85
|
+
const commonLeaks = diffs.filter(
|
|
86
|
+
d =>
|
|
87
|
+
d.key.toLowerCase().includes('detached') ||
|
|
88
|
+
d.key.toLowerCase().includes('html') ||
|
|
89
|
+
d.key.toLowerCase().includes('eventlistener') ||
|
|
90
|
+
d.key.toLowerCase().includes('context') ||
|
|
91
|
+
d.key.toLowerCase().includes('closure'),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
commonLeaks.sort((a, b) => b.countDiff - a.countDiff);
|
|
95
|
+
|
|
96
|
+
console.log('\n--- Top 3 most common types of memory leaks found ---');
|
|
97
|
+
if (commonLeaks.length === 0) {
|
|
98
|
+
console.log('No common DOM or Closure leaks detected.');
|
|
99
|
+
} else {
|
|
100
|
+
commonLeaks.slice(0, 3).forEach(d => {
|
|
101
|
+
console.log(`${d.key}: +${d.countDiff} objects, +${d.sizeDiff} bytes`);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(
|
|
106
|
+
'Error parsing snapshots. They might be too large for JSON.parse or invalid.',
|
|
107
|
+
);
|
|
108
|
+
console.error(error.message);
|
|
109
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Using Memlab
|
|
2
|
+
|
|
3
|
+
[Memlab](https://facebook.github.io/memlab/) is an E2E testing and analysis framework for finding JavaScript memory leaks.
|
|
4
|
+
|
|
5
|
+
## Important Rule
|
|
6
|
+
|
|
7
|
+
**NEVER read raw `.heapsnapshot` files directly.** They are too large and will exceed context limits. Always use `memlab` commands to analyze them.
|
|
8
|
+
|
|
9
|
+
## Analyzing Snapshots
|
|
10
|
+
|
|
11
|
+
You can use the `take_heapsnapshot` tool provided by the `chrome-devtools-mcp` extension to generate heap snapshots during an investigation. To find leaks, you generally need 3 snapshots:
|
|
12
|
+
|
|
13
|
+
1. **Baseline:** Before the suspect action.
|
|
14
|
+
2. **Target:** After the suspect action.
|
|
15
|
+
3. **Final:** After reverting the suspect action (e.g., closing a modal, navigating away).
|
|
16
|
+
|
|
17
|
+
Once you have these 3 snapshots saved to disk, you can use `memlab` to find leaks:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx memlab find-leaks --baseline <path-to-baseline> --target <path-to-target> --final <path-to-final>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can also parse a single snapshot to find the largest objects or explore it individually:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx memlab analyze snapshot --snapshot <path-to-snapshot>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Memlab will output the retainer traces for identified leaks. Use these traces to guide your search in the codebase.
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
#### Symptom: Missing Tools / Only 9 tools available
|
|
45
|
+
|
|
46
|
+
If the server starts successfully but only a limited subset of tools (like `list_pages`, `get_console_message`, `lighthouse_audit`, `take_heapsnapshot`) are available, this is likely because the MCP client is enforcing a **read-only mode**.
|
|
47
|
+
|
|
48
|
+
All tools in `chrome-devtools-mcp` are annotated with `readOnlyHint: true` (for safe, non-modifying tools) or `readOnlyHint: false` (for tools that modify browser state, like `emulate`, `click`, `navigate_page`). To access the full suite of tools, the user must disable read-only mode in their MCP client (e.g., by exiting "Plan Mode" in Gemini CLI or adjusting their client's tool safety settings).
|
|
49
|
+
|
|
50
|
+
#### Symptom: Extension tools are missing or extensions fail to load
|
|
51
|
+
|
|
52
|
+
If the tools related to extensions (like `install_extension`) are not available, or if the extensions you load are not functioning:
|
|
53
|
+
|
|
54
|
+
1. **Check for the `--categoryExtensions` flag**: Ensure this flag is passed in the MCP server configuration to enable the extension category tools.
|
|
55
|
+
2. **Make sure the MCP server in configured to launch Chrome instead of connecting to an instance**: Chrome before 149 is not able to load extensions when connecting to an existing instance (`--auto-connect`, `--browserUrl`).
|
|
56
|
+
|
|
57
|
+
#### Other Common Errors
|
|
58
|
+
|
|
59
|
+
Identify other error messages from the failed tool call or the MCP initialization logs:
|
|
60
|
+
|
|
61
|
+
- `Target closed`
|
|
62
|
+
- "Tool not found" (check if they are using `--slim` which only enables navigation and screenshot tools).
|
|
63
|
+
- `ProtocolError: Network.enable timed out` or `The socket connection was closed unexpectedly`
|
|
64
|
+
- `Error [ERR_MODULE_NOT_FOUND]: Cannot find module`
|
|
65
|
+
- Any sandboxing or host validation errors.
|
|
66
|
+
|
|
67
|
+
### Step 3: Read Known Issues
|
|
68
|
+
|
|
69
|
+
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:
|
|
70
|
+
|
|
71
|
+
- Sandboxing restrictions (macOS Seatbelt, Linux containers).
|
|
72
|
+
- WSL requirements.
|
|
73
|
+
- `--autoConnect` handshakes, timeouts, and requirements (requires **running** Chrome 144+).
|
|
74
|
+
|
|
75
|
+
### Step 4: Formulate a Configuration
|
|
76
|
+
|
|
77
|
+
Based on the exact error and the user's environment (OS, MCP client), formulate the correct MCP configuration snippet. Check if they need to:
|
|
78
|
+
|
|
79
|
+
- Pass `--browser-url=http://127.0.0.1:9222` instead of `--autoConnect` (e.g. if they are in a sandboxed environment like Claude Desktop).
|
|
80
|
+
- 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`.**
|
|
81
|
+
- Add `--logFile <absolute_path_to_log_file>` to capture debug logs for analysis.
|
|
82
|
+
- Increase `startup_timeout_ms` (e.g. to 20000) if using Codex on Windows.
|
|
83
|
+
|
|
84
|
+
_If you are unsure of the user's configuration, ask the user to provide their current MCP server JSON configuration._
|
|
85
|
+
|
|
86
|
+
### Step 5: Run Diagnostic Commands
|
|
87
|
+
|
|
88
|
+
If the issue is still unclear, run diagnostic commands to test the server directly:
|
|
89
|
+
|
|
90
|
+
- Run `npx chrome-devtools-mcp@latest --help` to verify the installation and Node.js environment.
|
|
91
|
+
- 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.
|
|
92
|
+
|
|
93
|
+
### Step 6: Check GitHub for Existing Issues
|
|
94
|
+
|
|
95
|
+
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:
|
|
96
|
+
`gh issue list --repo ChromeDevTools/chrome-devtools-mcp --search "<error snippet>" --state all`
|
|
97
|
+
|
|
98
|
+
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.
|