chrome-devtools-mcp 1.6.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.
- package/README.md +26 -9
- package/build/src/HeapSnapshotManager.js +62 -23
- package/build/src/McpContext.js +64 -23
- package/build/src/McpPage.js +225 -11
- package/build/src/McpResponse.js +188 -280
- package/build/src/PageCollector.js +8 -3
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +19 -8
- package/build/src/WaitForHelper.js +142 -68
- package/build/src/bin/chrome-devtools-cli-options.js +38 -2
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +1 -1
- package/build/src/bin/chrome-devtools-mcp-main.js +1 -1
- package/build/src/bin/chrome-devtools.js +19 -3
- package/build/src/daemon/client.js +22 -0
- package/build/src/daemon/daemon.js +15 -11
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +7 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
- package/build/src/index.js +2 -1
- package/build/src/telemetry/ClearcutLogger.js +3 -0
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +231 -52
- package/build/src/third_party/bundled-packages.json +3 -4
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
- package/build/src/third_party/index.js +28280 -9450
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
- package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
- package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
- package/build/src/tools/input.js +197 -105
- package/build/src/tools/memory.js +35 -4
- package/build/src/tools/network.js +1 -1
- package/build/src/tools/pages.js +1 -0
- package/build/src/tools/performance.js +60 -39
- package/build/src/tools/screenshot.js +152 -77
- package/build/src/tools/script.js +95 -31
- package/build/src/utils/polyfill.js +6 -3
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +20 -16
- package/skills/memory-leak-debugging/SKILL.md +12 -16
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/utils/Mutex.js +0 -38
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- package/skills/memory-leak-debugging/references/memlab.md +0 -29
package/README.md
CHANGED
|
@@ -294,6 +294,19 @@ Go to `Cursor Settings` -> `MCP` -> `New MCP Server`. Use the config provided ab
|
|
|
294
294
|
|
|
295
295
|
</details>
|
|
296
296
|
|
|
297
|
+
<details>
|
|
298
|
+
<summary>Devin CLI</summary>
|
|
299
|
+
|
|
300
|
+
**Install via CLI (MCP only)**
|
|
301
|
+
|
|
302
|
+
Use the Devin CLI to add the Chrome DevTools MCP server (<a href="https://docs.devin.ai/cli/extensibility/mcp/configuration">guide</a>):
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
devin mcp add chrome-devtools -- npx chrome-devtools-mcp@latest
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
</details>
|
|
309
|
+
|
|
297
310
|
<details>
|
|
298
311
|
<summary>Factory CLI</summary>
|
|
299
312
|
Use the Factory CLI to add the Chrome DevTools MCP server (<a href="https://docs.factory.ai/cli/configuration/mcp">guide</a>):
|
|
@@ -524,7 +537,7 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
|
|
|
524
537
|
- [`take_snapshot`](docs/tool-reference.md#take_snapshot)
|
|
525
538
|
- [`screencast_start`](docs/tool-reference.md#screencast_start)
|
|
526
539
|
- [`screencast_stop`](docs/tool-reference.md#screencast_stop)
|
|
527
|
-
- **Memory** (
|
|
540
|
+
- **Memory** (12 tools)
|
|
528
541
|
- [`take_heapsnapshot`](docs/tool-reference.md#take_heapsnapshot)
|
|
529
542
|
- [`close_heapsnapshot`](docs/tool-reference.md#close_heapsnapshot)
|
|
530
543
|
- [`compare_heapsnapshots`](docs/tool-reference.md#compare_heapsnapshots)
|
|
@@ -533,6 +546,7 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
|
|
|
533
546
|
- [`get_heapsnapshot_dominators`](docs/tool-reference.md#get_heapsnapshot_dominators)
|
|
534
547
|
- [`get_heapsnapshot_duplicate_strings`](docs/tool-reference.md#get_heapsnapshot_duplicate_strings)
|
|
535
548
|
- [`get_heapsnapshot_edges`](docs/tool-reference.md#get_heapsnapshot_edges)
|
|
549
|
+
- [`get_heapsnapshot_object_details`](docs/tool-reference.md#get_heapsnapshot_object_details)
|
|
536
550
|
- [`get_heapsnapshot_retainers`](docs/tool-reference.md#get_heapsnapshot_retainers)
|
|
537
551
|
- [`get_heapsnapshot_retaining_paths`](docs/tool-reference.md#get_heapsnapshot_retaining_paths)
|
|
538
552
|
- [`get_heapsnapshot_summary`](docs/tool-reference.md#get_heapsnapshot_summary)
|
|
@@ -664,7 +678,7 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
664
678
|
- **Default:** `false`
|
|
665
679
|
|
|
666
680
|
- **`--categoryExperimentalWebmcp`/ `--category-experimental-webmcp`**
|
|
667
|
-
Set to true to enable debugging WebMCP tools. Requires Chrome
|
|
681
|
+
Set to true to enable debugging WebMCP tools. Requires Chrome 150+ with the following flag: `--enable-features=WebMCP`
|
|
668
682
|
- **Type:** boolean
|
|
669
683
|
- **Default:** `false`
|
|
670
684
|
|
|
@@ -834,16 +848,19 @@ server instances.
|
|
|
834
848
|
|
|
835
849
|
### User data directory
|
|
836
850
|
|
|
837
|
-
`chrome-devtools-mcp` starts a Chrome's stable channel instance using the following user
|
|
851
|
+
By default, `chrome-devtools-mcp` starts a Chrome's stable channel instance using the following user
|
|
838
852
|
data directory:
|
|
839
853
|
|
|
840
|
-
- Linux / macOS: `$HOME/.cache/chrome-devtools-mcp/chrome-profile
|
|
841
|
-
- Windows: `%
|
|
854
|
+
- Linux / macOS: `$HOME/.cache/chrome-devtools-mcp/chrome-profile`
|
|
855
|
+
- Windows: `%USERPROFILE%\.cache\chrome-devtools-mcp\chrome-profile`
|
|
856
|
+
|
|
857
|
+
For non-stable channels, the channel name is appended to the directory name, for example
|
|
858
|
+
`chrome-profile-canary`.
|
|
842
859
|
|
|
843
|
-
The user data directory is not cleared between runs and
|
|
844
|
-
|
|
845
|
-
to use a temporary user data
|
|
846
|
-
the browser is closed.
|
|
860
|
+
The user data directory is not cleared between runs and is reused for subsequent
|
|
861
|
+
runs with the same channel. Only one browser can use it at a time. Set the `isolated`
|
|
862
|
+
option to `true` to use a temporary user data directory instead which will be cleared
|
|
863
|
+
automatically after the browser is closed.
|
|
847
864
|
|
|
848
865
|
### Connecting to a running Chrome instance
|
|
849
866
|
|
|
@@ -26,12 +26,25 @@ export class HeapSnapshotManager {
|
|
|
26
26
|
});
|
|
27
27
|
return snapshot;
|
|
28
28
|
}
|
|
29
|
-
async
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
async #applyNodeFilter(snapshot, filter, filterName, objectId) {
|
|
30
|
+
if (filterName === 'attributedToSpecificNativeContext') {
|
|
31
|
+
if (objectId === undefined) {
|
|
32
|
+
throw new Error('objectId is required when filterName is attributedToSpecificNativeContext');
|
|
33
|
+
}
|
|
34
|
+
const nodeIndex = await snapshot.nodeIndexForId(objectId);
|
|
35
|
+
if (nodeIndex === undefined) {
|
|
36
|
+
throw new Error(`Node with ID ${objectId} not found`);
|
|
37
|
+
}
|
|
38
|
+
filter.filterName = `nativeContext_${nodeIndex}`;
|
|
39
|
+
}
|
|
40
|
+
else if (filterName) {
|
|
33
41
|
filter.filterName = filterName;
|
|
34
42
|
}
|
|
43
|
+
}
|
|
44
|
+
async getAggregates(filePath, filterName, objectId) {
|
|
45
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
46
|
+
const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
|
|
47
|
+
await this.#applyNodeFilter(snapshot, filter, filterName, objectId);
|
|
35
48
|
const aggregates = await snapshot.aggregatesWithFilter(filter);
|
|
36
49
|
let objectCount = 0;
|
|
37
50
|
let totalSelfSize = 0;
|
|
@@ -55,6 +68,10 @@ export class HeapSnapshotManager {
|
|
|
55
68
|
const snapshot = await this.getSnapshot(filePath);
|
|
56
69
|
return snapshot.staticData;
|
|
57
70
|
}
|
|
71
|
+
async getNativeContextSizes(filePath) {
|
|
72
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
73
|
+
return await snapshot.getNativeContextSizes();
|
|
74
|
+
}
|
|
58
75
|
async getOrCreateIdForClassKey(filePath, classKey) {
|
|
59
76
|
const cached = this.#getCachedSnapshot(filePath);
|
|
60
77
|
let id = cached.classKeyToId.get(classKey);
|
|
@@ -65,12 +82,10 @@ export class HeapSnapshotManager {
|
|
|
65
82
|
}
|
|
66
83
|
return id;
|
|
67
84
|
}
|
|
68
|
-
async getNodesById(filePath, id, filterName) {
|
|
85
|
+
async getNodesById(filePath, id, filterName, objectId) {
|
|
69
86
|
const snapshot = await this.getSnapshot(filePath);
|
|
70
87
|
const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
|
|
71
|
-
|
|
72
|
-
filter.filterName = filterName;
|
|
73
|
-
}
|
|
88
|
+
await this.#applyNodeFilter(snapshot, filter, filterName, objectId);
|
|
74
89
|
const className = await this.resolveClassKeyFromId(filePath, id);
|
|
75
90
|
if (!className) {
|
|
76
91
|
throw new Error(`Class with ID ${id} not found in heap snapshot`);
|
|
@@ -87,6 +102,14 @@ export class HeapSnapshotManager {
|
|
|
87
102
|
const provider = snapshot.createRetainingEdgesProvider(nodeIndex);
|
|
88
103
|
return await provider.serializeItemsRange(0, Infinity);
|
|
89
104
|
}
|
|
105
|
+
async getObjectInfo(filePath, nodeId) {
|
|
106
|
+
const snapshot = await this.getSnapshot(filePath);
|
|
107
|
+
const nodeIndex = await snapshot.nodeIndexForId(nodeId);
|
|
108
|
+
if (nodeIndex === undefined) {
|
|
109
|
+
throw new Error(`Node with ID ${nodeId} not found`);
|
|
110
|
+
}
|
|
111
|
+
return await snapshot.getObjectInfo(nodeIndex);
|
|
112
|
+
}
|
|
90
113
|
async getRetainingPaths(filePath, nodeId, maxDepth, maxNodes, maxSiblings) {
|
|
91
114
|
const snapshot = await this.getSnapshot(filePath);
|
|
92
115
|
const nodeIndex = await snapshot.nodeIndexForId(nodeId);
|
|
@@ -178,21 +201,31 @@ export class HeapSnapshotManager {
|
|
|
178
201
|
async #loadSnapshot(absolutePath, uid) {
|
|
179
202
|
const workerProxy = new DevTools.HeapSnapshotModel.HeapSnapshotProxy.HeapSnapshotWorkerProxy(() => {
|
|
180
203
|
/* noop */
|
|
181
|
-
}, import.meta.resolve('./third_party/devtools-heap-snapshot-worker.js'));
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
await
|
|
204
|
+
}, DevTools.Common.Console.Console.instance(), import.meta.resolve('./third_party/devtools-heap-snapshot-worker.js'));
|
|
205
|
+
try {
|
|
206
|
+
const { promise: snapshotPromise, resolve: resolveSnapshot } = Promise.withResolvers();
|
|
207
|
+
const loaderProxy = workerProxy.createLoader(uid, snapshotProxy => {
|
|
208
|
+
resolveSnapshot(snapshotProxy);
|
|
209
|
+
});
|
|
210
|
+
const fileStream = fsSync.createReadStream(absolutePath, {
|
|
211
|
+
encoding: 'utf-8',
|
|
212
|
+
highWaterMark: 1024 * 1024,
|
|
213
|
+
});
|
|
214
|
+
for await (const chunk of fileStream) {
|
|
215
|
+
await loaderProxy.write(chunk);
|
|
216
|
+
}
|
|
217
|
+
await loaderProxy.close();
|
|
218
|
+
const snapshot = await snapshotPromise;
|
|
219
|
+
return { snapshot, worker: workerProxy };
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
// The worker is created before the read, and a failed load never reaches
|
|
223
|
+
// the #snapshots map, so dispose()/disposeAll() can never clean it up.
|
|
224
|
+
// Dispose it here to avoid leaking a worker on every failed load (e.g. a
|
|
225
|
+
// missing or invalid .heapsnapshot path).
|
|
226
|
+
workerProxy.dispose();
|
|
227
|
+
throw error;
|
|
192
228
|
}
|
|
193
|
-
await loaderProxy.close();
|
|
194
|
-
const snapshot = await snapshotPromise;
|
|
195
|
-
return { snapshot, worker: workerProxy };
|
|
196
229
|
}
|
|
197
230
|
async getDuplicateStrings(filePath) {
|
|
198
231
|
const snapshot = await this.getSnapshot(filePath);
|
|
@@ -201,7 +234,7 @@ export class HeapSnapshotManager {
|
|
|
201
234
|
hasSnapshots() {
|
|
202
235
|
return this.#snapshots.size > 0;
|
|
203
236
|
}
|
|
204
|
-
|
|
237
|
+
disposeSnapshot(filePath) {
|
|
205
238
|
const absolutePath = path.resolve(filePath);
|
|
206
239
|
const cached = this.#snapshots.get(absolutePath);
|
|
207
240
|
if (cached) {
|
|
@@ -211,5 +244,11 @@ export class HeapSnapshotManager {
|
|
|
211
244
|
}
|
|
212
245
|
return false;
|
|
213
246
|
}
|
|
247
|
+
dispose() {
|
|
248
|
+
for (const cached of this.#snapshots.values()) {
|
|
249
|
+
cached.worker.dispose();
|
|
250
|
+
}
|
|
251
|
+
this.#snapshots.clear();
|
|
252
|
+
}
|
|
214
253
|
}
|
|
215
254
|
//# sourceMappingURL=HeapSnapshotManager.js.map
|
package/build/src/McpContext.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import fs from 'node:fs/promises';
|
|
7
|
-
import fsPromises from 'node:fs/promises';
|
|
8
7
|
import os from 'node:os';
|
|
9
8
|
import path from 'node:path';
|
|
10
9
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
@@ -70,6 +69,7 @@ export class McpContext {
|
|
|
70
69
|
this.browser.off('targetcreated', this.#onTargetCreated);
|
|
71
70
|
this.browser.off('targetdestroyed', this.#onTargetDestroyed);
|
|
72
71
|
this.#serviceWorkerConsoleCollector.dispose();
|
|
72
|
+
this.#heapSnapshotManager.dispose();
|
|
73
73
|
for (const mcpPage of this.#mcpPages.values()) {
|
|
74
74
|
mcpPage.dispose();
|
|
75
75
|
}
|
|
@@ -163,7 +163,7 @@ export class McpContext {
|
|
|
163
163
|
const resolvedRoots = await Promise.allSettled(roots.map(async (root) => {
|
|
164
164
|
const rootPathUri = root.uri;
|
|
165
165
|
const rootPath = path.resolve(fileURLToPath(rootPathUri));
|
|
166
|
-
return await
|
|
166
|
+
return await fs.realpath(rootPath);
|
|
167
167
|
}));
|
|
168
168
|
for (let i = 0; i < roots.length; i++) {
|
|
169
169
|
const root = roots[i];
|
|
@@ -254,6 +254,26 @@ export class McpContext {
|
|
|
254
254
|
}
|
|
255
255
|
return page;
|
|
256
256
|
}
|
|
257
|
+
async getDevToolsData(page) {
|
|
258
|
+
const targetPage = page ?? this.#selectedPage;
|
|
259
|
+
if (!targetPage) {
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
let timeoutId;
|
|
263
|
+
const timeoutPromise = new Promise(resolve => {
|
|
264
|
+
timeoutId = setTimeout(() => resolve(undefined), 500);
|
|
265
|
+
});
|
|
266
|
+
const dataPromise = targetPage.getDevToolsData();
|
|
267
|
+
try {
|
|
268
|
+
return await Promise.race([dataPromise, timeoutPromise]);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
finally {
|
|
274
|
+
clearTimeout(timeoutId);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
257
277
|
/**
|
|
258
278
|
* Returns true once if this context was created by reconnecting after the
|
|
259
279
|
* previous browser connection was lost, so the next response can surface a
|
|
@@ -407,28 +427,37 @@ export class McpContext {
|
|
|
407
427
|
getExtensionServiceWorkerId(extensionServiceWorker) {
|
|
408
428
|
return this.#extensionServiceWorkerMap.get(extensionServiceWorker.target);
|
|
409
429
|
}
|
|
410
|
-
async
|
|
411
|
-
const filepath = await getTempFilePath(filename);
|
|
430
|
+
async #writeFile(filepath, data) {
|
|
412
431
|
await this.validatePath(filepath);
|
|
413
432
|
try {
|
|
414
|
-
await fs.
|
|
433
|
+
await fs.mkdir(path.dirname(filepath), { recursive: true });
|
|
434
|
+
// Open the file with flags to:
|
|
435
|
+
// - O_WRONLY: Write-only
|
|
436
|
+
// - O_CREAT: Create if it doesn't exist
|
|
437
|
+
// - O_TRUNC: Truncate to zero length if it exists
|
|
438
|
+
// - O_NOFOLLOW: DO NOT follow symlinks.
|
|
439
|
+
// - 0o600: Permissions: read/write for owner, no permissions for others.
|
|
440
|
+
await fs.writeFile(filepath, data, {
|
|
441
|
+
flag: fs.constants.O_WRONLY |
|
|
442
|
+
fs.constants.O_CREAT |
|
|
443
|
+
fs.constants.O_TRUNC |
|
|
444
|
+
fs.constants.O_NOFOLLOW,
|
|
445
|
+
mode: 0o600,
|
|
446
|
+
});
|
|
415
447
|
}
|
|
416
448
|
catch (err) {
|
|
417
|
-
throw new Error(
|
|
449
|
+
throw new Error(`Could not write ${filepath}`, { cause: err });
|
|
418
450
|
}
|
|
451
|
+
}
|
|
452
|
+
async saveTemporaryFile(data, filename) {
|
|
453
|
+
const filepath = await getTempFilePath(filename);
|
|
454
|
+
await this.#writeFile(filepath, data);
|
|
419
455
|
return { filepath };
|
|
420
456
|
}
|
|
421
457
|
async saveFile(data, clientProvidedFilePath, extension) {
|
|
422
458
|
const filePath = await this.ensureExtension(clientProvidedFilePath, extension);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
await fs.writeFile(filePath, data);
|
|
426
|
-
return { filename: filePath };
|
|
427
|
-
}
|
|
428
|
-
catch (err) {
|
|
429
|
-
this.logger?.(err);
|
|
430
|
-
throw new Error('Could not save a file', { cause: err });
|
|
431
|
-
}
|
|
459
|
+
await this.#writeFile(filePath, data);
|
|
460
|
+
return { filename: filePath };
|
|
432
461
|
}
|
|
433
462
|
storeTraceRecording(result) {
|
|
434
463
|
// Clear the trace results because we only consume the latest trace currently.
|
|
@@ -439,11 +468,17 @@ export class McpContext {
|
|
|
439
468
|
return this.#traceResults;
|
|
440
469
|
}
|
|
441
470
|
async installExtension(extensionPath) {
|
|
442
|
-
const id = await
|
|
471
|
+
const id = await Promise.race([
|
|
472
|
+
this.browser.installExtension(extensionPath),
|
|
473
|
+
new Promise((_, rej) => setTimeout(() => rej(new Error('Timeout installing extension')), 30000)),
|
|
474
|
+
]);
|
|
443
475
|
return id;
|
|
444
476
|
}
|
|
445
477
|
async uninstallExtension(id) {
|
|
446
|
-
await
|
|
478
|
+
await Promise.race([
|
|
479
|
+
this.browser.uninstallExtension(id),
|
|
480
|
+
new Promise((_, rej) => setTimeout(() => rej(new Error('Timeout uninstalling extension')), 30000)),
|
|
481
|
+
]);
|
|
447
482
|
}
|
|
448
483
|
async triggerExtensionAction(id) {
|
|
449
484
|
const extensions = await this.browser.extensions();
|
|
@@ -461,8 +496,8 @@ export class McpContext {
|
|
|
461
496
|
const pptrExtensions = await this.browser.extensions();
|
|
462
497
|
return pptrExtensions.get(id);
|
|
463
498
|
}
|
|
464
|
-
async getHeapSnapshotAggregates(filePath, filterName) {
|
|
465
|
-
return await this.#heapSnapshotManager.getAggregates(filePath, filterName);
|
|
499
|
+
async getHeapSnapshotAggregates(filePath, filterName, objectId) {
|
|
500
|
+
return await this.#heapSnapshotManager.getAggregates(filePath, filterName, objectId);
|
|
466
501
|
}
|
|
467
502
|
async getHeapSnapshotDuplicateStrings(filePath) {
|
|
468
503
|
return await this.#heapSnapshotManager.getDuplicateStrings(filePath);
|
|
@@ -473,14 +508,20 @@ export class McpContext {
|
|
|
473
508
|
async getHeapSnapshotStaticData(filePath) {
|
|
474
509
|
return await this.#heapSnapshotManager.getStaticData(filePath);
|
|
475
510
|
}
|
|
476
|
-
async
|
|
477
|
-
return await this.#heapSnapshotManager.
|
|
511
|
+
async getHeapSnapshotNativeContextSizes(filePath) {
|
|
512
|
+
return await this.#heapSnapshotManager.getNativeContextSizes(filePath);
|
|
513
|
+
}
|
|
514
|
+
async getHeapSnapshotNodesById(filePath, id, filterName, objectId) {
|
|
515
|
+
return await this.#heapSnapshotManager.getNodesById(filePath, id, filterName, objectId);
|
|
478
516
|
}
|
|
479
517
|
async getHeapSnapshotRetainers(filePath, nodeId) {
|
|
480
518
|
return await this.#heapSnapshotManager.getRetainers(filePath, nodeId);
|
|
481
519
|
}
|
|
520
|
+
async getHeapSnapshotObjectDetails(filePath, nodeId) {
|
|
521
|
+
return await this.#heapSnapshotManager.getObjectInfo(filePath, nodeId);
|
|
522
|
+
}
|
|
482
523
|
async closeHeapSnapshot(filePath) {
|
|
483
|
-
return this.#heapSnapshotManager.
|
|
524
|
+
return this.#heapSnapshotManager.disposeSnapshot(filePath);
|
|
484
525
|
}
|
|
485
526
|
hasHeapSnapshots() {
|
|
486
527
|
return this.#heapSnapshotManager.hasSnapshots();
|
|
@@ -529,7 +570,7 @@ export class McpContext {
|
|
|
529
570
|
}
|
|
530
571
|
case 'file:': {
|
|
531
572
|
await this.validatePath(fileURLToPath(url));
|
|
532
|
-
return await
|
|
573
|
+
return await fs.readFile(url, 'utf-8');
|
|
533
574
|
}
|
|
534
575
|
default:
|
|
535
576
|
throw new Error(`Unsupported protocol for: ${url}`);
|
package/build/src/McpPage.js
CHANGED
|
@@ -3,6 +3,104 @@
|
|
|
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
|
+
});
|
|
58
|
+
export function replaceHtmlElementsWithUids(schema) {
|
|
59
|
+
if (typeof schema === 'boolean') {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
let isHtmlElement = false;
|
|
63
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
64
|
+
if (key === 'x-mcp-type' && value === 'HTMLElement') {
|
|
65
|
+
isHtmlElement = true;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (isHtmlElement) {
|
|
70
|
+
schema.properties = { uid: { type: 'string' } };
|
|
71
|
+
schema.required = ['uid'];
|
|
72
|
+
}
|
|
73
|
+
if (schema.properties) {
|
|
74
|
+
for (const key of Object.keys(schema.properties)) {
|
|
75
|
+
replaceHtmlElementsWithUids(schema.properties[key]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (schema.items) {
|
|
79
|
+
if (Array.isArray(schema.items)) {
|
|
80
|
+
for (const item of schema.items) {
|
|
81
|
+
replaceHtmlElementsWithUids(item);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
replaceHtmlElementsWithUids(schema.items);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (schema.anyOf) {
|
|
89
|
+
for (const s of schema.anyOf) {
|
|
90
|
+
replaceHtmlElementsWithUids(s);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (schema.allOf) {
|
|
94
|
+
for (const s of schema.allOf) {
|
|
95
|
+
replaceHtmlElementsWithUids(s);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (schema.oneOf) {
|
|
99
|
+
for (const s of schema.oneOf) {
|
|
100
|
+
replaceHtmlElementsWithUids(s);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
6
104
|
import { createTargetUniverse, } from './devtools/DevtoolsUtils.js';
|
|
7
105
|
import { ConsoleCollector, NetworkCollector, } from './PageCollector.js';
|
|
8
106
|
import { TextSnapshot } from './TextSnapshot.js';
|
|
@@ -99,13 +197,110 @@ export class McpPage {
|
|
|
99
197
|
this.#dialog = undefined;
|
|
100
198
|
}
|
|
101
199
|
throwIfDialogOpen() {
|
|
102
|
-
if (this.#dialog) {
|
|
200
|
+
if (this.#dialog && !this.#dialog.handled) {
|
|
103
201
|
throw new Error(`A dialog is open (${this.#dialog.type()}: ${this.#dialog.message()}).`);
|
|
104
202
|
}
|
|
105
203
|
}
|
|
106
204
|
getThirdPartyDeveloperTools() {
|
|
107
205
|
return this.thirdPartyDeveloperTools;
|
|
108
206
|
}
|
|
207
|
+
async getToolGroups() {
|
|
208
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
209
|
+
try {
|
|
210
|
+
// Check if there is a `devtoolstooldiscovery` event listener
|
|
211
|
+
const windowHandle = __addDisposableResource(env_1, await this.pptrPage.evaluateHandle(() => window), false);
|
|
212
|
+
// @ts-expect-error internal API
|
|
213
|
+
const client = this.pptrPage._client();
|
|
214
|
+
const { listeners } = await client.send('DOMDebugger.getEventListeners', {
|
|
215
|
+
objectId: windowHandle.remoteObject().objectId,
|
|
216
|
+
});
|
|
217
|
+
if (listeners.find(l => l.type === 'devtoolstooldiscovery') === undefined) {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
const toolGroups = await this.pptrPage.evaluate(() => {
|
|
221
|
+
if (window.__dtmcp) {
|
|
222
|
+
window.__dtmcp.toolGroups = [];
|
|
223
|
+
}
|
|
224
|
+
return new Promise(resolve => {
|
|
225
|
+
const event = new CustomEvent('devtoolstooldiscovery');
|
|
226
|
+
const groups = [];
|
|
227
|
+
// @ts-expect-error Adding custom property
|
|
228
|
+
event.respondWith = toolGroup => {
|
|
229
|
+
if (!window.__dtmcp) {
|
|
230
|
+
window.__dtmcp = {};
|
|
231
|
+
}
|
|
232
|
+
if (!window.__dtmcp.toolGroups) {
|
|
233
|
+
window.__dtmcp.toolGroups = [];
|
|
234
|
+
}
|
|
235
|
+
if (typeof toolGroup.name !== 'string' ||
|
|
236
|
+
(toolGroup.description &&
|
|
237
|
+
typeof toolGroup.description !== 'string') ||
|
|
238
|
+
!Array.isArray(toolGroup.tools)) {
|
|
239
|
+
console.error('Invalid toolGroup:', toolGroup);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
for (const tool of toolGroup.tools) {
|
|
243
|
+
if (typeof tool.name !== 'string' ||
|
|
244
|
+
typeof tool.description !== 'string' ||
|
|
245
|
+
typeof tool.inputSchema !== 'object' ||
|
|
246
|
+
typeof tool.execute !== 'function') {
|
|
247
|
+
console.error('Invalid tool:', tool);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
window.__dtmcp.toolGroups.push(toolGroup);
|
|
252
|
+
// When receiving a toolGroup for the first time, expose a simple execution helper
|
|
253
|
+
if (!window.__dtmcp.executeTool) {
|
|
254
|
+
window.__dtmcp.executeTool = async (toolName, args) => {
|
|
255
|
+
if (!window.__dtmcp?.toolGroups ||
|
|
256
|
+
window.__dtmcp.toolGroups.length === 0) {
|
|
257
|
+
throw new Error('No tools found on the page');
|
|
258
|
+
}
|
|
259
|
+
for (const group of window.__dtmcp.toolGroups) {
|
|
260
|
+
const tool = group.tools?.find(t => t.name === toolName);
|
|
261
|
+
if (tool) {
|
|
262
|
+
return await tool.execute(args);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
throw new Error(`Tool ${toolName} not found`);
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
groups.push(toolGroup);
|
|
269
|
+
};
|
|
270
|
+
window.dispatchEvent(event);
|
|
271
|
+
// If at least one toolGroup was added synchronously, resolve with the array.
|
|
272
|
+
// Otherwise, use setTimeout to allow for any microtask/asynchronous respondWith calls, or resolve with an empty array.
|
|
273
|
+
if (groups.length > 0) {
|
|
274
|
+
resolve(groups);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
if (groups.length > 0) {
|
|
279
|
+
resolve(groups);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
resolve([]);
|
|
283
|
+
}
|
|
284
|
+
}, 0);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
for (const group of toolGroups) {
|
|
289
|
+
for (const tool of group.tools ?? []) {
|
|
290
|
+
replaceHtmlElementsWithUids(tool.inputSchema);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
this.thirdPartyDeveloperTools = toolGroups;
|
|
294
|
+
return toolGroups;
|
|
295
|
+
}
|
|
296
|
+
catch (e_1) {
|
|
297
|
+
env_1.error = e_1;
|
|
298
|
+
env_1.hasError = true;
|
|
299
|
+
}
|
|
300
|
+
finally {
|
|
301
|
+
__disposeResources(env_1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
109
304
|
getWebMcpTools() {
|
|
110
305
|
return this.pptrPage.webmcp.tools();
|
|
111
306
|
}
|
|
@@ -180,6 +375,12 @@ export class McpPage {
|
|
|
180
375
|
this.pptrPage.off('dialog', this.#dialogHandler);
|
|
181
376
|
this.networkCollector.dispose();
|
|
182
377
|
this.consoleCollector.dispose();
|
|
378
|
+
const devtoolsUniverse = this.#devtoolsUniverse;
|
|
379
|
+
this.#devtoolsUniverse = undefined;
|
|
380
|
+
devtoolsUniverse?.universe.dispose();
|
|
381
|
+
void devtoolsUniverse?.session.detach().catch(e => {
|
|
382
|
+
logger?.('Failed to detach DevTools session', e);
|
|
383
|
+
});
|
|
183
384
|
}
|
|
184
385
|
async executeThirdPartyDeveloperTool(toolName, params, response) {
|
|
185
386
|
// Creates array of ElementHandles from the UIDs in the params.
|
|
@@ -278,16 +479,29 @@ export class McpPage {
|
|
|
278
479
|
}, i);
|
|
279
480
|
elementHandles.push(elementHandle);
|
|
280
481
|
}
|
|
482
|
+
await this.pptrPage.evaluate(() => {
|
|
483
|
+
if (window.__dtmcp) {
|
|
484
|
+
window.__dtmcp.stashedElements = undefined;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
281
487
|
if (elementHandles.length) {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
await
|
|
289
|
-
|
|
290
|
-
|
|
488
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
489
|
+
try {
|
|
490
|
+
const stack = __addDisposableResource(env_2, new DisposableStack(), false);
|
|
491
|
+
for (const handle of this.extraHandles) {
|
|
492
|
+
stack.use(handle);
|
|
493
|
+
}
|
|
494
|
+
this.textSnapshot = await TextSnapshot.create(this, {
|
|
495
|
+
extraHandles: elementHandles,
|
|
496
|
+
});
|
|
497
|
+
response.includeSnapshot();
|
|
498
|
+
}
|
|
499
|
+
catch (e_2) {
|
|
500
|
+
env_2.error = e_2;
|
|
501
|
+
env_2.hasError = true;
|
|
502
|
+
}
|
|
503
|
+
finally {
|
|
504
|
+
__disposeResources(env_2);
|
|
291
505
|
}
|
|
292
506
|
}
|
|
293
507
|
const cdpElementIds = await Promise.all(elementHandles.map(async (elementHandle, index) => {
|
|
@@ -511,7 +725,7 @@ export class McpPage {
|
|
|
511
725
|
*/
|
|
512
726
|
async setUpNetworkCollectorForTesting() {
|
|
513
727
|
this.networkCollector.dispose();
|
|
514
|
-
this.networkCollector = new NetworkCollector(this.pptrPage, collect => {
|
|
728
|
+
this.networkCollector = new NetworkCollector(this.pptrPage, undefined, collect => {
|
|
515
729
|
return {
|
|
516
730
|
request: req => {
|
|
517
731
|
if (req.url().includes('favicon.ico')) {
|