browser-lens-mcp 4.0.1 → 4.0.3

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 (2) hide show
  1. package/README.md +128 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -103,6 +103,39 @@ Browser Lens connects your IDE's AI agent to any running web page. Ask about any
103
103
  ```
104
104
  </details>
105
105
 
106
+ <details>
107
+ <summary><strong>Antigravity (Google)</strong></summary>
108
+
109
+ **File:** `~/.gemini/antigravity/mcp_config.json`
110
+
111
+ > Open via: `...` menu (top right) → MCP Servers → Manage MCP Servers → View raw config
112
+
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "browser-lens": {
117
+ "command": "npx",
118
+ "args": ["-y", "browser-lens-mcp@latest"],
119
+ "env": {
120
+ "MCP_BROWSER_LENS_PORT": "3300",
121
+ "MCP_BROWSER_LENS_WS_PORT": "3301",
122
+ "MCP_BROWSER_LENS_CDP_PORT": "9222"
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ After saving, click **Refresh** in Manage MCP Servers.
130
+
131
+ **Usage in Antigravity chat:**
132
+ ```
133
+ @browser-lens Chụp screenshot cho tôi xem
134
+ @browser-lens/css-colors Show me the color palette
135
+ /compare_with_figma
136
+ ```
137
+ </details>
138
+
106
139
  <details>
107
140
  <summary><strong>Claude Code</strong></summary>
108
141
 
@@ -380,8 +413,83 @@ IDE ← MCP Server ← WebSocket ← Send result
380
413
  - `query_element` — Inspect any element by CSS selector on-demand
381
414
  - `fullsync` — Trigger a full data re-capture
382
415
 
383
- **Screenshot CORS handling:**
384
- Cross-origin images (CDN logos, external assets) are temporarily replaced with same-size grey placeholders before capture, then restored. This ensures screenshots always succeed while preserving layout accuracy.
416
+ ---
417
+
418
+ ## Screenshots (CDP — 100% Reliable)
419
+
420
+ Screenshots use **Chrome DevTools Protocol (CDP)** via `puppeteer-core` — captures exactly what you see in the browser. No CORS issues, no CSP restrictions, works on any page.
421
+
422
+ ### Setup: Launch browser with remote debugging
423
+
424
+ <details open>
425
+ <summary><strong>Brave Browser (Mac)</strong></summary>
426
+
427
+ ```bash
428
+ /Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser --remote-debugging-port=9222
429
+ ```
430
+ </details>
431
+
432
+ <details>
433
+ <summary><strong>Google Chrome (Mac)</strong></summary>
434
+
435
+ ```bash
436
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
437
+ ```
438
+ </details>
439
+
440
+ <details>
441
+ <summary><strong>Google Chrome (Linux)</strong></summary>
442
+
443
+ ```bash
444
+ google-chrome --remote-debugging-port=9222
445
+ ```
446
+ </details>
447
+
448
+ <details>
449
+ <summary><strong>Microsoft Edge (Mac)</strong></summary>
450
+
451
+ ```bash
452
+ /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge --remote-debugging-port=9222
453
+ ```
454
+ </details>
455
+
456
+ <details>
457
+ <summary><strong>Tip: Create a shell alias</strong></summary>
458
+
459
+ ```bash
460
+ # Add to ~/.zshrc or ~/.bashrc
461
+ alias brave-debug='/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser --remote-debugging-port=9222'
462
+ alias chrome-debug='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222'
463
+
464
+ # Then just run
465
+ brave-debug
466
+ ```
467
+ </details>
468
+
469
+ **Verify CDP is running:**
470
+
471
+ ```bash
472
+ curl http://127.0.0.1:9222/json/version
473
+ # Should show: {"Browser":"Brave/...","webSocketDebuggerUrl":"ws://..."}
474
+ ```
475
+
476
+ ### Screenshot tools
477
+
478
+ | Tool | What it does |
479
+ |------|-------------|
480
+ | `trigger_screenshot` | Capture full viewport — returns PNG image directly |
481
+ | `screenshot_element` | Capture specific element by CSS selector (e.g. `header`, `.hero-btn`) |
482
+
483
+ ### Screenshot fallback chain
484
+
485
+ ```
486
+ trigger_screenshot / screenshot_element
487
+ ├─ 1. CDP (puppeteer-core) ← primary, 100% reliable
488
+ ├─ 2. WS command → bookmarklet → html2canvas (simple pages)
489
+ └─ 3. Return cached screenshot if available
490
+ ```
491
+
492
+ CDP auto-scans ports 9222, 9229, 9333. Set `MCP_BROWSER_LENS_CDP_PORT` for custom port.
385
493
 
386
494
  ---
387
495
 
@@ -391,8 +499,26 @@ Cross-origin images (CDN logos, external assets) are temporarily replaced with s
391
499
  |----------|---------|-------------|
392
500
  | `MCP_BROWSER_LENS_PORT` | `3202` | HTTP server port |
393
501
  | `MCP_BROWSER_LENS_WS_PORT` | `3203` | WebSocket server port |
502
+ | `MCP_BROWSER_LENS_CDP_PORT` | `9222` | Chrome DevTools Protocol port for screenshots |
394
503
  | `MCP_BROWSER_LENS_STORE_PATH` | `.store/browser.json` | Custom store path |
395
504
 
505
+ **Full config example:**
506
+
507
+ ```json
508
+ {
509
+ "mcpServers": {
510
+ "browser-lens": {
511
+ "command": "npx",
512
+ "args": ["-y", "browser-lens-mcp@latest"],
513
+ "env": {
514
+ "MCP_BROWSER_LENS_PORT": "3300",
515
+ "MCP_BROWSER_LENS_WS_PORT": "3301",
516
+ "MCP_BROWSER_LENS_CDP_PORT": "9222"
517
+ }
518
+ }
519
+ }
520
+ }
521
+
396
522
  ---
397
523
 
398
524
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-lens-mcp",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "MCP server that connects to your browser for real-time DOM, CSS, layout inspection, screenshot capture, and Figma design comparison — your IDE's AI agent sees exactly what users see",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",