chrome-devtools-mcp 1.6.0 → 1.8.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 +73 -22
- package/build/src/McpContext.js +121 -44
- package/build/src/McpPage.js +230 -14
- package/build/src/McpResponse.js +209 -283
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +80 -15
- package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
- package/build/src/bin/chrome-devtools.js +47 -32
- package/build/src/browser.js +3 -1
- package/build/src/{PageCollector.js → collectors/PageCollector.js} +15 -10
- package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
- package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +414 -23
- package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +74 -9
- package/build/src/daemon/client.js +33 -2
- package/build/src/daemon/daemon.js +17 -13
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +9 -16
- package/build/src/formatters/ConsoleFormatter.js +43 -10
- package/build/src/formatters/HeapSnapshotFormatter.js +58 -13
- package/build/src/formatters/IssueFormatter.js +1 -1
- package/build/src/formatters/NetworkFormatter.js +7 -7
- package/build/src/index.js +34 -5
- package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +82 -27
- package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
- package/build/src/telemetry/ClearcutLogger.js +16 -1
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/telemetry/types.js +4 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +235 -113
- package/build/src/third_party/bundled-packages.json +6 -7
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +657 -224
- package/build/src/third_party/index.js +62484 -43814
- 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/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- 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/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- 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/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- 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/categories.js +3 -0
- package/build/src/tools/console.js +9 -3
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +7 -5
- package/build/src/tools/input.js +222 -120
- package/build/src/tools/lighthouse.js +3 -1
- package/build/src/tools/memory.js +144 -17
- package/build/src/tools/network.js +6 -3
- package/build/src/tools/pages.js +13 -16
- package/build/src/tools/performance.js +57 -46
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +6 -4
- package/build/src/tools/screenshot.js +192 -84
- package/build/src/tools/script.js +118 -34
- package/build/src/tools/slim/tools.js +3 -3
- package/build/src/tools/snapshot.js +5 -3
- package/build/src/tools/thirdPartyDeveloper.js +2 -2
- package/build/src/tools/tools.js +2 -0
- package/build/src/tools/webmcp.js +2 -2
- package/build/src/utils/WaitForHelper.js +299 -0
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/logger.js +25 -11
- 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 +37 -25
- package/skills/a11y-debugging/SKILL.md +2 -0
- package/skills/chrome-devtools/SKILL.md +5 -4
- package/skills/chrome-devtools-cli/SKILL.md +109 -64
- package/skills/debug-optimize-lcp/SKILL.md +9 -9
- package/skills/memory-leak-debugging/SKILL.md +14 -18
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/skills/troubleshooting/SKILL.md +1 -0
- package/build/src/WaitForHelper.js +0 -200
- 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/build/src/utils/string.js +0 -37
- 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
|
@@ -136,6 +136,26 @@ Chrome DevTools MCP will not start the browser instance automatically using this
|
|
|
136
136
|
|
|
137
137
|
</details>
|
|
138
138
|
|
|
139
|
+
<details>
|
|
140
|
+
<summary>Bob</summary>
|
|
141
|
+
|
|
142
|
+
Follow the <a href="https://bob.ibm.com/docs/ide/configuration/mcp/mcp-in-bob">IBM Bob MCP guide</a> and add the Chrome DevTools MCP server to your Bob MCP configuration. Use the global config (`~/.bob/mcp.json`) to apply it across all workspaces, or a project config (`.bob/mcp.json`) to scope it to one project:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"chrome-devtools": {
|
|
148
|
+
"command": "npx",
|
|
149
|
+
"args": ["-y", "chrome-devtools-mcp@latest"]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
You can edit these files from **Bob panel → Settings → MCP → Edit Global MCP** (or **Edit Project MCP**). Bob hot-reloads on save. Once the server appears in the MCP tab, switch to the **🌎 Browser Dev** mode to get guided browser debugging directly in Bob.
|
|
156
|
+
|
|
157
|
+
</details>
|
|
158
|
+
|
|
139
159
|
<details>
|
|
140
160
|
<summary>Claude Code</summary>
|
|
141
161
|
|
|
@@ -294,6 +314,19 @@ Go to `Cursor Settings` -> `MCP` -> `New MCP Server`. Use the config provided ab
|
|
|
294
314
|
|
|
295
315
|
</details>
|
|
296
316
|
|
|
317
|
+
<details>
|
|
318
|
+
<summary>Devin CLI</summary>
|
|
319
|
+
|
|
320
|
+
**Install via CLI (MCP only)**
|
|
321
|
+
|
|
322
|
+
Use the Devin CLI to add the Chrome DevTools MCP server (<a href="https://docs.devin.ai/cli/extensibility/mcp/configuration">guide</a>):
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
devin mcp add chrome-devtools -- npx chrome-devtools-mcp@latest
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
</details>
|
|
329
|
+
|
|
297
330
|
<details>
|
|
298
331
|
<summary>Factory CLI</summary>
|
|
299
332
|
Use the Factory CLI to add the Chrome DevTools MCP server (<a href="https://docs.factory.ai/cli/configuration/mcp">guide</a>):
|
|
@@ -524,7 +557,7 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
|
|
|
524
557
|
- [`take_snapshot`](docs/tool-reference.md#take_snapshot)
|
|
525
558
|
- [`screencast_start`](docs/tool-reference.md#screencast_start)
|
|
526
559
|
- [`screencast_stop`](docs/tool-reference.md#screencast_stop)
|
|
527
|
-
- **Memory** (
|
|
560
|
+
- **Memory** (13 tools)
|
|
528
561
|
- [`take_heapsnapshot`](docs/tool-reference.md#take_heapsnapshot)
|
|
529
562
|
- [`close_heapsnapshot`](docs/tool-reference.md#close_heapsnapshot)
|
|
530
563
|
- [`compare_heapsnapshots`](docs/tool-reference.md#compare_heapsnapshots)
|
|
@@ -533,9 +566,11 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
|
|
|
533
566
|
- [`get_heapsnapshot_dominators`](docs/tool-reference.md#get_heapsnapshot_dominators)
|
|
534
567
|
- [`get_heapsnapshot_duplicate_strings`](docs/tool-reference.md#get_heapsnapshot_duplicate_strings)
|
|
535
568
|
- [`get_heapsnapshot_edges`](docs/tool-reference.md#get_heapsnapshot_edges)
|
|
569
|
+
- [`get_heapsnapshot_object_details`](docs/tool-reference.md#get_heapsnapshot_object_details)
|
|
536
570
|
- [`get_heapsnapshot_retainers`](docs/tool-reference.md#get_heapsnapshot_retainers)
|
|
537
571
|
- [`get_heapsnapshot_retaining_paths`](docs/tool-reference.md#get_heapsnapshot_retaining_paths)
|
|
538
572
|
- [`get_heapsnapshot_summary`](docs/tool-reference.md#get_heapsnapshot_summary)
|
|
573
|
+
- [`query_heapsnapshot_objects`](docs/tool-reference.md#query_heapsnapshot_objects)
|
|
539
574
|
- **Extensions** (5 tools)
|
|
540
575
|
- [`install_extension`](docs/tool-reference.md#install_extension)
|
|
541
576
|
- [`list_extensions`](docs/tool-reference.md#list_extensions)
|
|
@@ -548,6 +583,11 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
|
|
|
548
583
|
- **WebMCP** (2 tools)
|
|
549
584
|
- [`execute_webmcp_tool`](docs/tool-reference.md#execute_webmcp_tool)
|
|
550
585
|
- [`list_webmcp_tools`](docs/tool-reference.md#list_webmcp_tools)
|
|
586
|
+
- **Progressive Web Apps** (4 tools)
|
|
587
|
+
- [`get_os_app_state`](docs/tool-reference.md#get_os_app_state)
|
|
588
|
+
- [`install_pwa`](docs/tool-reference.md#install_pwa)
|
|
589
|
+
- [`launch_pwa`](docs/tool-reference.md#launch_pwa)
|
|
590
|
+
- [`uninstall_pwa`](docs/tool-reference.md#uninstall_pwa)
|
|
551
591
|
|
|
552
592
|
<!-- END AUTO GENERATED TOOLS -->
|
|
553
593
|
|
|
@@ -623,10 +663,10 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
623
663
|
- **Type:** boolean
|
|
624
664
|
- **Default:** `false`
|
|
625
665
|
|
|
626
|
-
- **`--
|
|
627
|
-
|
|
666
|
+
- **`--pageIdRouting`/ `--page-id-routing`**
|
|
667
|
+
Require pageId on page-scoped tools and route requests by page ID (useful for concurrent agent sessions). Use --no-page-id-routing to disable.
|
|
628
668
|
- **Type:** boolean
|
|
629
|
-
- **Default:** `
|
|
669
|
+
- **Default:** `true`
|
|
630
670
|
|
|
631
671
|
- **`--experimentalDevtools`/ `--experimental-devtools`**
|
|
632
672
|
Whether to enable automation over DevTools targets
|
|
@@ -664,7 +704,7 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
664
704
|
- **Default:** `false`
|
|
665
705
|
|
|
666
706
|
- **`--categoryExperimentalWebmcp`/ `--category-experimental-webmcp`**
|
|
667
|
-
Set to true to enable debugging WebMCP tools. Requires Chrome
|
|
707
|
+
Set to true to enable debugging WebMCP tools. Requires Chrome 150+ with the following flag: `--enable-features=WebMCP`
|
|
668
708
|
- **Type:** boolean
|
|
669
709
|
- **Default:** `false`
|
|
670
710
|
|
|
@@ -713,6 +753,11 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
713
753
|
- **Type:** boolean
|
|
714
754
|
- **Default:** `false`
|
|
715
755
|
|
|
756
|
+
- **`--categoryPwa`/ `--category-pwa`**
|
|
757
|
+
Set to true to include tools for automating Progressive Web Apps (install, launch, uninstall, and OS state). This feature is only supported with a pipe connection; autoConnect, browserUrl, and wsEndpoint are not supported.
|
|
758
|
+
- **Type:** boolean
|
|
759
|
+
- **Default:** `false`
|
|
760
|
+
|
|
716
761
|
- **`--performanceCrux`/ `--performance-crux`**
|
|
717
762
|
Set to false to disable sending URLs from performance traces to CrUX API to get field performance data.
|
|
718
763
|
- **Type:** boolean
|
|
@@ -806,22 +851,25 @@ You can also run `npx chrome-devtools-mcp@latest --help` to see all available co
|
|
|
806
851
|
|
|
807
852
|
### Concurrent sessions
|
|
808
853
|
|
|
809
|
-
Most MCP clients start one Chrome DevTools MCP server per conversation.
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
with.
|
|
854
|
+
Most MCP clients start one Chrome DevTools MCP server per conversation.
|
|
855
|
+
By default, the server runs with `--pageIdRouting` enabled, making `pageId` a
|
|
856
|
+
required parameter on page-scoped tools (such as `click`, `fill`, `navigate_page`,
|
|
857
|
+
`take_snapshot`, etc.) so multiple agents or subagents sharing a server instance can
|
|
858
|
+
route tool calls directly to the specific tab they are working with.
|
|
859
|
+
|
|
860
|
+
For `evaluate_script`, `pageId` is required by default for targeting pages, but
|
|
861
|
+
becomes optional when `--categoryExtensions` is enabled so that `serviceWorkerId`
|
|
862
|
+
can be specified instead to evaluate inside an extension background service worker.
|
|
863
|
+
|
|
864
|
+
To disable this behavior and default to the currently selected page, pass
|
|
865
|
+
`--no-page-id-routing`.
|
|
814
866
|
|
|
815
867
|
```json
|
|
816
868
|
{
|
|
817
869
|
"mcpServers": {
|
|
818
870
|
"chrome-devtools": {
|
|
819
871
|
"command": "npx",
|
|
820
|
-
"args": [
|
|
821
|
-
"-y",
|
|
822
|
-
"chrome-devtools-mcp@latest",
|
|
823
|
-
"--experimentalPageIdRouting"
|
|
824
|
-
]
|
|
872
|
+
"args": ["-y", "chrome-devtools-mcp@latest"]
|
|
825
873
|
}
|
|
826
874
|
}
|
|
827
875
|
}
|
|
@@ -834,16 +882,19 @@ server instances.
|
|
|
834
882
|
|
|
835
883
|
### User data directory
|
|
836
884
|
|
|
837
|
-
`chrome-devtools-mcp` starts a Chrome's stable channel instance using the following user
|
|
885
|
+
By default, `chrome-devtools-mcp` starts a Chrome's stable channel instance using the following user
|
|
838
886
|
data directory:
|
|
839
887
|
|
|
840
|
-
- Linux / macOS: `$HOME/.cache/chrome-devtools-mcp/chrome-profile
|
|
841
|
-
- Windows: `%
|
|
888
|
+
- Linux / macOS: `$HOME/.cache/chrome-devtools-mcp/chrome-profile`
|
|
889
|
+
- Windows: `%USERPROFILE%\.cache\chrome-devtools-mcp\chrome-profile`
|
|
890
|
+
|
|
891
|
+
For non-stable channels, the channel name is appended to the directory name, for example
|
|
892
|
+
`chrome-profile-canary`.
|
|
842
893
|
|
|
843
|
-
The user data directory is not cleared between runs and
|
|
844
|
-
|
|
845
|
-
to use a temporary user data
|
|
846
|
-
the browser is closed.
|
|
894
|
+
The user data directory is not cleared between runs and is reused for subsequent
|
|
895
|
+
runs with the same channel. Only one browser can use it at a time. Set the `isolated`
|
|
896
|
+
option to `true` to use a temporary user data directory instead which will be cleared
|
|
897
|
+
automatically after the browser is closed.
|
|
847
898
|
|
|
848
899
|
### Connecting to a running Chrome instance
|
|
849
900
|
|
package/build/src/McpContext.js
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
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';
|
|
11
10
|
import { overrideDevToolsGlobals } from './devtools/DevtoolsUtils.js';
|
|
12
|
-
import { HeapSnapshotManager } from './HeapSnapshotManager.js';
|
|
11
|
+
import { HeapSnapshotManager } from './processors/HeapSnapshotManager.js';
|
|
13
12
|
import { McpPage } from './McpPage.js';
|
|
14
|
-
import { ServiceWorkerConsoleCollector } from './ServiceWorkerCollector.js';
|
|
13
|
+
import { ServiceWorkerConsoleCollector } from './collectors/ServiceWorkerCollector.js';
|
|
15
14
|
import { Locator, } from './third_party/index.js';
|
|
16
15
|
import { listPages } from './tools/pages.js';
|
|
17
16
|
import { CLOSE_PAGE_ERROR } from './tools/ToolDefinition.js';
|
|
@@ -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
|
}
|
|
@@ -137,33 +137,35 @@ export class McpContext {
|
|
|
137
137
|
}
|
|
138
138
|
async validatePath(filePath) {
|
|
139
139
|
if (filePath === undefined) {
|
|
140
|
-
return;
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
let canonicalPath;
|
|
143
|
+
try {
|
|
144
|
+
canonicalPath = await resolveCanonicalPath(filePath);
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
148
|
+
console.error(`[MCP Context] Error resolving real path for ${filePath}: ${errMsg}`);
|
|
149
|
+
throw new Error(`Access denied: Cannot resolve base path for ${filePath}.`);
|
|
141
150
|
}
|
|
142
151
|
// If the client never negotiated roots and the operator has explicitly
|
|
143
152
|
// opted into unrestricted access via --allow-unrestricted-paths, restore
|
|
144
153
|
// the previous permissive behavior and skip validation.
|
|
145
154
|
if (this.#roots === undefined && this.#allowUnrestrictedPaths) {
|
|
146
|
-
|
|
155
|
+
// Canonical path might not exist yet so we fallback to
|
|
156
|
+
// path.resolve(filePath). Consumers should not follow symlinks.
|
|
157
|
+
return canonicalPath || path.resolve(filePath);
|
|
147
158
|
}
|
|
148
159
|
// roots() always returns at least the temp directory, even if the
|
|
149
160
|
// connecting client never negotiated the optional `roots` capability.
|
|
150
161
|
// Path validation must not be skipped just because no workspace roots
|
|
151
162
|
// were configured.
|
|
152
163
|
const roots = this.roots();
|
|
153
|
-
let canonicalPath;
|
|
154
|
-
try {
|
|
155
|
-
canonicalPath = await resolveCanonicalPath(filePath);
|
|
156
|
-
}
|
|
157
|
-
catch (err) {
|
|
158
|
-
const errMsg = err instanceof Error ? err.message : String(err);
|
|
159
|
-
console.error(`[MCP Context] Error resolving real path for ${filePath}: ${errMsg}`);
|
|
160
|
-
throw new Error(`Access denied: Cannot resolve base path for ${filePath}.`);
|
|
161
|
-
}
|
|
162
164
|
let allowed = false;
|
|
163
165
|
const resolvedRoots = await Promise.allSettled(roots.map(async (root) => {
|
|
164
166
|
const rootPathUri = root.uri;
|
|
165
167
|
const rootPath = path.resolve(fileURLToPath(rootPathUri));
|
|
166
|
-
return await
|
|
168
|
+
return await fs.realpath(rootPath);
|
|
167
169
|
}));
|
|
168
170
|
for (let i = 0; i < roots.length; i++) {
|
|
169
171
|
const root = roots[i];
|
|
@@ -186,12 +188,12 @@ export class McpContext {
|
|
|
186
188
|
if (!allowed) {
|
|
187
189
|
throw new Error(`Access denied: path ${filePath} (canonical: ${canonicalPath}) is not within any of the configured workspace roots.`);
|
|
188
190
|
}
|
|
191
|
+
return canonicalPath || path.resolve(filePath);
|
|
189
192
|
}
|
|
190
193
|
async ensureExtension(filePath, extension) {
|
|
191
|
-
const
|
|
192
|
-
const currentExtension = path.extname(
|
|
193
|
-
const outputPath = `${
|
|
194
|
-
await this.validatePath(outputPath);
|
|
194
|
+
const resolved = await this.validatePath(filePath);
|
|
195
|
+
const currentExtension = path.extname(resolved);
|
|
196
|
+
const outputPath = `${resolved.slice(0, resolved.length - currentExtension.length)}${extension}`;
|
|
195
197
|
return outputPath;
|
|
196
198
|
}
|
|
197
199
|
async newPage(background, isolatedContextName) {
|
|
@@ -226,6 +228,18 @@ export class McpContext {
|
|
|
226
228
|
get #hasNetworkBlockOrAllowlist() {
|
|
227
229
|
return !!(this.#options.allowList || this.#options.blocklist);
|
|
228
230
|
}
|
|
231
|
+
installPWA(options) {
|
|
232
|
+
return this.browser.installPWA(options);
|
|
233
|
+
}
|
|
234
|
+
uninstallPWA(options) {
|
|
235
|
+
return this.browser.uninstallPWA(options);
|
|
236
|
+
}
|
|
237
|
+
launchPWA(options) {
|
|
238
|
+
return this.browser.launchPWA(options);
|
|
239
|
+
}
|
|
240
|
+
getPWAState(options) {
|
|
241
|
+
return this.browser.getPWAState(options);
|
|
242
|
+
}
|
|
229
243
|
setIsRunningPerformanceTrace(x) {
|
|
230
244
|
this.#isRunningTrace = x;
|
|
231
245
|
}
|
|
@@ -254,6 +268,41 @@ export class McpContext {
|
|
|
254
268
|
}
|
|
255
269
|
return page;
|
|
256
270
|
}
|
|
271
|
+
getSelectedMcpPageUrl(page) {
|
|
272
|
+
let targetPage = page;
|
|
273
|
+
if (!targetPage) {
|
|
274
|
+
try {
|
|
275
|
+
targetPage = this.getSelectedMcpPage();
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (targetPage?.pptrPage?.isClosed() === false) {
|
|
282
|
+
return targetPage.pptrPage.url();
|
|
283
|
+
}
|
|
284
|
+
return undefined;
|
|
285
|
+
}
|
|
286
|
+
async getDevToolsData(page) {
|
|
287
|
+
const targetPage = page ?? this.#selectedPage;
|
|
288
|
+
if (!targetPage) {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
let timeoutId;
|
|
292
|
+
const timeoutPromise = new Promise(resolve => {
|
|
293
|
+
timeoutId = setTimeout(() => resolve(undefined), 500);
|
|
294
|
+
});
|
|
295
|
+
const dataPromise = targetPage.getDevToolsData();
|
|
296
|
+
try {
|
|
297
|
+
return await Promise.race([dataPromise, timeoutPromise]);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
finally {
|
|
303
|
+
clearTimeout(timeoutId);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
257
306
|
/**
|
|
258
307
|
* Returns true once if this context was created by reconnecting after the
|
|
259
308
|
* previous browser connection was lost, so the next response can surface a
|
|
@@ -339,6 +388,7 @@ export class McpContext {
|
|
|
339
388
|
locatorClass: this.#locatorClass,
|
|
340
389
|
hasNetworkBlockOrAllowlist: this.#hasNetworkBlockOrAllowlist,
|
|
341
390
|
isolatedContextName: this.#getBrowserContextToNameMap().get(page.browserContext()),
|
|
391
|
+
navigationTimeout: this.#options.navigationTimeout,
|
|
342
392
|
});
|
|
343
393
|
this.#mcpPages.set(page, mcpPage);
|
|
344
394
|
await mcpPage.init();
|
|
@@ -407,28 +457,37 @@ export class McpContext {
|
|
|
407
457
|
getExtensionServiceWorkerId(extensionServiceWorker) {
|
|
408
458
|
return this.#extensionServiceWorkerMap.get(extensionServiceWorker.target);
|
|
409
459
|
}
|
|
410
|
-
async
|
|
411
|
-
const
|
|
412
|
-
await this.validatePath(filepath);
|
|
460
|
+
async #writeFile(filepath, data) {
|
|
461
|
+
const resolved = await this.validatePath(filepath);
|
|
413
462
|
try {
|
|
414
|
-
await fs.
|
|
463
|
+
await fs.mkdir(path.dirname(resolved), { recursive: true });
|
|
464
|
+
// Open the file with flags to:
|
|
465
|
+
// - O_WRONLY: Write-only
|
|
466
|
+
// - O_CREAT: Create if it doesn't exist
|
|
467
|
+
// - O_TRUNC: Truncate to zero length if it exists
|
|
468
|
+
// - O_NOFOLLOW: DO NOT follow symlinks.
|
|
469
|
+
// - 0o600: Permissions: read/write for owner, no permissions for others.
|
|
470
|
+
await fs.writeFile(resolved, data, {
|
|
471
|
+
flag: fs.constants.O_WRONLY |
|
|
472
|
+
fs.constants.O_CREAT |
|
|
473
|
+
fs.constants.O_TRUNC |
|
|
474
|
+
fs.constants.O_NOFOLLOW,
|
|
475
|
+
mode: 0o600,
|
|
476
|
+
});
|
|
415
477
|
}
|
|
416
478
|
catch (err) {
|
|
417
|
-
throw new Error(
|
|
479
|
+
throw new Error(`Could not write ${filepath}`, { cause: err });
|
|
418
480
|
}
|
|
481
|
+
}
|
|
482
|
+
async saveTemporaryFile(data, filename) {
|
|
483
|
+
const filepath = await getTempFilePath(filename);
|
|
484
|
+
await this.#writeFile(filepath, data);
|
|
419
485
|
return { filepath };
|
|
420
486
|
}
|
|
421
487
|
async saveFile(data, clientProvidedFilePath, extension) {
|
|
422
488
|
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
|
-
}
|
|
489
|
+
await this.#writeFile(filePath, data);
|
|
490
|
+
return { filename: filePath };
|
|
432
491
|
}
|
|
433
492
|
storeTraceRecording(result) {
|
|
434
493
|
// Clear the trace results because we only consume the latest trace currently.
|
|
@@ -439,11 +498,17 @@ export class McpContext {
|
|
|
439
498
|
return this.#traceResults;
|
|
440
499
|
}
|
|
441
500
|
async installExtension(extensionPath) {
|
|
442
|
-
const id = await
|
|
501
|
+
const id = await Promise.race([
|
|
502
|
+
this.browser.installExtension(extensionPath),
|
|
503
|
+
new Promise((_, rej) => setTimeout(() => rej(new Error('Timeout installing extension')), 30000)),
|
|
504
|
+
]);
|
|
443
505
|
return id;
|
|
444
506
|
}
|
|
445
507
|
async uninstallExtension(id) {
|
|
446
|
-
await
|
|
508
|
+
await Promise.race([
|
|
509
|
+
this.browser.uninstallExtension(id),
|
|
510
|
+
new Promise((_, rej) => setTimeout(() => rej(new Error('Timeout uninstalling extension')), 30000)),
|
|
511
|
+
]);
|
|
447
512
|
}
|
|
448
513
|
async triggerExtensionAction(id) {
|
|
449
514
|
const extensions = await this.browser.extensions();
|
|
@@ -461,26 +526,38 @@ export class McpContext {
|
|
|
461
526
|
const pptrExtensions = await this.browser.extensions();
|
|
462
527
|
return pptrExtensions.get(id);
|
|
463
528
|
}
|
|
464
|
-
async getHeapSnapshotAggregates(filePath, filterName) {
|
|
465
|
-
return await this.#heapSnapshotManager.getAggregates(filePath, filterName);
|
|
529
|
+
async getHeapSnapshotAggregates(filePath, filterName, objectId) {
|
|
530
|
+
return await this.#heapSnapshotManager.getAggregates(filePath, filterName, objectId);
|
|
466
531
|
}
|
|
467
532
|
async getHeapSnapshotDuplicateStrings(filePath) {
|
|
468
533
|
return await this.#heapSnapshotManager.getDuplicateStrings(filePath);
|
|
469
534
|
}
|
|
535
|
+
async queryHeapSnapshotObjects(filePath, options) {
|
|
536
|
+
return await this.#heapSnapshotManager.queryObjects(filePath, options);
|
|
537
|
+
}
|
|
470
538
|
async getHeapSnapshotStats(filePath) {
|
|
471
539
|
return await this.#heapSnapshotManager.getStats(filePath);
|
|
472
540
|
}
|
|
473
541
|
async getHeapSnapshotStaticData(filePath) {
|
|
474
542
|
return await this.#heapSnapshotManager.getStaticData(filePath);
|
|
475
543
|
}
|
|
476
|
-
async
|
|
477
|
-
return await this.#heapSnapshotManager.
|
|
544
|
+
async getHeapSnapshotNativeContextSizes(filePath) {
|
|
545
|
+
return await this.#heapSnapshotManager.getNativeContextSizes(filePath);
|
|
546
|
+
}
|
|
547
|
+
async getHeapSnapshotRetainedByContextSummary(filePath) {
|
|
548
|
+
return await this.#heapSnapshotManager.getRetainedByContextSummary(filePath);
|
|
549
|
+
}
|
|
550
|
+
async getHeapSnapshotNodesById(filePath, id, filterName, objectId) {
|
|
551
|
+
return await this.#heapSnapshotManager.getNodesById(filePath, id, filterName, objectId);
|
|
478
552
|
}
|
|
479
553
|
async getHeapSnapshotRetainers(filePath, nodeId) {
|
|
480
554
|
return await this.#heapSnapshotManager.getRetainers(filePath, nodeId);
|
|
481
555
|
}
|
|
556
|
+
async getHeapSnapshotObjectDetails(filePath, nodeId) {
|
|
557
|
+
return await this.#heapSnapshotManager.getObjectInfo(filePath, nodeId);
|
|
558
|
+
}
|
|
482
559
|
async closeHeapSnapshot(filePath) {
|
|
483
|
-
return this.#heapSnapshotManager.
|
|
560
|
+
return this.#heapSnapshotManager.disposeSnapshot(filePath);
|
|
484
561
|
}
|
|
485
562
|
hasHeapSnapshots() {
|
|
486
563
|
return this.#heapSnapshotManager.hasSnapshots();
|
|
@@ -528,15 +605,15 @@ export class McpContext {
|
|
|
528
605
|
return response.text();
|
|
529
606
|
}
|
|
530
607
|
case 'file:': {
|
|
531
|
-
await this.validatePath(fileURLToPath(url));
|
|
532
|
-
return await
|
|
608
|
+
const resolved = await this.validatePath(fileURLToPath(url));
|
|
609
|
+
return await fs.readFile(resolved, 'utf-8');
|
|
533
610
|
}
|
|
534
611
|
default:
|
|
535
612
|
throw new Error(`Unsupported protocol for: ${url}`);
|
|
536
613
|
}
|
|
537
614
|
}
|
|
538
|
-
async getHeapSnapshotEdges(filePath, nodeId) {
|
|
539
|
-
return await this.#heapSnapshotManager.getEdges(filePath, nodeId);
|
|
615
|
+
async getHeapSnapshotEdges(filePath, nodeId, options) {
|
|
616
|
+
return await this.#heapSnapshotManager.getEdges(filePath, nodeId, options);
|
|
540
617
|
}
|
|
541
618
|
async getHeapSnapshotClassDiffs(baseFilePath, currentFilePath) {
|
|
542
619
|
return await this.#heapSnapshotManager.getClassDiffs(baseFilePath, currentFilePath);
|