@vibebrowser/chrome-devtools-mcp 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +873 -0
  3. package/build/src/DevToolsConnectionAdapter.js +70 -0
  4. package/build/src/DevtoolsUtils.js +295 -0
  5. package/build/src/HeapSnapshotManager.js +110 -0
  6. package/build/src/McpContext.js +605 -0
  7. package/build/src/McpPage.js +315 -0
  8. package/build/src/McpResponse.js +858 -0
  9. package/build/src/Mutex.js +38 -0
  10. package/build/src/PageCollector.js +297 -0
  11. package/build/src/SlimMcpResponse.js +19 -0
  12. package/build/src/TextSnapshot.js +236 -0
  13. package/build/src/ToolHandler.js +217 -0
  14. package/build/src/WaitForHelper.js +190 -0
  15. package/build/src/bin/check-latest-version.js +50 -0
  16. package/build/src/bin/chrome-devtools-cli-options.js +840 -0
  17. package/build/src/bin/chrome-devtools-mcp-cli-options.js +350 -0
  18. package/build/src/bin/chrome-devtools-mcp-main.js +94 -0
  19. package/build/src/bin/chrome-devtools-mcp.js +31 -0
  20. package/build/src/bin/chrome-devtools.js +189 -0
  21. package/build/src/bin/install-service.js +246 -0
  22. package/build/src/bin/service/chrome-devtools-mcp.service.template +17 -0
  23. package/build/src/bin/service/com.vibebrowser.chrome-devtools-mcp.plist.template +37 -0
  24. package/build/src/browser.js +204 -0
  25. package/build/src/daemon/client.js +154 -0
  26. package/build/src/daemon/daemon.js +204 -0
  27. package/build/src/daemon/types.js +7 -0
  28. package/build/src/daemon/utils.js +115 -0
  29. package/build/src/formatters/ConsoleFormatter.js +288 -0
  30. package/build/src/formatters/HeapSnapshotFormatter.js +54 -0
  31. package/build/src/formatters/IssueFormatter.js +193 -0
  32. package/build/src/formatters/NetworkFormatter.js +236 -0
  33. package/build/src/formatters/SnapshotFormatter.js +135 -0
  34. package/build/src/index.js +140 -0
  35. package/build/src/issue-descriptions.js +40 -0
  36. package/build/src/logger.js +37 -0
  37. package/build/src/polyfill.js +8 -0
  38. package/build/src/telemetry/ClearcutLogger.js +169 -0
  39. package/build/src/telemetry/WatchdogClient.js +61 -0
  40. package/build/src/telemetry/errors.js +18 -0
  41. package/build/src/telemetry/flagUtils.js +89 -0
  42. package/build/src/telemetry/metricsRegistry.js +89 -0
  43. package/build/src/telemetry/persistence.js +72 -0
  44. package/build/src/telemetry/transformation.js +134 -0
  45. package/build/src/telemetry/types.js +31 -0
  46. package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
  47. package/build/src/telemetry/watchdog/main.js +128 -0
  48. package/build/src/third_party/devtools-formatter-worker.js +8 -0
  49. package/build/src/third_party/devtools-heap-snapshot-worker.js +8 -0
  50. package/build/src/third_party/index.js +32 -0
  51. package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  52. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
  53. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  54. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
  55. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  56. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
  57. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  58. package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
  59. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
  60. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
  61. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
  62. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  63. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  64. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  65. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  66. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  67. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  68. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
  69. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
  70. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
  71. package/build/src/third_party/issue-descriptions/arInsecureContext.md +7 -0
  72. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +5 -0
  73. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
  74. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
  75. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +5 -0
  76. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +5 -0
  77. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +5 -0
  78. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +6 -0
  79. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +5 -0
  80. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +5 -0
  81. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +5 -0
  82. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +5 -0
  83. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +4 -0
  84. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +18 -0
  85. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +19 -0
  86. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +8 -0
  87. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +9 -0
  88. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +13 -0
  89. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +12 -0
  90. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +10 -0
  91. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +11 -0
  92. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
  93. package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  94. package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  95. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
  96. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
  97. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
  98. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
  99. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
  100. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
  101. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
  102. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +4 -0
  103. package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
  104. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
  105. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
  106. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
  107. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
  108. package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
  109. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
  110. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
  111. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
  112. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
  113. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
  114. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
  115. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
  116. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  117. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
  118. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
  119. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  120. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  121. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
  122. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
  123. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
  124. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +8 -0
  125. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
  126. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
  127. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  128. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
  129. package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
  130. package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
  131. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  132. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  133. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  134. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  135. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
  136. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  143. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  144. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  145. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  146. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  147. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  148. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  149. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  150. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  151. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  152. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  153. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  154. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  155. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  156. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
  157. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
  158. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  159. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
  160. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  161. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  162. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  163. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
  164. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  165. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
  166. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
  167. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
  168. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
  169. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
  170. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
  171. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
  172. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  173. package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
  174. package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
  175. package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
  176. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
  177. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
  178. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  179. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  180. package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  181. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  182. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
  183. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
  184. package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
  185. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  186. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  187. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
  188. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
  189. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
  190. package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
  191. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
  192. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  193. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  194. package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  195. package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
  196. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
  197. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
  198. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
  199. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
  200. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
  201. package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
  202. package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
  203. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
  204. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
  205. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
  206. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
  207. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
  208. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
  209. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
  210. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
  211. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
  212. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
  213. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
  214. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
  215. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
  216. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
  217. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
  218. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
  219. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
  220. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
  221. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
  222. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
  223. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
  224. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
  225. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
  226. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
  227. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
  228. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
  229. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
  230. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
  231. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
  232. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
  233. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
  234. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
  235. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
  236. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
  237. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
  238. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
  239. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
  240. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
  241. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
  242. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
  243. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
  244. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
  245. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
  246. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
  247. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
  248. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
  249. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
  250. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
  251. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
  252. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
  253. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
  254. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
  255. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
  256. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
  257. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
  258. package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
  259. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
  260. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
  261. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
  262. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
  263. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
  264. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +61598 -0
  265. package/build/src/tools/ToolDefinition.js +73 -0
  266. package/build/src/tools/categories.js +36 -0
  267. package/build/src/tools/console.js +91 -0
  268. package/build/src/tools/emulation.js +57 -0
  269. package/build/src/tools/extensions.js +96 -0
  270. package/build/src/tools/input.js +461 -0
  271. package/build/src/tools/lighthouse.js +131 -0
  272. package/build/src/tools/memory.js +106 -0
  273. package/build/src/tools/network.js +125 -0
  274. package/build/src/tools/pages.js +411 -0
  275. package/build/src/tools/performance.js +196 -0
  276. package/build/src/tools/screencast.js +95 -0
  277. package/build/src/tools/screenshot.js +87 -0
  278. package/build/src/tools/script.js +151 -0
  279. package/build/src/tools/slim/tools.js +85 -0
  280. package/build/src/tools/snapshot.js +60 -0
  281. package/build/src/tools/thirdPartyDeveloper.js +75 -0
  282. package/build/src/tools/tools.js +56 -0
  283. package/build/src/tools/webmcp.js +64 -0
  284. package/build/src/trace-processing/parse.js +85 -0
  285. package/build/src/types.js +7 -0
  286. package/build/src/utils/check-for-updates.js +74 -0
  287. package/build/src/utils/files.js +18 -0
  288. package/build/src/utils/id.js +16 -0
  289. package/build/src/utils/keyboard.js +297 -0
  290. package/build/src/utils/pagination.js +50 -0
  291. package/build/src/utils/string.js +37 -0
  292. package/build/src/utils/types.js +7 -0
  293. package/build/src/version.js +10 -0
  294. package/package.json +93 -0
@@ -0,0 +1,350 @@
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
+ export const cliOptions = {
8
+ autoConnect: {
9
+ type: 'boolean',
10
+ description: 'If specified, automatically connects to a browser (Chrome 144+) running locally from the user data directory identified by the channel param (default channel is stable). Requires the remote debugging server to be started in the Chrome instance via chrome://inspect/#remote-debugging.',
11
+ conflicts: ['isolated', 'executablePath'],
12
+ default: false,
13
+ coerce: (value) => {
14
+ if (!value) {
15
+ return;
16
+ }
17
+ return value;
18
+ },
19
+ },
20
+ browserUrl: {
21
+ type: 'string',
22
+ description: 'Connect to a running, debuggable Chrome instance (e.g. `http://127.0.0.1:9222`). For more details see: https://github.com/ChromeDevTools/chrome-devtools-mcp#connecting-to-a-running-chrome-instance.',
23
+ alias: 'u',
24
+ conflicts: ['wsEndpoint'],
25
+ coerce: (url) => {
26
+ if (!url) {
27
+ return;
28
+ }
29
+ try {
30
+ new URL(url);
31
+ }
32
+ catch {
33
+ throw new Error(`Provided browserUrl ${url} is not valid URL.`);
34
+ }
35
+ return url;
36
+ },
37
+ },
38
+ wsEndpoint: {
39
+ type: 'string',
40
+ description: 'WebSocket endpoint to connect to a running Chrome instance (e.g., ws://127.0.0.1:9222/devtools/browser/<id>). Alternative to --browserUrl.',
41
+ alias: 'w',
42
+ conflicts: ['browserUrl'],
43
+ coerce: (url) => {
44
+ if (!url) {
45
+ return;
46
+ }
47
+ try {
48
+ const parsed = new URL(url);
49
+ if (parsed.protocol !== 'ws:' && parsed.protocol !== 'wss:') {
50
+ throw new Error(`Provided wsEndpoint ${url} must use ws:// or wss:// protocol.`);
51
+ }
52
+ return url;
53
+ }
54
+ catch (error) {
55
+ if (error.message.includes('ws://')) {
56
+ throw error;
57
+ }
58
+ throw new Error(`Provided wsEndpoint ${url} is not valid URL.`);
59
+ }
60
+ },
61
+ },
62
+ wsHeaders: {
63
+ type: 'string',
64
+ description: 'Custom headers for WebSocket connection in JSON format (e.g., \'{"Authorization":"Bearer token"}\'). Only works with --wsEndpoint.',
65
+ implies: 'wsEndpoint',
66
+ coerce: (val) => {
67
+ if (!val) {
68
+ return;
69
+ }
70
+ try {
71
+ const parsed = JSON.parse(val);
72
+ if (typeof parsed !== 'object' || Array.isArray(parsed)) {
73
+ throw new Error('Headers must be a JSON object');
74
+ }
75
+ return parsed;
76
+ }
77
+ catch (error) {
78
+ throw new Error(`Invalid JSON for wsHeaders: ${error.message}`);
79
+ }
80
+ },
81
+ },
82
+ headless: {
83
+ type: 'boolean',
84
+ description: 'Whether to run in headless (no UI) mode.',
85
+ default: false,
86
+ },
87
+ executablePath: {
88
+ type: 'string',
89
+ description: 'Path to custom Chrome executable.',
90
+ conflicts: ['browserUrl', 'wsEndpoint'],
91
+ alias: 'e',
92
+ },
93
+ isolated: {
94
+ type: 'boolean',
95
+ description: 'If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. Defaults to false.',
96
+ },
97
+ userDataDir: {
98
+ type: 'string',
99
+ description: 'Path to the user data directory for Chrome. Default is $HOME/.cache/chrome-devtools-mcp/chrome-profile$CHANNEL_SUFFIX_IF_NON_STABLE',
100
+ conflicts: ['browserUrl', 'wsEndpoint', 'isolated'],
101
+ },
102
+ channel: {
103
+ type: 'string',
104
+ description: 'Specify a different Chrome channel that should be used. The default is the stable channel version.',
105
+ choices: ['canary', 'dev', 'beta', 'stable'],
106
+ conflicts: ['browserUrl', 'wsEndpoint', 'executablePath'],
107
+ },
108
+ logFile: {
109
+ type: 'string',
110
+ describe: 'Path to a file to write debug logs to. Set the env variable `DEBUG` to `*` to enable verbose logs. Useful for submitting bug reports.',
111
+ },
112
+ viewport: {
113
+ type: 'string',
114
+ describe: 'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',
115
+ coerce: (arg) => {
116
+ if (arg === undefined) {
117
+ return;
118
+ }
119
+ const [width, height] = arg.split('x').map(Number);
120
+ if (!width || !height || Number.isNaN(width) || Number.isNaN(height)) {
121
+ throw new Error('Invalid viewport. Expected format is `1280x720`.');
122
+ }
123
+ return {
124
+ width,
125
+ height,
126
+ };
127
+ },
128
+ },
129
+ proxyServer: {
130
+ type: 'string',
131
+ description: `Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.`,
132
+ },
133
+ acceptInsecureCerts: {
134
+ type: 'boolean',
135
+ description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,
136
+ },
137
+ experimentalPageIdRouting: {
138
+ type: 'boolean',
139
+ describe: 'Whether to expose pageId on page-scoped tools and route requests by page ID (useful for concurrent agent sessions).',
140
+ },
141
+ experimentalDevtools: {
142
+ type: 'boolean',
143
+ describe: 'Whether to enable automation over DevTools targets',
144
+ },
145
+ experimentalVision: {
146
+ type: 'boolean',
147
+ 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.',
148
+ },
149
+ experimentalMemory: {
150
+ type: 'boolean',
151
+ describe: 'Whether to enable experimental memory tools.',
152
+ },
153
+ experimentalStructuredContent: {
154
+ type: 'boolean',
155
+ describe: 'Whether to output structured formatted content.',
156
+ },
157
+ experimentalIncludeAllPages: {
158
+ type: 'boolean',
159
+ describe: 'Whether to include all kinds of pages such as webviews or background pages as pages.',
160
+ },
161
+ experimentalNavigationAllowlist: {
162
+ type: 'boolean',
163
+ describe: 'Whether to enable navigation allowlist tool parameter.',
164
+ hidden: true,
165
+ },
166
+ experimentalInteropTools: {
167
+ type: 'boolean',
168
+ describe: 'Whether to enable interoperability tools',
169
+ hidden: true,
170
+ },
171
+ experimentalScreencast: {
172
+ type: 'boolean',
173
+ 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.',
174
+ },
175
+ experimentalFfmpegPath: {
176
+ type: 'string',
177
+ describe: 'Path to ffmpeg executable for screencast recording.',
178
+ implies: 'experimentalScreencast',
179
+ },
180
+ categoryExperimentalWebmcp: {
181
+ type: 'boolean',
182
+ describe: 'Set to true to enable debugging WebMCP tools. Requires Chrome 149+ with the following flags: `--enable-features=WebMCPTesting,DevToolsWebMCPSupport`',
183
+ },
184
+ chromeArg: {
185
+ type: 'array',
186
+ describe: 'Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
187
+ },
188
+ ignoreDefaultChromeArg: {
189
+ type: 'array',
190
+ describe: 'Explicitly disable default arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
191
+ },
192
+ categoryEmulation: {
193
+ type: 'boolean',
194
+ default: true,
195
+ describe: 'Set to false to exclude tools related to emulation.',
196
+ },
197
+ categoryPerformance: {
198
+ type: 'boolean',
199
+ default: true,
200
+ describe: 'Set to false to exclude tools related to performance.',
201
+ },
202
+ categoryNetwork: {
203
+ type: 'boolean',
204
+ default: true,
205
+ describe: 'Set to false to exclude tools related to network.',
206
+ },
207
+ categoryExtensions: {
208
+ type: 'boolean',
209
+ hidden: false,
210
+ default: false,
211
+ describe: 'Set to true to include tools related to extensions. Note: This feature is currently only supported with a pipe connection. autoConnect, browserUrl, and wsEndpoint are not supported with this feature until 149 will be released.',
212
+ },
213
+ categoryExperimentalThirdParty: {
214
+ type: 'boolean',
215
+ default: false,
216
+ describe: 'Set to true to enable third-party developer tools exposed by the inspected page itself',
217
+ },
218
+ performanceCrux: {
219
+ type: 'boolean',
220
+ default: true,
221
+ describe: 'Set to false to disable sending URLs from performance traces to CrUX API to get field performance data.',
222
+ },
223
+ usageStatistics: {
224
+ type: 'boolean',
225
+ default: true,
226
+ 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.',
227
+ },
228
+ clearcutEndpoint: {
229
+ type: 'string',
230
+ hidden: true,
231
+ describe: 'Endpoint for Clearcut telemetry.',
232
+ },
233
+ clearcutForceFlushIntervalMs: {
234
+ type: 'number',
235
+ hidden: true,
236
+ describe: 'Force flush interval in milliseconds (for testing).',
237
+ },
238
+ clearcutIncludePidHeader: {
239
+ type: 'boolean',
240
+ hidden: true,
241
+ describe: 'Include watchdog PID in Clearcut request headers (for testing).',
242
+ },
243
+ slim: {
244
+ type: 'boolean',
245
+ describe: 'Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.',
246
+ },
247
+ viaCli: {
248
+ type: 'boolean',
249
+ describe: 'Set by Chrome DevTools CLI if the MCP server is started via the CLI client (this arg exists for usage stats)',
250
+ hidden: true,
251
+ },
252
+ redactNetworkHeaders: {
253
+ type: 'boolean',
254
+ describe: 'If true, redacts some of the network headers considered senstive before returning to the client.',
255
+ default: false,
256
+ },
257
+ port: {
258
+ type: 'number',
259
+ describe: 'If specified, starts a Streamable HTTP transport on the given port instead of stdio. Allows multiple agents to connect to the same MCP server instance over HTTP.',
260
+ alias: 'p',
261
+ },
262
+ };
263
+ export function parseArguments(version, argv = process.argv, env = process.env) {
264
+ const yargsInstance = yargs(hideBin(argv))
265
+ .scriptName('npx chrome-devtools-mcp@latest')
266
+ .options(cliOptions)
267
+ .check(args => {
268
+ // We can't set default in the options else
269
+ // Yargs will complain
270
+ if (!args.channel &&
271
+ !args.browserUrl &&
272
+ !args.wsEndpoint &&
273
+ !args.executablePath) {
274
+ args.channel = 'stable';
275
+ }
276
+ if (env['CI'] || env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']) {
277
+ console.error("turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.");
278
+ args.usageStatistics = false;
279
+ }
280
+ return true;
281
+ })
282
+ .example([
283
+ [
284
+ '$0 --browserUrl http://127.0.0.1:9222',
285
+ 'Connect to an existing browser instance via HTTP',
286
+ ],
287
+ [
288
+ '$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123',
289
+ 'Connect to an existing browser instance via WebSocket',
290
+ ],
291
+ [
292
+ `$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123 --wsHeaders '{"Authorization":"Bearer token"}'`,
293
+ 'Connect via WebSocket with custom headers',
294
+ ],
295
+ ['$0 --channel beta', 'Use Chrome Beta installed on this system'],
296
+ ['$0 --channel canary', 'Use Chrome Canary installed on this system'],
297
+ ['$0 --channel dev', 'Use Chrome Dev installed on this system'],
298
+ ['$0 --channel stable', 'Use stable Chrome installed on this system'],
299
+ ['$0 --logFile /tmp/log.txt', 'Save logs to a file'],
300
+ ['$0 --help', 'Print CLI options'],
301
+ [
302
+ '$0 --viewport 1280x720',
303
+ 'Launch Chrome with the initial viewport size of 1280x720px',
304
+ ],
305
+ [
306
+ `$0 --chrome-arg='--no-sandbox' --chrome-arg='--disable-setuid-sandbox'`,
307
+ 'Launch Chrome without sandboxes. Use with caution.',
308
+ ],
309
+ [
310
+ `$0 --ignore-default-chrome-arg='--disable-extensions'`,
311
+ 'Disable the default arguments provided by Puppeteer. Use with caution.',
312
+ ],
313
+ ['$0 --no-category-emulation', 'Disable tools in the emulation category'],
314
+ [
315
+ '$0 --no-category-performance',
316
+ 'Disable tools in the performance category',
317
+ ],
318
+ ['$0 --no-category-network', 'Disable tools in the network category'],
319
+ [
320
+ '$0 --user-data-dir=/tmp/user-data-dir',
321
+ 'Use a custom user data directory',
322
+ ],
323
+ [
324
+ '$0 --auto-connect',
325
+ 'Connect to a stable Chrome instance (Chrome 144+) running instead of launching a new instance',
326
+ ],
327
+ [
328
+ '$0 --auto-connect --channel=canary',
329
+ 'Connect to a canary Chrome instance (Chrome 144+) running instead of launching a new instance',
330
+ ],
331
+ [
332
+ '$0 --no-usage-statistics',
333
+ 'Do not send usage statistics https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics.',
334
+ ],
335
+ [
336
+ '$0 --no-performance-crux',
337
+ 'Disable CrUX (field data) integration in performance tools.',
338
+ ],
339
+ [
340
+ '$0 --slim',
341
+ 'Only 3 tools: navigation, JavaScript execution and screenshot',
342
+ ],
343
+ ]);
344
+ return yargsInstance
345
+ .wrap(Math.min(120, yargsInstance.terminalWidth()))
346
+ .help()
347
+ .version(version)
348
+ .parseSync();
349
+ }
350
+ //# sourceMappingURL=chrome-devtools-mcp-cli-options.js.map
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import '../polyfill.js';
7
+ import { createServer } from 'node:http';
8
+ import { randomUUID } from 'node:crypto';
9
+ import process from 'node:process';
10
+ import { createMcpServer, logDisclaimers } from '../index.js';
11
+ import { logger, saveLogsToFile } from '../logger.js';
12
+ import { ClearcutLogger } from '../telemetry/ClearcutLogger.js';
13
+ import { computeFlagUsage } from '../telemetry/flagUtils.js';
14
+ import { StdioServerTransport, StreamableHTTPServerTransport, } from '../third_party/index.js';
15
+ import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
16
+ import { checkForUpdates } from '../utils/check-for-updates.js';
17
+ import { VERSION } from '../version.js';
18
+ import { cliOptions, parseArguments } from './chrome-devtools-mcp-cli-options.js';
19
+ await checkForUpdates('Run `npm install chrome-devtools-mcp@latest` to update.');
20
+ export const args = parseArguments(VERSION);
21
+ const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
22
+ if (process.env['CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT'] !== 'true') {
23
+ process.on('unhandledRejection', (reason, promise) => {
24
+ logger('Unhandled promise rejection', promise, reason);
25
+ });
26
+ }
27
+ logger(`Starting Chrome DevTools MCP Server v${VERSION}`);
28
+ const { server } = await createMcpServer(args, {
29
+ logFile,
30
+ });
31
+ if (args.port) {
32
+ const sessions = new Map();
33
+ const httpServer = createServer(async (req, res) => {
34
+ const url = new URL(req.url || '/', `http://localhost:${args.port}`);
35
+ if (url.pathname === '/mcp') {
36
+ const sessionId = req.headers['mcp-session-id'];
37
+ if (sessionId && sessions.has(sessionId)) {
38
+ const transport = sessions.get(sessionId);
39
+ await transport.handleRequest(req, res);
40
+ return;
41
+ }
42
+ // Parse body for initialization detection
43
+ const body = await new Promise(resolve => {
44
+ let data = '';
45
+ req.on('data', chunk => (data += chunk));
46
+ req.on('end', () => resolve(data));
47
+ });
48
+ const jsonBody = JSON.parse(body);
49
+ if (isInitializeRequest(jsonBody) ||
50
+ (Array.isArray(jsonBody) && jsonBody.some(isInitializeRequest))) {
51
+ const transport = new StreamableHTTPServerTransport({
52
+ sessionIdGenerator: () => randomUUID(),
53
+ });
54
+ transport.onclose = () => {
55
+ const id = [...sessions.entries()].find(([, t]) => t === transport)?.[0];
56
+ if (id)
57
+ sessions.delete(id);
58
+ };
59
+ await server.connect(transport);
60
+ await transport.handleRequest(req, res, jsonBody);
61
+ // Extract session ID from response headers
62
+ const respSessionId = res.getHeader('mcp-session-id');
63
+ if (respSessionId) {
64
+ sessions.set(respSessionId, transport);
65
+ }
66
+ }
67
+ else if (sessionId) {
68
+ res.writeHead(404, { 'Content-Type': 'application/json' });
69
+ res.end(JSON.stringify({ error: 'Session not found' }));
70
+ }
71
+ else {
72
+ res.writeHead(400, { 'Content-Type': 'application/json' });
73
+ res.end(JSON.stringify({ error: 'Missing mcp-session-id header' }));
74
+ }
75
+ }
76
+ else {
77
+ res.writeHead(404);
78
+ res.end('Not found. Use /mcp endpoint.');
79
+ }
80
+ });
81
+ httpServer.listen(args.port, () => {
82
+ logger(`Chrome DevTools MCP Server listening on http://localhost:${args.port}/mcp`);
83
+ console.error(`Chrome DevTools MCP Server listening on http://localhost:${args.port}/mcp`);
84
+ });
85
+ }
86
+ else {
87
+ const transport = new StdioServerTransport();
88
+ await server.connect(transport);
89
+ }
90
+ logger('Chrome DevTools MCP Server connected');
91
+ logDisclaimers(args);
92
+ void ClearcutLogger.get()?.logDailyActiveIfNeeded();
93
+ void ClearcutLogger.get()?.logServerStart(computeFlagUsage(args, cliOptions));
94
+ //# sourceMappingURL=chrome-devtools-mcp-main.js.map
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @license
4
+ * Copyright 2025 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ process.title = 'chrome-devtools-mcp';
8
+ import { version } from 'node:process';
9
+ const [major, minor] = version.substring(1).split('.').map(Number);
10
+ if (major === 20 && minor < 19) {
11
+ console.error(`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`);
12
+ process.exit(1);
13
+ }
14
+ if (major === 22 && minor < 12) {
15
+ console.error(`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 22.12.0 LTS or a newer LTS.`);
16
+ process.exit(1);
17
+ }
18
+ if (major < 20) {
19
+ console.error(`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`);
20
+ process.exit(1);
21
+ }
22
+ const subcommand = process.argv[2];
23
+ if (subcommand === 'install' || subcommand === 'uninstall' || subcommand === 'status') {
24
+ // Pass remaining args after the subcommand, then append the action
25
+ process.argv = [process.argv[0], process.argv[1], ...process.argv.slice(3), subcommand];
26
+ await import('./install-service.js');
27
+ }
28
+ else {
29
+ await import('./chrome-devtools-mcp-main.js');
30
+ }
31
+ //# sourceMappingURL=chrome-devtools-mcp.js.map
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ process.title = 'chrome-devtools';
8
+ import process from 'node:process';
9
+ import { startDaemon, stopDaemon, sendCommand, handleResponse, } from '../daemon/client.js';
10
+ import { isDaemonRunning, serializeArgs } from '../daemon/utils.js';
11
+ import { logDisclaimers } from '../index.js';
12
+ import { hideBin, yargs } from '../third_party/index.js';
13
+ import { checkForUpdates } from '../utils/check-for-updates.js';
14
+ import { VERSION } from '../version.js';
15
+ import { commands } from './chrome-devtools-cli-options.js';
16
+ import { cliOptions, parseArguments } from './chrome-devtools-mcp-cli-options.js';
17
+ await checkForUpdates('Run `npm install -g chrome-devtools-mcp@latest` and `chrome-devtools start` to update and restart the daemon.');
18
+ async function start(args, sessionId) {
19
+ const combinedArgs = [...args, ...defaultArgs];
20
+ await startDaemon(combinedArgs, sessionId);
21
+ logDisclaimers(parseArguments(VERSION, combinedArgs));
22
+ }
23
+ const defaultArgs = ['--viaCli', '--experimentalStructuredContent'];
24
+ const startCliOptions = {
25
+ ...cliOptions,
26
+ };
27
+ // Missing CLI serialization.
28
+ delete startCliOptions.viewport;
29
+ // Change the defaults for the CLI.
30
+ delete startCliOptions.experimentalStructuredContent;
31
+ delete startCliOptions.experimentalInteropTools;
32
+ delete startCliOptions.experimentalPageIdRouting;
33
+ if (!('default' in cliOptions.headless)) {
34
+ throw new Error('headless cli option unexpectedly does not have a default');
35
+ }
36
+ if ('default' in cliOptions.isolated) {
37
+ throw new Error('isolated cli option unexpectedly has a default');
38
+ }
39
+ startCliOptions.headless.default = true;
40
+ startCliOptions.isolated.description =
41
+ '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.';
42
+ startCliOptions.categoryExtensions.default = true;
43
+ const y = yargs(hideBin(process.argv))
44
+ .scriptName('chrome-devtools')
45
+ .showHelpOnFail(true)
46
+ .usage('chrome-devtools <command> [...args] --flags')
47
+ .usage(`Run 'chrome-devtools <command> --help' for help on the specific command.`)
48
+ .option('sessionId', {
49
+ type: 'string',
50
+ description: 'Session ID for daemon scoping',
51
+ default: '',
52
+ hidden: true,
53
+ })
54
+ .demandCommand()
55
+ .version(VERSION)
56
+ .strict()
57
+ .help(true)
58
+ .wrap(120);
59
+ y.command('start', 'Start or restart chrome-devtools-mcp', y => y
60
+ .options(startCliOptions)
61
+ .example('$0 start --browserUrl http://localhost:9222', 'Start the server connecting to an existing browser')
62
+ .strict(), async (argv) => {
63
+ if (isDaemonRunning(argv.sessionId)) {
64
+ await stopDaemon(argv.sessionId);
65
+ }
66
+ // Defaults but we do not want to affect the yargs conflict resolution.
67
+ if (argv.isolated === undefined && argv.userDataDir === undefined) {
68
+ argv.isolated = true;
69
+ }
70
+ if (argv.headless === undefined) {
71
+ argv.headless = true;
72
+ }
73
+ const args = serializeArgs(cliOptions, argv);
74
+ await start(args, argv.sessionId);
75
+ process.exit(0);
76
+ }).strict(); // Re-enable strict validation for other commands; this is applied to the yargs instance itself
77
+ y.command('status', 'Checks if chrome-devtools-mcp is running', y => y, async (argv) => {
78
+ if (isDaemonRunning(argv.sessionId)) {
79
+ console.log('chrome-devtools-mcp daemon is running.');
80
+ const response = await sendCommand({
81
+ method: 'status',
82
+ }, argv.sessionId);
83
+ if (response.success) {
84
+ const data = JSON.parse(response.result);
85
+ console.log(`pid=${data.pid} socket=${data.socketPath} start-date=${data.startDate} version=${data.version}`);
86
+ console.log(`args=${JSON.stringify(data.args)}`);
87
+ }
88
+ else {
89
+ console.error('Error:', response.error);
90
+ process.exit(1);
91
+ }
92
+ }
93
+ else {
94
+ console.log('chrome-devtools-mcp daemon is not running.');
95
+ }
96
+ process.exit(0);
97
+ });
98
+ y.command('stop', 'Stop chrome-devtools-mcp if any', y => y, async (argv) => {
99
+ const sessionId = argv.sessionId;
100
+ if (!isDaemonRunning(sessionId)) {
101
+ process.exit(0);
102
+ }
103
+ await stopDaemon(sessionId);
104
+ process.exit(0);
105
+ });
106
+ for (const [commandName, commandDef] of Object.entries(commands)) {
107
+ const args = commandDef.args;
108
+ const requiredArgNames = Object.keys(args).filter(name => args[name].required);
109
+ const optionalArgNames = Object.keys(args).filter(name => !args[name].required);
110
+ let commandStr = commandName;
111
+ for (const arg of requiredArgNames) {
112
+ commandStr += ` <${arg}>`;
113
+ }
114
+ for (const arg of optionalArgNames) {
115
+ commandStr += ` [--${arg}]`;
116
+ }
117
+ y.command(commandStr, commandDef.description, y => {
118
+ y.option('output-format', {
119
+ choices: ['md', 'json'],
120
+ default: 'md',
121
+ });
122
+ for (const [argName, opt] of Object.entries(args)) {
123
+ const type = opt.type === 'integer' || opt.type === 'number'
124
+ ? 'number'
125
+ : opt.type === 'boolean'
126
+ ? 'boolean'
127
+ : opt.type === 'array'
128
+ ? 'array'
129
+ : 'string';
130
+ if (opt.required) {
131
+ const options = {
132
+ describe: opt.description,
133
+ type: type,
134
+ };
135
+ if (opt.default !== undefined) {
136
+ options.default = opt.default;
137
+ }
138
+ if (opt.enum) {
139
+ options.choices = opt.enum;
140
+ }
141
+ y.positional(argName, options);
142
+ }
143
+ else {
144
+ const options = {
145
+ describe: opt.description,
146
+ type: type,
147
+ };
148
+ if (opt.default !== undefined) {
149
+ options.default = opt.default;
150
+ }
151
+ if (opt.enum) {
152
+ options.choices = opt.enum;
153
+ }
154
+ y.option(argName, options);
155
+ }
156
+ }
157
+ }, async (argv) => {
158
+ const sessionId = argv.sessionId;
159
+ try {
160
+ if (!isDaemonRunning(sessionId)) {
161
+ await start([], sessionId);
162
+ }
163
+ const commandArgs = {};
164
+ for (const argName of Object.keys(args)) {
165
+ if (argName in argv) {
166
+ commandArgs[argName] = argv[argName];
167
+ }
168
+ }
169
+ const response = await sendCommand({
170
+ method: 'invoke_tool',
171
+ tool: commandName,
172
+ args: commandArgs,
173
+ }, sessionId);
174
+ if (response.success) {
175
+ console.log(await handleResponse(JSON.parse(response.result), argv['output-format']));
176
+ }
177
+ else {
178
+ console.error('Error:', response.error);
179
+ process.exit(1);
180
+ }
181
+ }
182
+ catch (error) {
183
+ console.error('Failed to execute command:', error);
184
+ process.exit(1);
185
+ }
186
+ });
187
+ }
188
+ await y.parse();
189
+ //# sourceMappingURL=chrome-devtools.js.map