@mehmoodqureshi/chrome-mcp 0.6.7 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +116 -0
  2. package/dist/shared/observers.d.ts +110 -0
  3. package/dist/shared/observers.js +127 -0
  4. package/dist/shared/page-fns.d.ts +46 -0
  5. package/dist/shared/page-fns.js +292 -0
  6. package/dist/shared/policy.d.ts +9 -0
  7. package/dist/shared/policy.js +16 -0
  8. package/dist/shared/protocol.d.ts +11 -2
  9. package/dist/shared/protocol.js +3 -0
  10. package/dist/shared/snapshot.d.ts +2 -0
  11. package/dist/shared/snapshot.js +8 -1
  12. package/dist/src/bridge/workspace.d.ts +6 -0
  13. package/dist/src/bridge/workspace.js +20 -0
  14. package/dist/src/config.js +31 -0
  15. package/dist/src/executor/extension-executor.d.ts +27 -13
  16. package/dist/src/executor/extension-executor.js +53 -12
  17. package/dist/src/executor/stub-executor.d.ts +19 -1
  18. package/dist/src/executor/stub-executor.js +22 -6
  19. package/dist/src/executor/types.d.ts +72 -13
  20. package/dist/src/mcp/audit.d.ts +39 -0
  21. package/dist/src/mcp/audit.js +60 -0
  22. package/dist/src/mcp/helpers.d.ts +4 -4
  23. package/dist/src/mcp/helpers.js +9 -4
  24. package/dist/src/mcp/locate.d.ts +45 -0
  25. package/dist/src/mcp/locate.js +105 -0
  26. package/dist/src/mcp/redact.d.ts +48 -0
  27. package/dist/src/mcp/redact.js +92 -0
  28. package/dist/src/mcp/snapdiff.d.ts +43 -0
  29. package/dist/src/mcp/snapdiff.js +92 -0
  30. package/dist/src/mcp/tools.js +429 -43
  31. package/dist/src/security/policy.d.ts +5 -0
  32. package/dist/src/security/policy.js +6 -0
  33. package/docs/BLUEPRINT.md +15 -1
  34. package/extension-dist/background.js +617 -214
  35. package/extension-dist/page-hook.js +215 -0
  36. package/package.json +1 -1
@@ -27,6 +27,11 @@ export { isReadMethod, isMutatingMethod, isUrlGated, hostOf, isDomainAllowed };
27
27
  export interface Policy extends WirePolicy {
28
28
  /** If set, `upload_file` may only read files inside this directory (absolute path). */
29
29
  uploadsDir?: string;
30
+ /** Pattern-based secret redaction on content reads (`--redact`). Password
31
+ * field values are suppressed regardless of this setting. */
32
+ redact?: boolean;
33
+ /** Extra redaction patterns (regex sources) supplied by the operator. */
34
+ redactPatterns?: string[];
30
35
  }
31
36
  /** The SAFE default: deny everything until the user opts in. */
32
37
  export declare const DEFAULT_POLICY: Readonly<Policy>;
@@ -40,6 +40,9 @@ exports.DEFAULT_POLICY = Object.freeze({
40
40
  uploadsDir: undefined,
41
41
  allowAllTabs: false,
42
42
  enableMutations: false,
43
+ allowObservers: false,
44
+ redact: false,
45
+ redactPatterns: [],
43
46
  });
44
47
  /** Merge a partial (from a policy file and/or CLI flags) over the safe default. */
45
48
  function resolvePolicy(partial) {
@@ -51,6 +54,9 @@ function resolvePolicy(partial) {
51
54
  uploadsDir: partial?.uploadsDir ?? exports.DEFAULT_POLICY.uploadsDir,
52
55
  allowAllTabs: partial?.allowAllTabs ?? exports.DEFAULT_POLICY.allowAllTabs,
53
56
  enableMutations: partial?.enableMutations ?? exports.DEFAULT_POLICY.enableMutations,
57
+ allowObservers: partial?.allowObservers ?? exports.DEFAULT_POLICY.allowObservers,
58
+ redact: partial?.redact ?? exports.DEFAULT_POLICY.redact,
59
+ redactPatterns: partial?.redactPatterns ?? [...(exports.DEFAULT_POLICY.redactPatterns ?? [])],
54
60
  };
55
61
  }
56
62
  // ---------------------------------------------------------------------------
package/docs/BLUEPRINT.md CHANGED
@@ -350,7 +350,7 @@ export type ExecutorErrorCode =
350
350
 
351
351
  ## 5. The Complete MCP Tool Surface
352
352
 
353
- 26 tools. `readOnly` is metadata (not a JSON-Schema field) consumed by the host
353
+ 38 tools. `readOnly` is metadata (not a JSON-Schema field) consumed by the host
354
354
  and by **safe-mode** (shipped in v1, default ON). Every handler:
355
355
  `withReadyExecutor()` → validate args (`requireTarget` for selector|ref) →
356
356
  **`policy.assertUrlAllowed(currentTabUrl, method)`** → call executor/helper →
@@ -381,9 +381,23 @@ never-throw firewall converting any thrown `Error` to `{isError:true}`.
381
381
  | `read_as_markdown` | `{selector?, tabId?}` | raw markdown text | read | **server helper** (md-reducer IIFE) |
382
382
  | `fill_form` | `{fields:{[selector]:string\|bool}, submitSelector?, tabId?}` | `{filled, submitted}` | mutate | **server helper** (seq `ex.fill`/`ex.click`) |
383
383
  | `download_file` | `{url?\|(selector?\|ref?), suggestedName?, tabId?}` | `DownloadResult` | mutate | **executor `download`** (privileged) |
384
+ | `frames_list` | `{tabId?}` | `{frames:[{frameId,top,url,title}]}` | read | executor primitive |
385
+ | `console_logs` | `{level?, sinceSeq?, limit?, clear?, tabId?}` | `{entries,count}` | read | executor `observers` |
386
+ | `network_log` | `{urlContains?, failedOnly?, includeResources?, …}` | `{entries,count}` | read | executor `observers` |
387
+ | `dialogs` | `{policy?, promptText?, sinceSeq?, …}` | `{entries,count,policy}` | read | executor `observers` |
388
+ | `print_pdf` | `{landscape?, printBackground?, scale?, …}` | `{path,bytes,url,title}` | read* | executor `printPdf` (CDP `Page.printToPDF`) |
384
389
  | `chrome_status` | `{}` | `ExecutorStatus` + displacement/heartbeat flags | read | manager (defensive cached fallback) |
385
390
 
386
391
  Notes:
392
+ - **Frame targeting.** Every target-taking tool also accepts `frameId` (pin one
393
+ frame) or `allFrames` (act in whichever frame has the element). Frame ids come
394
+ from `frames_list`. Each frame is gated against ITS OWN url by the extension
395
+ before injection, so a scan can never reach a frame the allowlist excludes.
396
+ - **Locators.** `click`/`type`/`hover`/`select_option` accept `role` + `name`
397
+ (+ `nth`) in place of selector|ref; `mcp/locate.ts` resolves it through one
398
+ snapshot server-side and fails loudly on ambiguity.
399
+ - **`observers` is one wire method** behind three tools, gated by `allowObservers`
400
+ (`--enable-observers`) on top of the domain allowlist.
387
401
  - **`screenshot` is `readOnly:true` but auto-scrolls the target into view** before capture — documented benign side effect. Returns a real `{type:'image',data,mimeType}` block (the one envelope extension over the LinkedIn repo). `read*` = read with a benign side effect.
388
402
  - **`eval` is `readOnly:false`** (arbitrary JS). Safe-mode disables `eval` and the entire mutating set unless `--unsafe-enable-eval` / `--enable-mutations`. [RESOLVED — security major eval]
389
403
  - **`eval`/all reads/all navigations call `policy.assertUrlAllowed(tab.currentUrl, method)`** before dispatch — reads are gated because reads are the exfil payload. [RESOLVED — security major 4]