chrome-devtools-mcp 1.11.0 → 1.12.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 (72) hide show
  1. package/README.md +72 -20
  2. package/build/src/BrowserManager.js +27 -18
  3. package/build/src/McpContext.js +435 -87
  4. package/build/src/McpPage.js +189 -59
  5. package/build/src/McpResponse.js +61 -44
  6. package/build/src/TextSnapshot.js +37 -18
  7. package/build/src/ToolHandler.js +256 -135
  8. package/build/src/bin/chrome-devtools-mcp-main.js +6 -4
  9. package/build/src/bin/chrome-devtools.js +4 -4
  10. package/build/src/collectors/PageCollector.js +13 -9
  11. package/build/src/collectors/ServiceWorkerCollector.js +2 -2
  12. package/build/src/collectors/constants.js +7 -0
  13. package/build/src/config/ConfigParser.js +44 -149
  14. package/build/src/config/ConfigWatcher.js +3 -2
  15. package/build/src/config/ServerConfig.js +251 -0
  16. package/build/src/config/browser-options.js +13 -4
  17. package/build/src/config/cli-options.js +35 -19
  18. package/build/src/config/mcp-options.js +61 -35
  19. package/build/src/config/puppeteer-options.js +4 -2
  20. package/build/src/daemon/client.js +3 -3
  21. package/build/src/daemon/daemon.js +7 -3
  22. package/build/src/daemon/utils.js +2 -1
  23. package/build/src/devtools/DevToolsCommentBridge.js +28 -5
  24. package/build/src/devtools/DevtoolsUtils.js +49 -12
  25. package/build/src/formatters/ConsoleFormatter.js +28 -1
  26. package/build/src/formatters/HeapSnapshotFormatter.js +14 -18
  27. package/build/src/formatters/NetworkFormatter.js +54 -15
  28. package/build/src/formatters/RemoteObjectFormatter.js +231 -0
  29. package/build/src/formatters/SnapshotFormatter.js +13 -3
  30. package/build/src/index.js +256 -104
  31. package/build/src/processors/HeapSnapshotManager.js +390 -128
  32. package/build/src/third_party/THIRD_PARTY_NOTICES +542 -445
  33. package/build/src/third_party/bundled-packages.json +2 -2
  34. package/build/src/third_party/cli.js +9239 -0
  35. package/build/src/third_party/devtools-formatter-worker.js +3089 -2438
  36. package/build/src/third_party/devtools-heap-snapshot-worker.js +172 -1
  37. package/build/src/third_party/index.js +52247 -55764
  38. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +54576 -52174
  39. package/build/src/tools/ToolDefinition.js +90 -12
  40. package/build/src/tools/comments.js +42 -3
  41. package/build/src/tools/console.js +6 -4
  42. package/build/src/tools/css.js +1 -0
  43. package/build/src/tools/emulation.js +5 -4
  44. package/build/src/tools/extensions.js +5 -0
  45. package/build/src/tools/input.js +21 -6
  46. package/build/src/tools/lighthouse.js +24 -8
  47. package/build/src/tools/memory.js +59 -53
  48. package/build/src/tools/network.js +5 -4
  49. package/build/src/tools/pages.js +48 -6
  50. package/build/src/tools/performance.js +7 -4
  51. package/build/src/tools/pwa.js +7 -0
  52. package/build/src/tools/screencast.js +3 -1
  53. package/build/src/tools/screenshot.js +23 -7
  54. package/build/src/tools/script.js +38 -6
  55. package/build/src/tools/slim/tools.js +21 -5
  56. package/build/src/tools/snapshot.js +13 -3
  57. package/build/src/tools/thirdPartyDeveloper.js +3 -1
  58. package/build/src/tools/webmcp.js +2 -0
  59. package/build/src/utils/TaskRunner.js +136 -0
  60. package/build/src/utils/WaitForHelper.js +1 -1
  61. package/build/src/utils/bytes.js +2 -12
  62. package/build/src/utils/check-for-updates.js +1 -1
  63. package/build/src/utils/disclaimers.js +27 -0
  64. package/build/src/utils/keyboard.js +14 -2
  65. package/build/src/utils/logger.js +69 -0
  66. package/build/src/utils/resourceType.js +27 -0
  67. package/build/src/utils/text.js +29 -0
  68. package/build/src/utils/timeout.js +14 -0
  69. package/build/src/utils/url.js +41 -0
  70. package/build/src/version.js +1 -1
  71. package/package.json +5 -4
  72. package/skills/a11y-debugging/SKILL.md +3 -8
@@ -60,6 +60,11 @@ function lowerBound(array, needle, comparator, left, right) {
60
60
  }
61
61
  return r;
62
62
  }
63
+ var NearestSearchStart;
64
+ (function (NearestSearchStart) {
65
+ NearestSearchStart["BEGINNING"] = "BEGINNING";
66
+ NearestSearchStart["END"] = "END";
67
+ })(NearestSearchStart || (NearestSearchStart = {}));
63
68
  function arrayDoesNotContainNullOrUndefined(arr) {
64
69
  return !arr.includes(null) && !arr.includes(undefined);
65
70
  }
@@ -170,6 +175,13 @@ async function saveScreenshot(options) {
170
175
  link.href = blobUrl;
171
176
  link.click();
172
177
  }
178
+ async function copyScreenshot(options) {
179
+ const response = await fetch('data:image/png;base64,' + options.base64Png);
180
+ const blob = await response.blob();
181
+ await navigator.clipboard.write([
182
+ new ClipboardItem({ 'image/png': blob }),
183
+ ]);
184
+ }
173
185
  let cssEvaluationElement = null;
174
186
  const HOST_RUNTIME$2 = {
175
187
  createWorker(url) {
@@ -192,6 +204,7 @@ const HOST_RUNTIME$2 = {
192
204
  return window.devicePixelRatio;
193
205
  },
194
206
  saveScreenshot,
207
+ copyScreenshot,
195
208
  revokeLastScreenshotUrl,
196
209
  async loadTextFile(url) {
197
210
  const response = await fetch(url);
@@ -348,6 +361,7 @@ const HOST_RUNTIME$1 = {
348
361
  return 1;
349
362
  },
350
363
  async saveScreenshot(_options) { },
364
+ async copyScreenshot(_options) { },
351
365
  revokeLastScreenshotUrl() { },
352
366
  async loadTextFile(url) {
353
367
  return await Fs.promises.readFile(Url.fileURLToPath(url), 'utf-8');
@@ -384,6 +398,20 @@ const HOST_RUNTIME = await (async () => {
384
398
  throw new Error('Unknown runtime!');
385
399
  })();
386
400
 
401
+ // Copyright 2020 The Chromium Authors
402
+ var ArrowKey;
403
+ (function (ArrowKey) {
404
+ ArrowKey["UP"] = "ArrowUp";
405
+ ArrowKey["DOWN"] = "ArrowDown";
406
+ ArrowKey["LEFT"] = "ArrowLeft";
407
+ ArrowKey["RIGHT"] = "ArrowRight";
408
+ })(ArrowKey || (ArrowKey = {}));
409
+ var PageKey;
410
+ (function (PageKey) {
411
+ PageKey["UP"] = "PageUp";
412
+ PageKey["DOWN"] = "PageDown";
413
+ })(PageKey || (PageKey = {}));
414
+
387
415
  // Copyright 2020 The Chromium Authors
388
416
  class Multimap {
389
417
  map = new Map();
@@ -443,6 +471,21 @@ class Multimap {
443
471
  }
444
472
  }
445
473
 
474
+ // Copyright 2023 The Chromium Authors
475
+ var MimeType;
476
+ (function (MimeType) {
477
+ MimeType["HTML"] = "text/html";
478
+ MimeType["XML"] = "text/xml";
479
+ MimeType["PLAIN"] = "text/plain";
480
+ MimeType["XHTML"] = "application/xhtml+xml";
481
+ MimeType["SVG"] = "image/svg+xml";
482
+ MimeType["CSS"] = "text/css";
483
+ MimeType["XSL"] = "text/xsl";
484
+ MimeType["VTT"] = "text/vtt";
485
+ MimeType["PDF"] = "application/pdf";
486
+ MimeType["EVENTSTREAM"] = "text/event-stream";
487
+ })(MimeType || (MimeType = {}));
488
+
446
489
  // Copyright 2020 The Chromium Authors
447
490
  const sprintf = (fmt, ...args) => {
448
491
  let argIndex = 0;
@@ -874,6 +917,12 @@ class Location {
874
917
  this.columnNumber = columnNumber;
875
918
  }
876
919
  }
920
+ var DOMLinkState;
921
+ (function (DOMLinkState) {
922
+ DOMLinkState[DOMLinkState["UNKNOWN"] = 0] = "UNKNOWN";
923
+ DOMLinkState[DOMLinkState["ATTACHED"] = 1] = "ATTACHED";
924
+ DOMLinkState[DOMLinkState["DETACHED"] = 2] = "DETACHED";
925
+ })(DOMLinkState || (DOMLinkState = {}));
877
926
 
878
927
  var HeapSnapshotModel$1 = /*#__PURE__*/Object.freeze({
879
928
  __proto__: null,
@@ -881,6 +930,7 @@ var HeapSnapshotModel$1 = /*#__PURE__*/Object.freeze({
881
930
  AllocationNodeCallers: AllocationNodeCallers,
882
931
  AllocationStackFrame: AllocationStackFrame,
883
932
  ComparatorConfig: ComparatorConfig,
933
+ get DOMLinkState () { return DOMLinkState; },
884
934
  Diff: Diff,
885
935
  Edge: Edge,
886
936
  HeapSnapshotProgressEvent: HeapSnapshotProgressEvent,
@@ -1358,6 +1408,22 @@ function getColorSpace(colorSpaceText) {
1358
1408
  }
1359
1409
  return null;
1360
1410
  }
1411
+ var ColorChannel;
1412
+ (function (ColorChannel) {
1413
+ ColorChannel["A"] = "a";
1414
+ ColorChannel["ALPHA"] = "alpha";
1415
+ ColorChannel["B"] = "b";
1416
+ ColorChannel["C"] = "c";
1417
+ ColorChannel["G"] = "g";
1418
+ ColorChannel["H"] = "h";
1419
+ ColorChannel["L"] = "l";
1420
+ ColorChannel["R"] = "r";
1421
+ ColorChannel["S"] = "s";
1422
+ ColorChannel["W"] = "w";
1423
+ ColorChannel["X"] = "x";
1424
+ ColorChannel["Y"] = "y";
1425
+ ColorChannel["Z"] = "z";
1426
+ })(ColorChannel || (ColorChannel = {}));
1361
1427
  function mapPercentToRange(percent, range) {
1362
1428
  const sign = Math.sign(percent);
1363
1429
  const absPercent = Math.abs(percent);
@@ -1537,6 +1603,31 @@ function equals(a, b, accuracy = EPSILON) {
1537
1603
  function lessOrEquals(a, b, accuracy = EPSILON) {
1538
1604
  return a - b <= accuracy;
1539
1605
  }
1606
+ var Format;
1607
+ (function (Format) {
1608
+ Format["HEX"] = "hex";
1609
+ Format["HEXA"] = "hexa";
1610
+ Format["RGB"] = "rgb";
1611
+ Format["RGBA"] = "rgba";
1612
+ Format["HSL"] = "hsl";
1613
+ Format["HSLA"] = "hsla";
1614
+ Format["HWB"] = "hwb";
1615
+ Format["HWBA"] = "hwba";
1616
+ Format["LCH"] = "lch";
1617
+ Format["OKLCH"] = "oklch";
1618
+ Format["LAB"] = "lab";
1619
+ Format["OKLAB"] = "oklab";
1620
+ Format["SRGB"] = "srgb";
1621
+ Format["SRGB_LINEAR"] = "srgb-linear";
1622
+ Format["DISPLAY_P3"] = "display-p3";
1623
+ Format["DISPLAY_P3_LINEAR"] = "display-p3-linear";
1624
+ Format["A98_RGB"] = "a98-rgb";
1625
+ Format["PROPHOTO_RGB"] = "prophoto-rgb";
1626
+ Format["REC_2020"] = "rec2020";
1627
+ Format["XYZ"] = "xyz";
1628
+ Format["XYZ_D50"] = "xyz-d50";
1629
+ Format["XYZ_D65"] = "xyz-d65";
1630
+ })(Format || (Format = {}));
1540
1631
  class Lab {
1541
1632
  l;
1542
1633
  a;
@@ -4965,6 +5056,16 @@ const i18nLazyString$1 = getLazilyComputedLocalizedString.bind(undefined, str_$2
4965
5056
  });
4966
5057
 
4967
5058
  // Copyright 2014 The Chromium Authors
5059
+ var Events$1;
5060
+ (function (Events) {
5061
+ Events["MESSAGE_ADDED"] = "messageAdded";
5062
+ })(Events$1 || (Events$1 = {}));
5063
+ var MessageLevel;
5064
+ (function (MessageLevel) {
5065
+ MessageLevel["INFO"] = "info";
5066
+ MessageLevel["WARNING"] = "warning";
5067
+ MessageLevel["ERROR"] = "error";
5068
+ })(MessageLevel || (MessageLevel = {}));
4968
5069
  var FrontendMessageSource;
4969
5070
  (function (FrontendMessageSource) {
4970
5071
  FrontendMessageSource["CSS"] = "css";
@@ -5783,6 +5884,65 @@ const UIStrings = {
5783
5884
  };
5784
5885
  const str_ = registerUIStrings('core/common/SettingRegistration.ts', UIStrings);
5785
5886
  getLocalizedString.bind(undefined, str_);
5887
+ var SettingCategory;
5888
+ (function (SettingCategory) {
5889
+ SettingCategory["NONE"] = "";
5890
+ SettingCategory["ELEMENTS"] = "ELEMENTS";
5891
+ SettingCategory["AI"] = "AI";
5892
+ SettingCategory["APPEARANCE"] = "APPEARANCE";
5893
+ SettingCategory["SOURCES"] = "SOURCES";
5894
+ SettingCategory["NETWORK"] = "NETWORK";
5895
+ SettingCategory["PERFORMANCE"] = "PERFORMANCE";
5896
+ SettingCategory["CONSOLE"] = "CONSOLE";
5897
+ SettingCategory["PERSISTENCE"] = "PERSISTENCE";
5898
+ SettingCategory["DEBUGGER"] = "DEBUGGER";
5899
+ SettingCategory["GLOBAL"] = "GLOBAL";
5900
+ SettingCategory["RENDERING"] = "RENDERING";
5901
+ SettingCategory["GRID"] = "GRID";
5902
+ SettingCategory["MOBILE"] = "MOBILE";
5903
+ SettingCategory["EMULATION"] = "EMULATION";
5904
+ SettingCategory["MEMORY"] = "MEMORY";
5905
+ SettingCategory["EXTENSIONS"] = "EXTENSIONS";
5906
+ SettingCategory["ADORNER"] = "ADORNER";
5907
+ SettingCategory["ACCOUNT"] = "ACCOUNT";
5908
+ })(SettingCategory || (SettingCategory = {}));
5909
+ var SettingType;
5910
+ (function (SettingType) {
5911
+ SettingType["ARRAY"] = "array";
5912
+ SettingType["REGEX"] = "regex";
5913
+ SettingType["ENUM"] = "enum";
5914
+ SettingType["BOOLEAN"] = "boolean";
5915
+ })(SettingType || (SettingType = {}));
5916
+
5917
+ // Copyright 2009 The Chromium Authors
5918
+ var SettingAvailability;
5919
+ (function (SettingAvailability) {
5920
+ SettingAvailability[SettingAvailability["AVAILABLE"] = 1] = "AVAILABLE";
5921
+ SettingAvailability[SettingAvailability["UNAVAILABLE"] = 2] = "UNAVAILABLE";
5922
+ SettingAvailability[SettingAvailability["DISABLED"] = 3] = "DISABLED";
5923
+ })(SettingAvailability || (SettingAvailability = {}));
5924
+ var SettingStorageType;
5925
+ (function (SettingStorageType) {
5926
+ SettingStorageType["SYNCED"] = "Synced";
5927
+ SettingStorageType["GLOBAL"] = "Global";
5928
+ SettingStorageType["LOCAL"] = "Local";
5929
+ SettingStorageType["SESSION"] = "Session";
5930
+ })(SettingStorageType || (SettingStorageType = {}));
5931
+
5932
+ // Copyright 2026 The Chromium Authors
5933
+ var TokenType;
5934
+ (function (TokenType) {
5935
+ TokenType[TokenType["LITERAL"] = 0] = "LITERAL";
5936
+ TokenType[TokenType["URL"] = 1] = "URL";
5937
+ })(TokenType || (TokenType = {}));
5938
+
5939
+ // Copyright 2014 The Chromium Authors
5940
+ var Scheduling;
5941
+ (function (Scheduling) {
5942
+ Scheduling["DEFAULT"] = "Default";
5943
+ Scheduling["AS_SOON_AS_POSSIBLE"] = "AsSoonAsPossible";
5944
+ Scheduling["DELAYED"] = "Delayed";
5945
+ })(Scheduling || (Scheduling = {}));
5786
5946
 
5787
5947
  // Copyright 2011 The Chromium Authors
5788
5948
  class HeapSnapshotWorkerProxy extends ObjectWrapper {
@@ -5941,6 +6101,11 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
5941
6101
  this.worker.postMessage(message, transfer);
5942
6102
  }
5943
6103
  }
6104
+ (function (HeapSnapshotWorkerProxy) {
6105
+ (function (Events) {
6106
+ Events["WAIT"] = "Wait";
6107
+ })(HeapSnapshotWorkerProxy.Events || (HeapSnapshotWorkerProxy.Events = {}));
6108
+ })(HeapSnapshotWorkerProxy || (HeapSnapshotWorkerProxy = {}));
5944
6109
  class HeapSnapshotProxyObject {
5945
6110
  worker;
5946
6111
  objectId;
@@ -6164,7 +6329,7 @@ var HeapSnapshotProxy$1 = /*#__PURE__*/Object.freeze({
6164
6329
  HeapSnapshotProviderProxy: HeapSnapshotProviderProxy,
6165
6330
  HeapSnapshotProxy: HeapSnapshotProxy,
6166
6331
  HeapSnapshotProxyObject: HeapSnapshotProxyObject,
6167
- HeapSnapshotWorkerProxy: HeapSnapshotWorkerProxy
6332
+ get HeapSnapshotWorkerProxy () { return HeapSnapshotWorkerProxy; }
6168
6333
  });
6169
6334
 
6170
6335
  // Copyright 2019 The Chromium Authors
@@ -11759,6 +11924,12 @@ class BalancedJSONTokenizer {
11759
11924
  }
11760
11925
  }
11761
11926
 
11927
+ // Copyright 2024 The Chromium Authors
11928
+ var Events;
11929
+ (function (Events) {
11930
+ Events["CHUNK_ADDED"] = "ChunkAdded";
11931
+ })(Events || (Events = {}));
11932
+
11762
11933
  // Copyright 2012 The Chromium Authors
11763
11934
  class HeapSnapshotLoader {
11764
11935
  #progress;