chrome-devtools-mcp 1.5.0 → 1.7.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.
Files changed (295) hide show
  1. package/README.md +41 -9
  2. package/build/src/HeapSnapshotManager.js +77 -28
  3. package/build/src/McpContext.js +233 -383
  4. package/build/src/McpPage.js +466 -41
  5. package/build/src/McpResponse.js +285 -331
  6. package/build/src/PageCollector.js +53 -122
  7. package/build/src/SlimMcpResponse.js +1 -1
  8. package/build/src/TextSnapshot.js +100 -21
  9. package/build/src/ToolHandler.js +31 -10
  10. package/build/src/WaitForHelper.js +140 -56
  11. package/build/src/bin/chrome-devtools-cli-options.js +63 -3
  12. package/build/src/bin/chrome-devtools-mcp-cli-options.js +16 -7
  13. package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
  14. package/build/src/bin/chrome-devtools.js +19 -3
  15. package/build/src/browser.js +1 -1
  16. package/build/src/daemon/client.js +55 -3
  17. package/build/src/daemon/daemon.js +17 -12
  18. package/build/src/daemon/utils.js +19 -4
  19. package/build/src/devtools/DevtoolsUtils.js +9 -65
  20. package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +2 -2
  21. package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
  22. package/build/src/formatters/IssueFormatter.js +2 -2
  23. package/build/src/index.js +13 -3
  24. package/build/src/telemetry/ClearcutLogger.js +4 -1
  25. package/build/src/telemetry/WatchdogClient.js +1 -1
  26. package/build/src/telemetry/metricsRegistry.js +2 -9
  27. package/build/src/telemetry/persistence.js +1 -1
  28. package/build/src/telemetry/transformation.js +50 -0
  29. package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
  30. package/build/src/telemetry/watchdog/main.js +1 -1
  31. package/build/src/third_party/THIRD_PARTY_NOTICES +230 -287
  32. package/build/src/third_party/bundled-packages.json +4 -6
  33. package/build/src/third_party/devtools-formatter-worker.js +60 -19
  34. package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
  35. package/build/src/third_party/index.js +30171 -11328
  36. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
  37. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
  38. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
  39. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
  40. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
  41. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
  42. package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
  43. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
  44. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
  45. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
  46. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
  47. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
  48. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
  49. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
  50. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
  51. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
  52. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
  53. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
  54. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
  55. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
  56. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
  57. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
  58. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
  59. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
  60. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
  61. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
  62. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
  63. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
  64. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
  65. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
  66. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
  67. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
  68. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
  69. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
  70. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
  71. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
  72. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
  73. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
  74. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
  75. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
  76. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
  77. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
  78. package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
  79. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
  80. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
  81. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
  82. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
  83. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
  84. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
  85. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
  86. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
  87. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
  88. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
  89. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
  90. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
  91. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
  92. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
  93. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
  94. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
  95. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
  96. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
  97. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
  98. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
  99. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
  100. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
  101. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
  102. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
  103. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
  104. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
  105. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
  106. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
  107. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
  108. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
  109. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
  110. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
  127. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
  128. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
  129. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
  130. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
  131. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
  132. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
  133. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
  134. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
  135. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
  136. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
  143. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  144. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  145. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  146. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
  147. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
  148. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
  149. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
  150. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
  151. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
  152. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
  153. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
  154. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
  155. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
  156. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
  157. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
  158. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
  159. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
  160. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
  161. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
  162. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
  163. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
  164. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
  165. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
  166. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
  167. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
  168. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
  169. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
  170. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
  171. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
  172. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
  173. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
  174. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
  175. package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
  176. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  177. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
  178. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
  179. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
  180. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
  181. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
  182. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
  183. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
  184. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
  185. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
  186. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
  187. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
  188. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
  189. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
  190. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
  191. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
  192. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
  193. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
  194. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
  195. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
  196. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
  197. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
  198. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
  199. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
  200. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
  201. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
  202. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
  203. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
  204. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
  205. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
  206. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
  207. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
  208. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
  209. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
  210. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
  211. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
  212. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
  213. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
  214. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
  215. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
  216. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
  217. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
  218. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
  219. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
  220. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
  221. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
  222. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
  223. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
  224. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
  225. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
  226. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
  227. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
  228. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
  229. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
  230. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
  231. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
  232. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
  233. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
  234. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
  235. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
  236. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
  237. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
  238. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
  239. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
  240. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
  241. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3177 -6340
  242. package/build/src/tools/emulation.js +2 -2
  243. package/build/src/tools/extensions.js +1 -1
  244. package/build/src/tools/input.js +213 -112
  245. package/build/src/tools/lighthouse.js +1 -1
  246. package/build/src/tools/memory.js +49 -4
  247. package/build/src/tools/network.js +5 -5
  248. package/build/src/tools/pages.js +22 -89
  249. package/build/src/tools/performance.js +62 -41
  250. package/build/src/tools/screenshot.js +152 -77
  251. package/build/src/tools/script.js +95 -28
  252. package/build/src/tools/snapshot.js +2 -2
  253. package/build/src/tools/thirdPartyDeveloper.js +1 -1
  254. package/build/src/tools/webmcp.js +1 -1
  255. package/build/src/trace-processing/parse.js +1 -1
  256. package/build/src/{logger.js → utils/logger.js} +1 -1
  257. package/build/src/utils/polyfill.js +11 -0
  258. package/build/src/utils/url.js +43 -0
  259. package/build/src/version.js +1 -1
  260. package/package.json +23 -15
  261. package/skills/memory-leak-debugging/SKILL.md +23 -19
  262. package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
  263. package/build/src/Mutex.js +0 -38
  264. package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
  265. package/build/src/polyfill.js +0 -8
  266. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  267. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  268. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  269. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  270. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  271. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  272. package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
  273. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
  274. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  275. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  276. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
  277. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  278. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  279. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  280. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
  281. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  282. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
  283. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
  284. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
  285. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
  286. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
  287. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
  288. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
  289. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
  290. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
  291. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
  292. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
  293. package/build/src/utils/types.js +0 -7
  294. package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
  295. package/skills/memory-leak-debugging/references/memlab.md +0 -29
@@ -3,6 +3,58 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
7
+ if (value !== null && value !== void 0) {
8
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
9
+ var dispose, inner;
10
+ if (async) {
11
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
12
+ dispose = value[Symbol.asyncDispose];
13
+ }
14
+ if (dispose === void 0) {
15
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
16
+ dispose = value[Symbol.dispose];
17
+ if (async) inner = dispose;
18
+ }
19
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
21
+ env.stack.push({ value: value, dispose: dispose, async: async });
22
+ }
23
+ else if (async) {
24
+ env.stack.push({ async: true });
25
+ }
26
+ return value;
27
+ };
28
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
29
+ return function (env) {
30
+ function fail(e) {
31
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
32
+ env.hasError = true;
33
+ }
34
+ var r, s = 0;
35
+ function next() {
36
+ while (r = env.stack.pop()) {
37
+ try {
38
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
39
+ if (r.dispose) {
40
+ var result = r.dispose.call(r.value);
41
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
42
+ }
43
+ else s |= 1;
44
+ }
45
+ catch (e) {
46
+ fail(e);
47
+ }
48
+ }
49
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
50
+ if (env.hasError) throw env.error;
51
+ }
52
+ return next();
53
+ };
54
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
55
+ var e = new Error(message);
56
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
57
+ });
6
58
  import { zod } from '../third_party/index.js';
7
59
  import { ToolCategory } from './categories.js';
8
60
  import { defineTool, pageIdSchema } from './ToolDefinition.js';
@@ -46,36 +98,42 @@ Example with arguments: \`(el) => el.innerText\`
46
98
  blockedByDialog: true,
47
99
  verifyFilesSchema: ['filePath'],
48
100
  handler: async (request, response, context) => {
49
- const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, } = request.params;
50
- if (cliArgs?.categoryExtensions && serviceWorkerId) {
51
- if (uidArgs && uidArgs.length > 0) {
52
- throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
53
- }
54
- if (pageId) {
55
- throw new Error('specify either a pageId or a serviceWorkerId.');
56
- }
57
- const worker = await getWebWorker(context, serviceWorkerId);
58
- const result = await context
59
- .getSelectedMcpPage()
60
- .waitForEventsAfterAction(async () => {
61
- await performEvaluation(worker, fnString, [], response, {
62
- filePath,
63
- context,
64
- });
65
- }, { handleDialog: dialogAction ?? 'accept' });
66
- response.attachWaitForResult(result);
67
- return;
68
- }
69
- const mcpPage = cliArgs?.experimentalPageIdRouting
70
- ? context.getPageById(request.params.pageId)
71
- : context.getSelectedMcpPage();
72
- const page = mcpPage.pptrPage;
73
- const args = [];
101
+ const env_1 = { stack: [], error: void 0, hasError: false };
74
102
  try {
103
+ const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, } = request.params;
104
+ if (cliArgs?.categoryExtensions && serviceWorkerId) {
105
+ if (uidArgs && uidArgs.length > 0) {
106
+ throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
107
+ }
108
+ if (pageId) {
109
+ throw new Error('specify either a pageId or a serviceWorkerId.');
110
+ }
111
+ const worker = await getWebWorker(context, serviceWorkerId);
112
+ const result = await context
113
+ .getSelectedMcpPage()
114
+ .waitForEventsAfterAction(async () => {
115
+ await performEvaluation(worker, fnString, [], response, {
116
+ filePath,
117
+ context,
118
+ });
119
+ }, { handleDialog: dialogAction ?? 'accept' });
120
+ if (result.dialogHandled) {
121
+ context.getSelectedMcpPage().clearDialog();
122
+ }
123
+ response.attachWaitForResult(result);
124
+ return;
125
+ }
126
+ const mcpPage = cliArgs?.experimentalPageIdRouting
127
+ ? context.getPageById(request.params.pageId)
128
+ : context.getSelectedMcpPage();
129
+ const page = mcpPage.pptrPage;
130
+ const args = [];
131
+ const stack = __addDisposableResource(env_1, new DisposableStack(), false);
75
132
  const frames = new Set();
76
133
  for (const uid of uidArgs ?? []) {
77
134
  const handle = await mcpPage.getElementByUid(uid);
78
135
  frames.add(handle.frame);
136
+ stack.use(handle);
79
137
  args.push(handle);
80
138
  }
81
139
  const evaluatable = await getPageOrFrame(page, frames);
@@ -87,15 +145,20 @@ Example with arguments: \`(el) => el.innerText\`
87
145
  }, { handleDialog: dialogAction ?? 'accept' });
88
146
  response.attachWaitForResult(result);
89
147
  }
148
+ catch (e_1) {
149
+ env_1.error = e_1;
150
+ env_1.hasError = true;
151
+ }
90
152
  finally {
91
- void Promise.allSettled(args.map(arg => arg.dispose()));
153
+ __disposeResources(env_1);
92
154
  }
93
155
  },
94
156
  };
95
157
  });
96
158
  const performEvaluation = async (evaluatable, fnString, args, response, options) => {
97
- const fn = await evaluatable.evaluateHandle(`(${fnString})`);
159
+ const env_2 = { stack: [], error: void 0, hasError: false };
98
160
  try {
161
+ const fn = __addDisposableResource(env_2, await evaluatable.evaluateHandle(`(${fnString})`), false);
99
162
  const result = await evaluatable.evaluate(async (fn, ...args) => {
100
163
  // @ts-expect-error no types for function fn
101
164
  return JSON.stringify(await fn(...args));
@@ -112,8 +175,12 @@ const performEvaluation = async (evaluatable, fnString, args, response, options)
112
175
  response.appendResponseLine('```');
113
176
  }
114
177
  }
178
+ catch (e_2) {
179
+ env_2.error = e_2;
180
+ env_2.hasError = true;
181
+ }
115
182
  finally {
116
- void fn.dispose();
183
+ __disposeResources(env_2);
117
184
  }
118
185
  };
119
186
  const getPageOrFrame = async (page, frames) => {
@@ -51,9 +51,9 @@ export const waitFor = definePageTool({
51
51
  },
52
52
  blockedByDialog: true,
53
53
  verifyFilesSchema: [],
54
- handler: async (request, response, context) => {
54
+ handler: async (request, response) => {
55
55
  const page = request.page;
56
- await context.waitForTextOnPage(request.params.text, request.params.timeout, page.pptrPage);
56
+ await page.waitForTextOnPage(request.params.text, request.params.timeout);
57
57
  response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
58
58
  response.includeSnapshot();
59
59
  },
@@ -22,7 +22,7 @@ third-party developer tools with additional functionality.`,
22
22
  schema: {},
23
23
  blockedByDialog: false,
24
24
  verifyFilesSchema: [],
25
- handler: async (_request, response, _context) => {
25
+ handler: async (_request, response) => {
26
26
  response.setListThirdPartyDeveloperTools();
27
27
  },
28
28
  });
@@ -16,7 +16,7 @@ export const listWebMcpTools = definePageTool({
16
16
  schema: {},
17
17
  blockedByDialog: false,
18
18
  verifyFilesSchema: [],
19
- handler: async (_request, response, _context) => {
19
+ handler: async (_request, response) => {
20
20
  response.setListWebMcpTools();
21
21
  },
22
22
  });
@@ -3,8 +3,8 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { logger } from '../logger.js';
7
6
  import { DevTools } from '../third_party/index.js';
7
+ import { logger } from '../utils/logger.js';
8
8
  const engine = DevTools.TraceEngine.TraceModel.Model.createWithAllHandlers();
9
9
  export function traceResultIsSuccess(x) {
10
10
  return 'parsedTrace' in x;
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import fs from 'node:fs';
7
- import { debug } from './third_party/index.js';
7
+ import { debug } from '../third_party/index.js';
8
8
  const mcpDebugNamespace = 'mcp:log';
9
9
  const namespacesToEnable = [
10
10
  mcpDebugNamespace,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DisposableStack, AsyncDisposableStack, SuppressedError, } from '../third_party/index.js';
7
+ globalThis.DisposableStack ??= DisposableStack;
8
+ globalThis.AsyncDisposableStack ??= AsyncDisposableStack;
9
+ // @ts-expect-error Type mismatch between puppeteer-core and node for SuppressedError.
10
+ globalThis.SuppressedError ??= SuppressedError;
11
+ //# sourceMappingURL=polyfill.js.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'ws:', 'wss:']);
7
+ const IPV4_LOOPBACK_REGEX = /^127(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$/;
8
+ /**
9
+ * Determines whether a given URL string points to a localhost / loopback address.
10
+ *
11
+ * @param url The URL string to test.
12
+ * @returns true if the URL is a valid network URL pointing to localhost or a loopback IP.
13
+ */
14
+ export function isLocalhost(url) {
15
+ if (!url || typeof url !== 'string' || url.trim() === '') {
16
+ return false;
17
+ }
18
+ let parsed;
19
+ try {
20
+ parsed = new URL(url);
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
26
+ return false;
27
+ }
28
+ const hostname = parsed.hostname.toLowerCase().replace(/\.$/, '');
29
+ // 1. Check localhost and RFC 6761 *.localhost subdomains
30
+ if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
31
+ return true;
32
+ }
33
+ // 2. Check IPv6 loopback ([::1] as returned by URL.hostname, or ::1)
34
+ if (hostname === '[::1]' || hostname === '::1') {
35
+ return true;
36
+ }
37
+ // 3. Check IPv4 loopback (127.0.0.0/8)
38
+ if (IPV4_LOOPBACK_REGEX.test(hostname)) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ //# sourceMappingURL=url.js.map
@@ -5,6 +5,6 @@
5
5
  */
6
6
  // If moved update release-please config
7
7
  // x-release-please-start-version
8
- export const VERSION = '1.5.0';
8
+ export const VERSION = '1.7.0';
9
9
  // x-release-please-end
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "MCP server for Chrome DevTools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "cli:generate": "node scripts/generate-cli.ts",
13
13
  "clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
14
- "bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
14
+ "bundle": "npm run clean && npm run build && rollup -c rollup.config.js && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
15
15
  "build": "tsc && node scripts/post-build.ts",
16
16
  "typecheck": "tsc --noEmit",
17
17
  "format": "eslint --cache --fix . && prettier --write --cache .",
@@ -20,15 +20,17 @@
20
20
  "docs:generate": "node scripts/generate-docs.ts",
21
21
  "start": "npm run build && node build/src/bin/chrome-devtools-mcp.js",
22
22
  "start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/bin/chrome-devtools-mcp.js",
23
- "test": "npm run build && node scripts/test.mjs",
24
- "test:no-build": "node scripts/test.mjs",
25
- "test:only": "npm run build && node scripts/test.mjs --test-only",
26
- "test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
23
+ "test": "npm run build && node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
24
+ "test:no-build": "node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
25
+ "test:notices": "npm run bundle && node scripts/test.js tests/third_party_notices.test.ts",
26
+ "test:notices:no-build": "node scripts/test.js tests/third_party_notices.test.ts",
27
+ "test:only": "npm run build && node scripts/test.js --test-only",
28
+ "test:update-snapshots": "npm run build && node scripts/test.js --test-update-snapshots",
27
29
  "prepare": "node scripts/prepare.ts",
28
30
  "verify-server-json-version": "node scripts/verify-server-json-version.ts",
29
31
  "update-lighthouse": "node scripts/update-lighthouse.ts",
30
32
  "update-metrics": "node scripts/update_metrics.ts",
31
- "verify-npm-package": "node scripts/verify-npm-package.mjs",
33
+ "verify-npm-package": "node scripts/verify-npm-package.js",
32
34
  "eval": "npm run build && node scripts/eval_gemini.ts",
33
35
  "count-tokens": "node scripts/count_tokens.ts"
34
36
  },
@@ -48,9 +50,10 @@
48
50
  "homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
49
51
  "mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
50
52
  "devDependencies": {
51
- "@eslint/js": "^9.35.0",
53
+ "@blackwell-systems/gcf": "^2.2.2",
54
+ "@eslint/js": "^10.0.1",
52
55
  "@google/genai": "^2.0.1",
53
- "@modelcontextprotocol/sdk": "1.29.0",
56
+ "@modelcontextprotocol/sdk": "1.30.0",
54
57
  "@rollup/plugin-commonjs": "^29.0.0",
55
58
  "@rollup/plugin-json": "^6.1.0",
56
59
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -60,20 +63,19 @@
60
63
  "@types/filesystem": "^0.0.36",
61
64
  "@types/node": "^26.0.0",
62
65
  "@types/semver": "^7.7.1",
63
- "@types/sinon": "^21.0.0",
66
+ "@types/sinon": "^22.0.0",
64
67
  "@types/yargs": "^17.0.33",
65
68
  "@typescript-eslint/eslint-plugin": "^8.43.0",
66
69
  "@typescript-eslint/parser": "^8.43.0",
67
- "chrome-devtools-frontend": "1.0.1652307",
68
70
  "core-js": "3.49.0",
69
71
  "debug": "4.4.3",
70
- "eslint": "^9.35.0",
72
+ "eslint": "^10.7.0",
71
73
  "eslint-import-resolver-typescript": "^4.4.4",
72
74
  "eslint-plugin-import": "^2.32.0",
73
75
  "globals": "^17.0.0",
74
76
  "lighthouse": "13.4.0",
75
77
  "prettier": "^3.6.2",
76
- "puppeteer": "25.2.1",
78
+ "puppeteer": "25.5.0",
77
79
  "rollup": "4.62.2",
78
80
  "rollup-plugin-cleanup": "^3.2.1",
79
81
  "rollup-plugin-license": "^3.6.0",
@@ -81,21 +83,27 @@
81
83
  "sinon": "^22.0.0",
82
84
  "typescript": "^6.0.2",
83
85
  "typescript-eslint": "^8.43.0",
84
- "urlpattern-polyfill": "^10.1.0",
85
- "yargs": "18.0.0"
86
+ "yargs": "18.1.0"
86
87
  },
87
88
  "peerDependencies": {
89
+ "@blackwell-systems/gcf": "^2.2.2",
88
90
  "@toon-format/toon": "^2.2.0"
89
91
  },
90
92
  "peerDependenciesMeta": {
91
93
  "@toon-format/toon": {
92
94
  "optional": true
95
+ },
96
+ "@blackwell-systems/gcf": {
97
+ "optional": true
93
98
  }
94
99
  },
95
100
  "engines": {
96
101
  "node": "^20.19.0 || ^22.12.0 || >=23"
97
102
  },
98
103
  "overrides": {
104
+ "eslint-plugin-import": {
105
+ "eslint": "$eslint"
106
+ },
99
107
  "puppeteer-core": "$puppeteer"
100
108
  }
101
109
  }
@@ -1,17 +1,18 @@
1
1
  ---
2
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.
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 capture, compare, or inspect heap snapshots with Chrome DevTools MCP memory tools.
4
4
  ---
5
5
 
6
6
  # Memory Leak Debugging
7
7
 
8
- This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications.
8
+ This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP tools.
9
9
 
10
10
  ## Core Principles
11
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.
12
+ - **Prefer MCP memory tools:** Do NOT attempt to read raw `.heapsnapshot` files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
13
13
  - **Isolate the Leak:** Determine if the leak is in the browser (client-side) or Node.js (server-side).
14
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
+ - **Close Loaded Snapshots:** Heap snapshots can be large. After completing an investigation, use `close_heapsnapshot` for each loaded snapshot to release memory held by the MCP server.
15
16
 
16
17
  ## Workflows
17
18
 
@@ -24,27 +25,30 @@ When investigating a frontend web application memory leak, utilize the `chrome-d
24
25
  - Repeat the same user interactions 10 times to amplify the leak.
25
26
  - Use `take_heapsnapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
26
27
 
27
- ### 2. Using Memlab to Find Leaks (Recommended)
28
+ ### 2. Comparing Snapshots
28
29
 
29
- Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, use `memlab` to automatically find memory leaks.
30
+ Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, compare them with Chrome DevTools MCP memory tools.
30
31
 
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`.
32
+ - Start with `get_heapsnapshot_summary` for each snapshot to confirm that the files load and to compare high-level totals.
33
+ - Use `compare_heapsnapshots` to compare baseline and target snapshots. Start without `classIndex` for the summary diff, then request detailed class diffs only for suspicious growth by specifying `classIndex`.
34
+ - Use the summary output from `compare_heapsnapshots` before drilling into specific node IDs.
33
35
 
34
- ### 3. Identifying Common Leaks
36
+ ### 3. Inspecting Retainers and Dominator Chains
35
37
 
36
- When you have found a leak trace (e.g., via `memlab` output), you must identify the root cause in the code.
38
+ When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.
37
39
 
38
- - Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them.
40
+ - Use `get_heapsnapshot_class_nodes` to list instances of the suspicious class.
41
+ - Use `get_heapsnapshot_retainers`, `get_heapsnapshot_retaining_paths`, `get_heapsnapshot_dominators`, and `get_heapsnapshot_edges` to understand why representative nodes are still reachable.
42
+ - Use `get_heapsnapshot_object_details` with a specific `nodeId` to retrieve detailed object metadata (size, type, distance, and DOM detachedness).
43
+ - Use `get_heapsnapshot_duplicate_strings` when string growth dominates the diff.
44
+ - Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them after the retaining path points at application code.
39
45
 
40
- ### 4. Fallback: Comparing Snapshots Manually
46
+ ### 4. Advanced Analysis and Categorized Filters
41
47
 
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.
48
+ Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.
43
49
 
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.
50
+ - Use `get_heapsnapshot_details` or `get_heapsnapshot_class_nodes` with `filterName` to target common leak causes:
51
+ - `objectsRetainedByDetachedDomNodes`: Identifies detached DOM elements retained in memory.
52
+ - `objectsRetainedByEventHandlers`: Identifies objects kept alive by unremoved event listeners.
53
+ - `objectsRetainedByContexts`: Identifies objects trapped in closures or execution contexts.
54
+ - `objectsRetainedByConsole`: Identifies objects retained by console logging.
@@ -1,6 +1,6 @@
1
1
  # Common Memory Leaks
2
2
 
3
- When analyzing a retainer trace from `memlab`, look for these common patterns in the codebase:
3
+ When analyzing retaining paths, dominator chains, or class diffs with Chrome DevTools MCP memory tools, look for these common patterns in the codebase:
4
4
 
5
5
  ## 1. Uncleared Event Listeners
6
6
 
@@ -1,38 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google Inc.
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export class Mutex {
7
- static Guard = class Guard {
8
- #mutex;
9
- constructor(mutex) {
10
- this.#mutex = mutex;
11
- }
12
- dispose() {
13
- return this.#mutex.release();
14
- }
15
- };
16
- #locked = false;
17
- #acquirers = [];
18
- // This is FIFO.
19
- async acquire() {
20
- if (!this.#locked) {
21
- this.#locked = true;
22
- return new Mutex.Guard(this);
23
- }
24
- const { resolve, promise } = Promise.withResolvers();
25
- this.#acquirers.push(resolve);
26
- await promise;
27
- return new Mutex.Guard(this);
28
- }
29
- release() {
30
- const resolve = this.#acquirers.shift();
31
- if (!resolve) {
32
- this.#locked = false;
33
- return;
34
- }
35
- resolve();
36
- }
37
- }
38
- //# sourceMappingURL=Mutex.js.map
@@ -1,70 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { CDPSessionEvent } from '../third_party/index.js';
7
- /**
8
- * This class makes a puppeteer connection look like DevTools CDPConnection.
9
- *
10
- * Since we connect "root" DevTools targets to specific pages, we scope everything to a puppeteer CDP session.
11
- *
12
- * We don't have to recursively listen for 'sessionattached' as the "root" CDP session sees all child session attached
13
- * events, regardless how deeply nested they are.
14
- */
15
- export class PuppeteerDevToolsConnection {
16
- #connection;
17
- #observers = new Set();
18
- #sessionEventHandlers = new Map();
19
- constructor(session) {
20
- this.#connection = session.connection();
21
- session.on(CDPSessionEvent.SessionAttached, this.#startForwardingCdpEvents.bind(this));
22
- session.on(CDPSessionEvent.SessionDetached, this.#stopForwardingCdpEvents.bind(this));
23
- this.#startForwardingCdpEvents(session);
24
- }
25
- send(method, params, sessionId) {
26
- if (sessionId === undefined) {
27
- throw new Error('Attempting to send on the root session. This must not happen');
28
- }
29
- const session = this.#connection.session(sessionId);
30
- if (!session) {
31
- throw new Error('Unknown session ' + sessionId);
32
- }
33
- // Rolled protocol version between puppeteer and DevTools doesn't necessarily match
34
- /* eslint-disable @typescript-eslint/no-explicit-any */
35
- return session
36
- .send(method, params)
37
- .then(result => ({ result }))
38
- .catch(error => ({ error }));
39
- /* eslint-enable @typescript-eslint/no-explicit-any */
40
- }
41
- observe(observer) {
42
- this.#observers.add(observer);
43
- }
44
- unobserve(observer) {
45
- this.#observers.delete(observer);
46
- }
47
- #startForwardingCdpEvents(session) {
48
- const handler = this.#handleEvent.bind(this, session.id());
49
- this.#sessionEventHandlers.set(session.id(), handler);
50
- session.on('*', handler);
51
- }
52
- #stopForwardingCdpEvents(session) {
53
- const handler = this.#sessionEventHandlers.get(session.id());
54
- if (handler) {
55
- session.off('*', handler);
56
- }
57
- }
58
- #handleEvent(sessionId, type, event) {
59
- if (typeof type === 'string' &&
60
- type !== CDPSessionEvent.SessionAttached &&
61
- type !== CDPSessionEvent.SessionDetached) {
62
- this.#observers.forEach(observer => observer.onEvent({
63
- method: type,
64
- sessionId,
65
- params: event,
66
- }));
67
- }
68
- }
69
- }
70
- //# sourceMappingURL=DevToolsConnectionAdapter.js.map
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google Inc.
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- // polyfills are now bundled with all other dependencies
7
- import './third_party/index.js';
8
- //# sourceMappingURL=polyfill.js.map
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to have cookies sent to same-site subresources
2
-
3
- A cookie was not sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context.
4
- Because this cookie would have been sent across schemes on the same site, it was not sent.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to allow cookies to be set by same-site subresources
2
-
3
- A cookie was not set by {PLACEHOLDER_origin} origin in {PLACEHOLDER_destination} context.
4
- Because this cookie would have been set across schemes on the same site, it was blocked.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to have cookies sent on same-site requests
2
-
3
- A cookie was not sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context on a navigation.
4
- Because this cookie would have been sent across schemes on the same site, it was not sent.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to continue having cookies sent to same-site subresources
2
-
3
- A cookie is being sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context.
4
- Because this cookie is being sent across schemes on the same site, it will not be sent in a future version of Chrome.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to continue allowing cookies to be set by same-site subresources
2
-
3
- A cookie is being set by {PLACEHOLDER_origin} origin in {PLACEHOLDER_destination} context.
4
- Because this cookie is being set across schemes on the same site, it will be blocked in a future version of Chrome.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
@@ -1,8 +0,0 @@
1
- # Migrate entirely to HTTPS to continue having cookies sent on same-site requests
2
-
3
- A cookie is being sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context on a navigation.
4
- Because this cookie is being sent across schemes on the same site, it will not be sent in a future version of Chrome.
5
- This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
6
-
7
- Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
8
- It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.