@yezack/chrome-devtools-mcp-108 0.0.0-stage → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/FORK-NOTICE.md +45 -0
  2. package/LICENSE +202 -0
  3. package/README.md +45 -2
  4. package/build/src/BrowserManager.js +401 -0
  5. package/build/src/McpContext.js +642 -0
  6. package/build/src/McpPage.js +850 -0
  7. package/build/src/McpResponse.js +1086 -0
  8. package/build/src/SlimMcpResponse.js +19 -0
  9. package/build/src/TextSnapshot.js +315 -0
  10. package/build/src/ToolHandler.js +322 -0
  11. package/build/src/bin/check-latest-version.js +51 -0
  12. package/build/src/bin/chrome-devtools-mcp-main.js +77 -0
  13. package/build/src/bin/chrome-devtools-mcp.js +23 -0
  14. package/build/src/bin/chrome-devtools.js +222 -0
  15. package/build/src/collectors/PageCollector.js +291 -0
  16. package/build/src/collectors/ServiceWorkerCollector.js +171 -0
  17. package/build/src/config/browser-options.js +125 -0
  18. package/build/src/config/category-options.js +89 -0
  19. package/build/src/config/cli-commands.js +26 -0
  20. package/build/src/config/cli-options.js +1473 -0
  21. package/build/src/config/mcp-options.js +417 -0
  22. package/build/src/daemon/client.js +221 -0
  23. package/build/src/daemon/daemon.js +266 -0
  24. package/build/src/daemon/types.js +7 -0
  25. package/build/src/daemon/utils.js +136 -0
  26. package/build/src/devtools/DevToolsCommentBridge.js +91 -0
  27. package/build/src/devtools/DevtoolsUtils.js +307 -0
  28. package/build/src/devtools/McpHostBindingAdapter.js +165 -0
  29. package/build/src/devtools/issueDescriptions.js +42 -0
  30. package/build/src/formatters/CommentFormatter.js +82 -0
  31. package/build/src/formatters/ConsoleFormatter.js +321 -0
  32. package/build/src/formatters/CssFormatter.js +812 -0
  33. package/build/src/formatters/HeapSnapshotFormatter.js +185 -0
  34. package/build/src/formatters/IssueFormatter.js +193 -0
  35. package/build/src/formatters/NetworkFormatter.js +241 -0
  36. package/build/src/formatters/SnapshotFormatter.js +135 -0
  37. package/build/src/index.js +237 -0
  38. package/build/src/processors/ChunkedTraceParser.js +361 -0
  39. package/build/src/processors/HeapSnapshotManager.js +270 -0
  40. package/build/src/processors/PerformanceTrace.js +132 -0
  41. package/build/src/telemetry/ClearcutLogger.js +242 -0
  42. package/build/src/telemetry/WatchdogClient.js +61 -0
  43. package/build/src/telemetry/errors.js +18 -0
  44. package/build/src/telemetry/flagUtils.js +90 -0
  45. package/build/src/telemetry/metricsRegistry.js +85 -0
  46. package/build/src/telemetry/persistence.js +82 -0
  47. package/build/src/telemetry/transformation.js +233 -0
  48. package/build/src/telemetry/types.js +36 -0
  49. package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
  50. package/build/src/telemetry/watchdog/main.js +128 -0
  51. package/build/src/third_party/THIRD_PARTY_NOTICES +4077 -0
  52. package/build/src/third_party/bundled-packages.json +12 -0
  53. package/build/src/third_party/devtools-formatter-worker.js +15494 -0
  54. package/build/src/third_party/devtools-heap-snapshot-worker.js +10979 -0
  55. package/build/src/third_party/index.js +200978 -0
  56. package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  57. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
  58. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  59. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
  60. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  61. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
  62. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  63. package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
  64. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  65. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  66. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  67. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  68. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  69. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  70. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
  71. package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  72. package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  73. package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  74. package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  75. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  76. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
  77. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
  78. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
  79. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
  80. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
  81. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
  82. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
  83. package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
  84. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
  85. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
  86. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
  87. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
  88. package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
  89. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
  90. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
  91. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
  92. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
  93. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
  94. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
  95. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
  96. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  97. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
  98. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
  99. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  100. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  101. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
  102. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
  103. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
  104. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
  105. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
  106. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
  107. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  108. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
  109. package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
  110. package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
  127. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
  128. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
  129. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
  130. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
  131. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
  132. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
  133. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
  134. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
  135. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
  136. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
  137. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
  138. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
  139. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
  140. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
  141. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
  142. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
  143. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
  144. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
  145. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
  146. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
  147. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
  148. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
  149. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
  150. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
  151. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
  152. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
  153. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
  154. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
  155. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
  156. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
  157. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
  158. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
  159. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
  160. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
  161. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
  162. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
  163. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
  164. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
  165. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
  166. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
  167. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
  168. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  169. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  170. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  171. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  172. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
  173. package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
  174. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  175. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  176. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
  177. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  178. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  179. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  180. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  181. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  182. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  183. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  184. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  185. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  186. package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
  187. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  188. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  189. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  190. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  191. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  192. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  193. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  194. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  195. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  196. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
  197. package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
  198. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
  199. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  200. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
  201. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  202. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  203. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  204. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
  205. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  206. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
  207. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
  208. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
  209. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
  210. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
  211. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
  212. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
  213. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  214. package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
  215. package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
  216. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  217. package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
  218. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
  219. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
  220. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  221. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  222. package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  223. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  224. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
  225. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
  226. package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
  227. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  228. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  229. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
  230. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
  231. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
  232. package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
  233. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
  234. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  235. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  236. package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  237. package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
  238. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
  239. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
  240. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
  241. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
  242. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
  243. package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
  244. package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
  245. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
  246. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
  247. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
  248. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
  249. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
  250. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
  251. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
  252. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
  253. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
  254. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
  255. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
  256. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
  257. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
  258. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
  259. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
  260. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
  261. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
  262. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
  263. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
  264. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
  265. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
  266. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
  267. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
  268. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
  269. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
  270. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
  271. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
  272. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
  273. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
  274. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
  275. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
  276. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
  277. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
  278. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
  279. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
  280. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
  281. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
  282. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
  283. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
  284. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
  285. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
  286. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
  287. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
  288. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
  289. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
  290. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
  291. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
  292. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
  293. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
  294. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
  295. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
  296. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
  297. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
  298. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
  299. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
  300. package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
  301. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
  302. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
  303. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
  304. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
  305. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
  306. package/build/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
  307. package/build/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  308. package/build/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  309. package/build/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
  310. package/build/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
  311. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +58435 -0
  312. package/build/src/tools/ToolDefinition.js +80 -0
  313. package/build/src/tools/categories.js +33 -0
  314. package/build/src/tools/comments.js +169 -0
  315. package/build/src/tools/console.js +104 -0
  316. package/build/src/tools/css.js +45 -0
  317. package/build/src/tools/emulation.js +84 -0
  318. package/build/src/tools/extensions.js +103 -0
  319. package/build/src/tools/input.js +652 -0
  320. package/build/src/tools/lighthouse.js +149 -0
  321. package/build/src/tools/memory.js +424 -0
  322. package/build/src/tools/network.js +128 -0
  323. package/build/src/tools/pages.js +363 -0
  324. package/build/src/tools/performance.js +212 -0
  325. package/build/src/tools/pwa.js +128 -0
  326. package/build/src/tools/screencast.js +119 -0
  327. package/build/src/tools/screenshot.js +277 -0
  328. package/build/src/tools/script.js +232 -0
  329. package/build/src/tools/slim/tools.js +96 -0
  330. package/build/src/tools/snapshot.js +63 -0
  331. package/build/src/tools/thirdPartyDeveloper.js +85 -0
  332. package/build/src/tools/tools.js +55 -0
  333. package/build/src/tools/webmcp.js +66 -0
  334. package/build/src/types.js +10 -0
  335. package/build/src/utils/WaitForHelper.js +316 -0
  336. package/build/src/utils/bytes.js +105 -0
  337. package/build/src/utils/check-for-updates.js +75 -0
  338. package/build/src/utils/files.js +57 -0
  339. package/build/src/utils/id.js +16 -0
  340. package/build/src/utils/keyboard.js +297 -0
  341. package/build/src/utils/logger.js +52 -0
  342. package/build/src/utils/pagination.js +50 -0
  343. package/build/src/utils/polyfill.js +11 -0
  344. package/build/src/utils/url.js +116 -0
  345. package/build/src/version.js +10 -0
  346. package/package.json +41 -4
  347. package/skills/a11y-debugging/SKILL.md +91 -0
  348. package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
  349. package/skills/chrome-devtools/SKILL.md +74 -0
  350. package/skills/chrome-devtools-cli/SKILL.md +194 -0
  351. package/skills/chrome-devtools-cli/references/installation.md +14 -0
  352. package/skills/cookie-debugging/SKILL.md +149 -0
  353. package/skills/debug-optimize-lcp/SKILL.md +121 -0
  354. package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
  355. package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
  356. package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
  357. package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
  358. package/skills/memory-leak-debugging/SKILL.md +58 -0
  359. package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
  360. package/skills/troubleshooting/SKILL.md +99 -0
@@ -0,0 +1,417 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { yargs, hideBin } from '../third_party/index.js';
7
+ import os from 'node:os';
8
+ import { readFileSync } from 'node:fs';
9
+ export const DEFAULT_FILESYSTEM_ROOT = [os.tmpdir()];
10
+ import { getCategoryOptions } from './category-options.js';
11
+ import { getBrowserOptions } from './browser-options.js';
12
+ export const mcpOptions = {
13
+ ...getCategoryOptions(),
14
+ ...getBrowserOptions(),
15
+ logFile: {
16
+ type: 'string',
17
+ describe: 'Path to a file to write debug logs to. Set the env variable `NODE_DEBUG` to `*` to enable verbose logs. Useful for submitting bug reports.',
18
+ },
19
+ viewport: {
20
+ type: 'string',
21
+ describe: 'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',
22
+ coerce: (arg) => {
23
+ if (arg === undefined) {
24
+ return;
25
+ }
26
+ const [width, height] = arg.split('x').map(Number);
27
+ if (!width || !height || Number.isNaN(width) || Number.isNaN(height)) {
28
+ throw new Error('Invalid viewport. Expected format is `1280x720`.');
29
+ }
30
+ return {
31
+ width,
32
+ height,
33
+ };
34
+ },
35
+ },
36
+ acceptInsecureCerts: {
37
+ type: 'boolean',
38
+ description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,
39
+ },
40
+ pageIdRouting: {
41
+ type: 'boolean',
42
+ describe: 'Require pageId on page-scoped tools and route requests by page ID (useful for concurrent agent sessions). Use --no-page-id-routing to disable.',
43
+ default: true,
44
+ },
45
+ devtoolsComments: {
46
+ type: 'boolean',
47
+ describe: 'Whether to enable DevTools comments tools. Internal WIP feature.',
48
+ hidden: true,
49
+ default: false,
50
+ },
51
+ experimentalDevtools: {
52
+ type: 'boolean',
53
+ describe: 'Whether to enable automation over DevTools targets',
54
+ },
55
+ experimentalVision: {
56
+ type: 'boolean',
57
+ describe: 'Whether to enable coordinate-based tools such as click_at(x,y). Usually requires a computer-use model able to produce accurate coordinates by looking at screenshots.',
58
+ },
59
+ memoryDebugging: {
60
+ type: 'boolean',
61
+ default: false,
62
+ describe: 'Whether to enable memory debugging tools.',
63
+ alias: 'experimentalMemory',
64
+ },
65
+ experimentalStructuredContent: {
66
+ type: 'boolean',
67
+ default: false,
68
+ describe: 'Whether to output structured formatted content.',
69
+ },
70
+ experimentalToonFormat: {
71
+ type: 'boolean',
72
+ describe: 'Deprecated: use --experimentalDataFormat=toon instead. Whether to format structured data using TOON (requires @toon-format/toon).',
73
+ hidden: true,
74
+ },
75
+ experimentalDataFormat: {
76
+ type: 'string',
77
+ describe: 'Override format for structured data in text responses. Default uses built-in formatters. "toon" (requires @toon-format/toon) or "gcf" (requires @blackwell-systems/gcf) replace structured content with the specified encoding.',
78
+ choices: ['default', 'toon', 'gcf'],
79
+ hidden: true,
80
+ },
81
+ experimentalIncludeAllPages: {
82
+ type: 'boolean',
83
+ describe: 'Whether to include all kinds of pages such as webviews or background pages as pages.',
84
+ },
85
+ experimentalInteropTools: {
86
+ type: 'boolean',
87
+ describe: 'Whether to enable interoperability tools',
88
+ hidden: true,
89
+ },
90
+ experimentalScreencast: {
91
+ type: 'boolean',
92
+ describe: 'Exposes experimental screencast tools (requires ffmpeg). Install ffmpeg https://www.ffmpeg.org/download.html and ensure it is available in the MCP server PATH.',
93
+ },
94
+ experimentalFfmpegPath: {
95
+ type: 'string',
96
+ describe: 'Path to ffmpeg executable for screencast recording.',
97
+ implies: 'experimentalScreencast',
98
+ },
99
+ experimentalScreencastFps: {
100
+ type: 'number',
101
+ describe: 'Frames per second to use for screencast recording. Lower values can reduce memory pressure on pages that produce frames faster than ffmpeg can encode them.',
102
+ implies: 'experimentalScreencast',
103
+ coerce: (value) => {
104
+ if (value === undefined) {
105
+ return;
106
+ }
107
+ if (!Number.isInteger(value) || value <= 0) {
108
+ throw new Error(`Invalid experimentalScreencastFps ${value}. Expected a positive integer.`);
109
+ }
110
+ return value;
111
+ },
112
+ },
113
+ blockedUrlPattern: {
114
+ type: 'array',
115
+ string: true,
116
+ describe: "Restricts browser's network access by blocking specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Silently detaches from targets with blocked URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.",
117
+ conflicts: ['allowedUrlPattern'],
118
+ },
119
+ allowedUrlPattern: {
120
+ type: 'array',
121
+ string: true,
122
+ describe: "Restricts browser's network access by allowing only specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Requires Chrome 149+. Silently detaches from targets with unallowed URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.",
123
+ conflicts: ['blockedUrlPattern'],
124
+ },
125
+ performanceCrux: {
126
+ type: 'boolean',
127
+ default: true,
128
+ describe: 'Set to false to disable sending URLs from performance traces to CrUX API to get field performance data.',
129
+ },
130
+ usageStatistics: {
131
+ type: 'boolean',
132
+ default: true,
133
+ describe: 'Set to false to opt-out of usage statistics collection. Google collects usage data to improve the tool, handled under the Google Privacy Policy (https://policies.google.com/privacy). This is independent from Chrome browser metrics. Disabled if `CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS` or `CI` env variables are set.',
134
+ },
135
+ javascriptEvaluation: {
136
+ type: 'boolean',
137
+ default: true,
138
+ describe: 'Set to false to disable JavaScript execution. When disabled, evaluation tools (evaluate_script and slim evaluate) are disabled, the initScript parameter in navigate_page is turned off, and navigating to javascript:, data:, or vbscript: URLs is disallowed.',
139
+ },
140
+ sourceMaps: {
141
+ type: 'boolean',
142
+ default: true,
143
+ describe: 'Whether to enable source maps in DevTools. Use --no-source-maps to disable.',
144
+ },
145
+ clearcutEndpoint: {
146
+ type: 'string',
147
+ hidden: true,
148
+ describe: 'Endpoint for Clearcut telemetry.',
149
+ },
150
+ clearcutForceFlushIntervalMs: {
151
+ type: 'number',
152
+ hidden: true,
153
+ describe: 'Force flush interval in milliseconds (for testing).',
154
+ },
155
+ clearcutIncludePidHeader: {
156
+ type: 'boolean',
157
+ hidden: true,
158
+ describe: 'Include watchdog PID in Clearcut request headers (for testing).',
159
+ },
160
+ screenshotFormat: {
161
+ type: 'string',
162
+ description: 'Override the default output format used by take_screenshot when the caller does not specify one. JPEG and WebP are ~3-5x smaller than PNG, which reduces transfer and storage size. To reduce context size use --screenshotMaxWidth / --screenshotMaxHeight, since image tokens scale with dimensions rather than encoded bytes. Unset preserves the existing default ("png").',
163
+ choices: ['jpeg', 'png', 'webp'],
164
+ },
165
+ screenshotQuality: {
166
+ type: 'number',
167
+ description: 'Override the default compression quality (0-100) used by take_screenshot for JPEG and WebP when the caller does not specify one. Lower values mean smaller files. Ignored for PNG. Unset preserves the Puppeteer default.',
168
+ coerce: (value) => {
169
+ if (value === undefined) {
170
+ return;
171
+ }
172
+ if (!Number.isInteger(value) || value < 0 || value > 100) {
173
+ throw new Error(`Invalid screenshotQuality ${value}. Expected an integer between 0 and 100.`);
174
+ }
175
+ return value;
176
+ },
177
+ },
178
+ screenshotMaxWidth: {
179
+ type: 'number',
180
+ description: 'Maximum width in pixels for screenshots. If the captured image is wider, it is downscaled (preserving aspect ratio) before being returned. Reduces context size in AI conversations. Unset means no resize.',
181
+ coerce: (value) => {
182
+ if (value === undefined) {
183
+ return;
184
+ }
185
+ if (!Number.isInteger(value) || value <= 0) {
186
+ throw new Error(`Invalid screenshotMaxWidth ${value}. Expected a positive integer.`);
187
+ }
188
+ return value;
189
+ },
190
+ },
191
+ screenshotMaxHeight: {
192
+ type: 'number',
193
+ description: 'Maximum height in pixels for screenshots. If the captured image is taller, it is downscaled (preserving aspect ratio) before being returned. Can be combined with --screenshot-max-width; the smaller scale factor wins. Unset means no resize.',
194
+ coerce: (value) => {
195
+ if (value === undefined) {
196
+ return;
197
+ }
198
+ if (!Number.isInteger(value) || value <= 0) {
199
+ throw new Error(`Invalid screenshotMaxHeight ${value}. Expected a positive integer.`);
200
+ }
201
+ return value;
202
+ },
203
+ },
204
+ slim: {
205
+ type: 'boolean',
206
+ describe: 'Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.',
207
+ },
208
+ viaCli: {
209
+ type: 'boolean',
210
+ describe: 'Set by Chrome DevTools CLI if the MCP server is started via the CLI client (this arg exists for usage stats)',
211
+ hidden: true,
212
+ },
213
+ redactNetworkHeaders: {
214
+ type: 'boolean',
215
+ describe: 'If true, redacts some of the network headers considered sensitive before returning to the client.',
216
+ default: false,
217
+ },
218
+ allowUnrestrictedPaths: {
219
+ type: 'boolean',
220
+ default: false,
221
+ deprecated: 'Use --workspace=/ instead.',
222
+ describe: 'If set, disables the default path restriction that applies when the MCP client does not negotiate ' +
223
+ 'the roots capability. By default, file-writing tools are restricted to the OS temp directory when ' +
224
+ 'no roots are configured. Use this only when connecting a trusted local client that does not implement ' +
225
+ 'MCP roots and requires access to paths outside the temp directory.',
226
+ },
227
+ filesystemRoot: {
228
+ type: 'array',
229
+ string: true,
230
+ alias: 'workspace',
231
+ default: DEFAULT_FILESYSTEM_ROOT,
232
+ defaultDescription: 'OS temp directory',
233
+ describe: 'A directory that filesystem tools are allowed to access. May be specified more than once.',
234
+ },
235
+ config: {
236
+ type: 'string',
237
+ describe: 'Path to JSON configuration file.',
238
+ },
239
+ };
240
+ export function getMcpOptionsForViaCli() {
241
+ if (!('default' in mcpOptions.headless)) {
242
+ throw new Error('headless cli option unexpectedly does not have a default');
243
+ }
244
+ if (!('default' in mcpOptions.experimentalStructuredContent)) {
245
+ throw new Error('experimentalStructuredContent cli option unexpectedly does not have a default');
246
+ }
247
+ if ('default' in mcpOptions.isolated) {
248
+ throw new Error('isolated cli option unexpectedly has a default');
249
+ }
250
+ return {
251
+ ...mcpOptions,
252
+ headless: {
253
+ ...mcpOptions.headless,
254
+ default: true,
255
+ },
256
+ memoryDebugging: {
257
+ ...mcpOptions.memoryDebugging,
258
+ default: true,
259
+ },
260
+ categoryExtensions: {
261
+ ...mcpOptions.categoryExtensions,
262
+ default: true,
263
+ },
264
+ experimentalStructuredContent: {
265
+ ...mcpOptions.experimentalStructuredContent,
266
+ default: true,
267
+ },
268
+ isolated: {
269
+ ...mcpOptions.isolated,
270
+ description: 'If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. Defaults to true unless userDataDir is provided.',
271
+ },
272
+ };
273
+ }
274
+ /**
275
+ * Exported only for testing to not trigger process exit.
276
+ */
277
+ export function parser(version, argv = process.argv, env = process.env) {
278
+ const isViaCli = argv.includes('--viaCli') || argv.includes('--via-cli');
279
+ const options = isViaCli ? getMcpOptionsForViaCli() : mcpOptions;
280
+ const yargsInstance = yargs(hideBin(argv))
281
+ .scriptName('npx chrome-devtools-mcp@latest')
282
+ .parserConfiguration({
283
+ 'strip-aliased': true,
284
+ 'strip-dashed': true,
285
+ })
286
+ .options(options)
287
+ .showHelpOnFail(false, 'Specify --help for available options')
288
+ .middleware(args => {
289
+ if (isViaCli && args.filesystemRoot === DEFAULT_FILESYSTEM_ROOT) {
290
+ const cliFilesystemArgs = args;
291
+ cliFilesystemArgs.allowUnrestrictedPaths = true;
292
+ cliFilesystemArgs.filesystemRoot = undefined;
293
+ }
294
+ // We can't set default in the options else
295
+ // Yargs will complain
296
+ if (!args.channel &&
297
+ !args.browserUrl &&
298
+ !args.wsEndpoint &&
299
+ !args.executablePath) {
300
+ args.channel = 'stable';
301
+ }
302
+ if (env['CI'] || env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']) {
303
+ console.error("turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.");
304
+ args.usageStatistics = false;
305
+ }
306
+ const cliOptionsAllowedArgs = [
307
+ ...Object.keys(options),
308
+ // Yargs populated with positional args
309
+ '_',
310
+ '$0',
311
+ ];
312
+ const unknownArgs = Object.keys(args).filter(arg => !cliOptionsAllowedArgs.includes(arg));
313
+ if (unknownArgs.length > 0) {
314
+ console.error(`Unknown arguments: ${unknownArgs.map(arg => `--${arg}`)}`);
315
+ }
316
+ })
317
+ .example([
318
+ [
319
+ '$0 --browserUrl http://127.0.0.1:9222',
320
+ 'Connect to an existing browser instance via HTTP',
321
+ ],
322
+ [
323
+ '$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123',
324
+ 'Connect to an existing browser instance via WebSocket',
325
+ ],
326
+ [
327
+ `$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123 --wsHeaders '{"Authorization":"Bearer token"}'`,
328
+ 'Connect via WebSocket with custom headers',
329
+ ],
330
+ ['$0 --channel beta', 'Use Chrome Beta installed on this system'],
331
+ ['$0 --channel canary', 'Use Chrome Canary installed on this system'],
332
+ ['$0 --channel dev', 'Use Chrome Dev installed on this system'],
333
+ ['$0 --channel stable', 'Use stable Chrome installed on this system'],
334
+ ['$0 --logFile /tmp/log.txt', 'Save logs to a file'],
335
+ ['$0 --help', 'Print CLI options'],
336
+ [
337
+ '$0 --viewport 1280x720',
338
+ 'Launch Chrome with the initial viewport size of 1280x720px',
339
+ ],
340
+ [
341
+ `$0 --chrome-arg='--no-sandbox' --chrome-arg='--disable-setuid-sandbox'`,
342
+ 'Launch Chrome without sandboxes. Use with caution.',
343
+ ],
344
+ [
345
+ `$0 --ignore-default-chrome-arg='--disable-extensions'`,
346
+ 'Disable the default arguments provided by Puppeteer. Use with caution.',
347
+ ],
348
+ ['$0 --no-category-emulation', 'Disable tools in the emulation category'],
349
+ [
350
+ '$0 --no-category-performance',
351
+ 'Disable tools in the performance category',
352
+ ],
353
+ ['$0 --no-category-network', 'Disable tools in the network category'],
354
+ [
355
+ '$0 --user-data-dir=/tmp/user-data-dir',
356
+ 'Use a custom user data directory',
357
+ ],
358
+ [
359
+ '$0 --auto-connect',
360
+ 'Connect to a stable Chrome instance (Chrome 144+) running instead of launching a new instance',
361
+ ],
362
+ [
363
+ '$0 --auto-connect --channel=canary',
364
+ 'Connect to a canary Chrome instance (Chrome 144+) running instead of launching a new instance',
365
+ ],
366
+ [
367
+ '$0 --no-usage-statistics',
368
+ 'Do not send usage statistics https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics.',
369
+ ],
370
+ [
371
+ '$0 --no-performance-crux',
372
+ 'Disable CrUX (field data) integration in performance tools.',
373
+ ],
374
+ ['$0 --no-source-maps', 'Disable source maps in DevTools.'],
375
+ [
376
+ '$0 --no-javascript-evaluation',
377
+ 'Disable JavaScript execution (disables evaluation tools, initScript in navigate_page, and navigating to javascript:, data:, or vbscript: URLs).',
378
+ ],
379
+ [
380
+ '$0 --slim',
381
+ 'Only 3 tools: navigation, JavaScript execution and screenshot',
382
+ ],
383
+ ]);
384
+ return yargsInstance
385
+ .config('config', 'Path to JSON configuration file', configPath => {
386
+ try {
387
+ const parsed = JSON.parse(readFileSync(configPath, 'utf-8'));
388
+ if (typeof parsed !== 'object' ||
389
+ parsed === null ||
390
+ Array.isArray(parsed)) {
391
+ throw new Error('Config must be a JSON object');
392
+ }
393
+ yargs()
394
+ .parserConfiguration({
395
+ 'strip-aliased': true,
396
+ 'camel-case-expansion': false,
397
+ })
398
+ .options(options)
399
+ .config(parsed)
400
+ .strict()
401
+ .fail(false)
402
+ .exitProcess(false)
403
+ .parseSync([]);
404
+ return parsed;
405
+ }
406
+ catch (err) {
407
+ throw new Error(`Invalid JSON config file: ${err.message}`);
408
+ }
409
+ })
410
+ .wrap(Math.min(120, yargsInstance.terminalWidth()))
411
+ .help()
412
+ .version(version);
413
+ }
414
+ export function parseArguments(version, argv = process.argv, env = process.env) {
415
+ return parser(version, argv, env).parseSync();
416
+ }
417
+ //# sourceMappingURL=mcp-options.js.map
@@ -0,0 +1,221 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { spawn } from 'node:child_process';
7
+ import fs from 'node:fs';
8
+ import net from 'node:net';
9
+ import { PipeTransport } from '../third_party/index.js';
10
+ import { getTempFilePath } from '../utils/files.js';
11
+ import { logger, puppeteerLogger } from '../utils/logger.js';
12
+ import { DAEMON_SCRIPT_PATH, getSocketPath, getPidFilePath, isDaemonRunning, } from './utils.js';
13
+ const FILE_TIMEOUT = 10_000;
14
+ const READY_CHECK_INTERVAL = 100;
15
+ const READY_CHECK_COMMAND_TIMEOUT = 1_000;
16
+ /**
17
+ * Waits for a file to be created and populated (removed = false) or removed (removed = true).
18
+ */
19
+ function waitForFile(filePath, removed = false) {
20
+ return new Promise((resolve, reject) => {
21
+ const check = () => {
22
+ const exists = fs.existsSync(filePath);
23
+ if (removed) {
24
+ return !exists;
25
+ }
26
+ if (!exists) {
27
+ return false;
28
+ }
29
+ try {
30
+ return fs.statSync(filePath).size > 0;
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ };
36
+ if (check()) {
37
+ resolve();
38
+ return;
39
+ }
40
+ const timer = setTimeout(() => {
41
+ fs.unwatchFile(filePath);
42
+ reject(new Error(`Timeout: file ${filePath} ${removed ? 'not removed' : 'not found'} within ${FILE_TIMEOUT}ms`));
43
+ }, FILE_TIMEOUT);
44
+ fs.watchFile(filePath, { interval: 500 }, () => {
45
+ if (check()) {
46
+ clearTimeout(timer);
47
+ fs.unwatchFile(filePath);
48
+ resolve();
49
+ }
50
+ });
51
+ });
52
+ }
53
+ function delay(ms) {
54
+ return new Promise(resolve => {
55
+ setTimeout(resolve, ms);
56
+ });
57
+ }
58
+ async function waitForDaemonReady(sessionId) {
59
+ const deadline = Date.now() + FILE_TIMEOUT;
60
+ let lastError;
61
+ while (Date.now() < deadline) {
62
+ try {
63
+ const response = await sendCommand({ method: 'status' }, sessionId, READY_CHECK_COMMAND_TIMEOUT);
64
+ if (response.success) {
65
+ return;
66
+ }
67
+ lastError = new Error(String(response.error));
68
+ }
69
+ catch (error) {
70
+ lastError = error;
71
+ }
72
+ const timeLeft = deadline - Date.now();
73
+ if (timeLeft > 0) {
74
+ await delay(Math.min(READY_CHECK_INTERVAL, timeLeft));
75
+ }
76
+ }
77
+ throw new Error(`Timeout: daemon not ready within ${FILE_TIMEOUT}ms`, lastError === undefined ? undefined : { cause: lastError });
78
+ }
79
+ export async function startDaemon(mcpArgs = [], sessionId) {
80
+ if (isDaemonRunning(sessionId)) {
81
+ logger?.('Daemon is already running');
82
+ await waitForDaemonReady(sessionId);
83
+ return;
84
+ }
85
+ const pidFilePath = getPidFilePath(sessionId);
86
+ if (fs.existsSync(pidFilePath)) {
87
+ fs.unlinkSync(pidFilePath);
88
+ }
89
+ logger?.('Starting daemon...', ...mcpArgs);
90
+ const child = spawn(process.execPath, [DAEMON_SCRIPT_PATH, ...mcpArgs], {
91
+ detached: true,
92
+ stdio: 'ignore',
93
+ env: { ...process.env, CHROME_DEVTOOLS_MCP_SESSION_ID: sessionId },
94
+ cwd: process.cwd(),
95
+ windowsHide: true,
96
+ });
97
+ child.unref();
98
+ await waitForFile(pidFilePath);
99
+ await waitForDaemonReady(sessionId);
100
+ }
101
+ const SEND_COMMAND_TIMEOUT = 60_000; // ms
102
+ /**
103
+ * `sendCommand` opens a socket connection sends a single command and disconnects.
104
+ */
105
+ export async function sendCommand(command, sessionId, timeout = SEND_COMMAND_TIMEOUT) {
106
+ // Before connecting and sending, verify the daemon is still alive.
107
+ if (!isDaemonRunning(sessionId)) {
108
+ throw new Error('Daemon is not running.');
109
+ }
110
+ const socketPath = getSocketPath(sessionId);
111
+ const socket = net.createConnection({
112
+ path: socketPath,
113
+ });
114
+ return new Promise((resolve, reject) => {
115
+ const timer = setTimeout(() => {
116
+ socket.destroy();
117
+ reject(new Error('Timeout waiting for daemon response'));
118
+ }, timeout);
119
+ const transport = new PipeTransport(socket, socket, puppeteerLogger);
120
+ transport.onmessage = async (message) => {
121
+ clearTimeout(timer);
122
+ logger?.('onmessage', message);
123
+ resolve(JSON.parse(message));
124
+ };
125
+ socket.on('error', error => {
126
+ clearTimeout(timer);
127
+ logger?.('Socket error:', error);
128
+ reject(error);
129
+ });
130
+ socket.on('close', () => {
131
+ clearTimeout(timer);
132
+ logger?.('Socket closed:');
133
+ reject(new Error('Socket closed'));
134
+ });
135
+ logger?.('Sending message', command);
136
+ transport.send(JSON.stringify(command));
137
+ });
138
+ }
139
+ export async function stopDaemon(sessionId) {
140
+ if (!isDaemonRunning(sessionId)) {
141
+ logger?.('Daemon is not running');
142
+ return;
143
+ }
144
+ const pidFilePath = getPidFilePath(sessionId);
145
+ await sendCommand({ method: 'stop' }, sessionId);
146
+ await waitForFile(pidFilePath, /*removed=*/ true);
147
+ }
148
+ export async function verifyDaemonVersion(sessionId, cliVersion) {
149
+ if (!isDaemonRunning(sessionId)) {
150
+ return undefined;
151
+ }
152
+ try {
153
+ const response = await sendCommand({ method: 'status' }, sessionId);
154
+ if (response.success) {
155
+ const data = JSON.parse(response.result);
156
+ if (data?.version && data.version !== cliVersion) {
157
+ return `Warning: Daemon server version (${data.version}) does not match CLI version (${cliVersion}). Run 'chrome-devtools start' to update and restart the daemon.`;
158
+ }
159
+ }
160
+ }
161
+ catch {
162
+ // Suppress communication failures during check; command execution handles unreachable daemon errors.
163
+ }
164
+ return undefined;
165
+ }
166
+ export async function handleResponse(response, format) {
167
+ if (response.isError) {
168
+ if (format === 'md') {
169
+ const chunks = [];
170
+ for (const content of response.content) {
171
+ if (content.type === 'text') {
172
+ chunks.push(content.text);
173
+ }
174
+ }
175
+ return chunks.join(' ');
176
+ }
177
+ return JSON.stringify(response.content);
178
+ }
179
+ const chunks = [];
180
+ const images = [];
181
+ for (const content of response.content) {
182
+ if (content.type === 'text') {
183
+ chunks.push(content.text);
184
+ }
185
+ else if (content.type === 'image') {
186
+ const imageData = content.data;
187
+ const mimeType = content.mimeType;
188
+ let extension = '.png';
189
+ switch (mimeType) {
190
+ case 'image/jpg':
191
+ case 'image/jpeg':
192
+ extension = '.jpeg';
193
+ break;
194
+ case 'image/webp':
195
+ extension = '.webp';
196
+ break;
197
+ }
198
+ const data = Buffer.from(imageData, 'base64');
199
+ const name = crypto.randomUUID();
200
+ const filepath = await getTempFilePath(`${name}${extension}`);
201
+ fs.writeFileSync(filepath, data);
202
+ images.push({ filePath: filepath, mimeType });
203
+ chunks.push(`Saved to ${filepath}.`);
204
+ }
205
+ else {
206
+ throw new Error('Not supported response content type');
207
+ }
208
+ }
209
+ if (format === 'json') {
210
+ if (response.structuredContent) {
211
+ const structuredContent = {
212
+ ...response.structuredContent,
213
+ ...(images.length ? { images } : {}),
214
+ };
215
+ return JSON.stringify(structuredContent);
216
+ }
217
+ // Fall-through to text for backward compatibility.
218
+ }
219
+ return format === 'md' ? chunks.join(' ') : JSON.stringify(chunks);
220
+ }
221
+ //# sourceMappingURL=client.js.map