bwb-browser 2.0.0 → 2.0.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 (4) hide show
  1. package/AGENTS.md +200 -0
  2. package/bin/bwb +3 -2
  3. package/package.json +11 -22
  4. package/server.mjs +2 -3
package/AGENTS.md ADDED
@@ -0,0 +1,200 @@
1
+ # bwb-browser — Agent Integration Guide
2
+
3
+ > **Author:** Krish Tiwari ([@krshforever](https://github.com/krshforever))
4
+ > **Package:** [`bwb-browser`](https://www.npmjs.com/package/bwb-browser) · 30KB · 15 tools
5
+ > **Last updated:** 2026-07-28
6
+
7
+ ## What is bwb?
8
+
9
+ **Browser Without Bloat** — a lightweight MCP (Model Context Protocol) server that gives any AI agent the ability to browse the web, take screenshots, click elements, fill forms, execute JavaScript, and **watch live page events** (console, network, navigation, exceptions).
10
+
11
+ Unlike Playwright MCP (200MB+), Puppeteer MCP (400MB+), or Chrome DevTools MCP (300MB+), bwb is **30KB** with **zero heavy dependencies** — just raw CDP. Works on Termux/Android, Linux, macOS, Windows, and CI.
12
+
13
+ ---
14
+
15
+ ## Compatible Agents
16
+
17
+ | Agent | Integration | Verified |
18
+ |-------|-----------|----------|
19
+ | **Claude Code** (Anthropic) | MCP config → `~/.claude/settings.json` | ✅ |
20
+ | **OpenCode** | MCP config → `~/.config/opencode/opencode.json` | ✅ |
21
+ | **Antigravity CLI** | MCP config → `~/.gemini/antigravity-cli/mcp_config.json` | ✅ |
22
+ | **Cline** (VS Code) | MCP config → VS Code settings or `~/.cline/mcp.json` | ✅ |
23
+ | **Continue.dev** | MCP config → `~/.continue/config.json` | ✅ |
24
+ | **Aider** | Custom tool integration | ✅ |
25
+ | **Codex CLI** | MCP config → `~/.codex/mcp.json` | ✅ |
26
+ | **Cody** (Sourcegraph) | MCP config | ✅ |
27
+ | **Windsurf** | MCP config | ✅ |
28
+ | **Cursor** | MCP config → `.cursor/mcp.json` | ✅ |
29
+ | **Any MCP-compatible agent** | MCP stdio transport | ✅ |
30
+
31
+ ---
32
+
33
+ ## Quick Install (60 seconds)
34
+
35
+ ```bash
36
+ # 1. Install globally
37
+ npm install -g bwb-browser
38
+
39
+ # 2. Verify it works
40
+ bwb --version
41
+ # → bwb-browser 2.0.0
42
+
43
+ # 3. Add to your AI agent's MCP config
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 🔥 Copy-Paste Prompt for Your AI Agent
49
+
50
+ Give this to any AI agent (Claude, OpenCode, Gemini, etc.) to auto-install and configure bwb:
51
+
52
+ ```
53
+ I want you to install and use bwb-browser — a 30KB MCP browser automation server.
54
+
55
+ bwb is Browser Without Bloat. It uses raw Chrome DevTools Protocol (no Playwright, no Puppeteer).
56
+ It has 15 tools including the groundbreaking `browser_watch` tool — the first MCP browser tool
57
+ that captures live console messages, network requests, JS exceptions, and page navigations.
58
+
59
+ Created by Krish Tiwari (@krshforever). npm package: bwb-browser
60
+
61
+ ## Auto-Install Steps:
62
+
63
+ 1. Check if bwb-browser is already installed:
64
+ ```bash
65
+ npm list -g bwb-browser 2>/dev/null || echo "not installed"
66
+ ```
67
+
68
+ 2. If not installed, install globally:
69
+ ```bash
70
+ npm install -g bwb-browser
71
+ ```
72
+
73
+ 3. Detect which MCP config file to update based on the current agent:
74
+ - Claude Code → ~/.claude/settings.json
75
+ - OpenCode → ~/.config/opencode/opencode.json
76
+ - Antigravity → ~/.gemini/antigravity-cli/mcp_config.json
77
+ - Cline → ~/.cline/mcp.json
78
+ - Continue → ~/.continue/config.json
79
+ - Cursor → .cursor/mcp.json (project root)
80
+
81
+ 4. Add this MCP server entry (adjust for your config format):
82
+ ```json
83
+ "bwb": {
84
+ "type": "local",
85
+ "command": ["node", "/path/to/bwb/server.mjs"]
86
+ }
87
+ ```
88
+
89
+ Or if installed globally:
90
+ ```json
91
+ "bwb": {
92
+ "type": "local",
93
+ "command": ["bwb"]
94
+ }
95
+ ```
96
+
97
+ 5. Verify the config is valid JSON and the file has proper syntax.
98
+
99
+ 6. Test the integration by calling `browser_status` tool — it should return `connected: true`
100
+ (it starts Chromium automatically on first call).
101
+
102
+ ## Skill: I Know How to Use bwb
103
+
104
+ When using bwb for web tasks, follow these patterns:
105
+
106
+ ### Basic Browsing
107
+ - `browser_goto({url: "https://example.com"})` — navigate to a page
108
+ - `browser_title()` — check page title
109
+ - `browser_screenshot()` — take a screenshot (also saves to /storage/emulated/0/Download/bwb-screenshots/ on Android or ~/bwb-screenshots/ on desktop)
110
+ - `browser_text()` — get page text content
111
+ - `browser_html()` — get page HTML
112
+ - `browser_elements({kind: "links"|"buttons"|"inputs"|"headings"})` — find interactive elements
113
+
114
+ ### Interaction
115
+ - `browser_fill({selector: "#search", text: "query"})` — fill input fields
116
+ - `browser_click({selector: "button"})` — click elements (uses native CDP mouse events)
117
+ - `browser_eval({expression: "document.title"})` — execute arbitrary JS
118
+
119
+ ### 🔥 Groundbreaking: Live Page Watching
120
+ - `browser_watch({action: "start", events: ["all"]})` — start recording page activity
121
+ - `browser_goto(...)` / `browser_click(...)` — interact with the page
122
+ - `browser_watch({action: "poll"})` — get all console messages, network requests, errors that happened
123
+ - `browser_watch({action: "stop"})` — stop recording
124
+
125
+ This is how you debug SPAs, detect React errors, see API calls, and understand what the page is DOING
126
+ internally — not just what it looks like.
127
+
128
+ ### Smart Waiting
129
+ - `browser_waitForSelector({selector: ".results", timeout: 10000})` — wait for content to appear
130
+ - `browser_waitForSelector({selector: ".loading", disappear: true})` — wait for loading to finish
131
+
132
+ ### Viewport Control
133
+ - `browser_setViewport({width: 1920, height: 1080})` — change viewport size
134
+
135
+ ### Error Handling
136
+ - If `browser_goto` fails: check if Chrome/Chromium is installed. On Termux: `pkg install chromium`
137
+ - If `browser_elements` returns empty: the page might use shadow DOM or iframes
138
+ - If `browser_click` fails: try `browser_eval({expression: "document.querySelector('...').click()"})` as fallback
139
+ - If screenshots are blank: check `--headless` setting
140
+
141
+ ## Tools Reference
142
+
143
+ | Tool | Description |
144
+ |------|-------------|
145
+ | `browser_goto` | Navigate to a URL |
146
+ | `browser_screenshot` | Take a screenshot (saves to disk + returns base64) |
147
+ | `browser_html` | Get page/selector HTML |
148
+ | `browser_text` | Get page/selector visible text |
149
+ | `browser_click` | Click an element (native CDP mouse events) |
150
+ | `browser_fill` | Fill an input field (native CDP keyboard events) |
151
+ | `browser_elements` | List interactive elements by kind |
152
+ | `browser_title` | Get page title |
153
+ | `browser_url` | Get current URL |
154
+ | `browser_eval` | Execute JavaScript (with exception capture) |
155
+ | `browser_status` | Browser connection status |
156
+ | `browser_watch` | 🔥 GROUNDBREAKING: Live event capture |
157
+ | `browser_waitForSelector` | Wait for element to appear/disappear |
158
+ | `browser_setViewport` | Change viewport size |
159
+ | `browser_back` | Go back in history |
160
+
161
+ ## Security Notes
162
+
163
+ - bwb spawns a headless Chromium process on your machine. The browser has network access.
164
+ - Screenshots are saved to public storage. Do not browse to pages with sensitive content if you share your device.
165
+ - The MCP connection is local stdio only — no network exposure.
166
+ - `browser_eval` executes arbitrary JavaScript in the browser context. Use with caution.
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Pro Tips
172
+
173
+ ### On Termux/Android
174
+ Screenshots save to `/storage/emulated/0/Download/bwb-screenshots/` — accessible from any file manager.
175
+ Chrome/Chromium install: `pkg install chromium`
176
+
177
+ ### On Desktop/Linux
178
+ Screenshots save to `~/bwb-screenshots/`.
179
+ Chrome auto-detection works for: google-chrome, chromium-browser, chromium, google-chrome-stable.
180
+
181
+ ### On macOS
182
+ Screenshots save to `~/bwb-screenshots/`.
183
+ Chrome path: `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`
184
+
185
+ ### On Windows
186
+ Screenshots save to `%USERPROFILE%\bwb-screenshots\`.
187
+ Chrome path: `C:\Program Files\Google\Chrome\Application\chrome.exe`
188
+
189
+ ### Custom Browser Path
190
+ ```bash
191
+ BWB_CHROME_PATH=/path/to/chrome bwb
192
+ # or
193
+ bwb --browser-path /path/to/chrome
194
+ ```
195
+
196
+ ---
197
+
198
+ ## License
199
+
200
+ MIT — Krish Tiwari ([@krshforever](https://github.com/krshforever))
package/bin/bwb CHANGED
@@ -1,2 +1,3 @@
1
- #!/usr/bin/env node
2
- import("../server.mjs").catch(e => { console.error("bwb:", e.message); process.exit(1); });
1
+ #!/bin/sh
2
+ SCRIPT="$(readlink -f "$0" 2>/dev/null || realpath "$0" 2>/dev/null || echo "$0")"
3
+ exec node "$(dirname "$SCRIPT")/../server.mjs" "$@"
package/package.json CHANGED
@@ -1,26 +1,16 @@
1
1
  {
2
2
  "name": "bwb-browser",
3
- "version": "2.0.0",
4
- "description": "Browser Without Bloat — lightweight browser automation MCP server using raw CDP. 30KB, zero bloat, works on any platform.",
3
+ "version": "2.0.2",
4
+ "description": "Browser Without Bloat — 30KB MCP browser automation server. Raw CDP, zero bloat, works on any platform.",
5
5
  "bin": {
6
6
  "bwb": "bin/bwb"
7
7
  },
8
8
  "files": [
9
9
  "server.mjs",
10
10
  "bin/bwb",
11
- "AGENTS.md"
12
- ],
13
- "keywords": ["browser", "automation", "mcp", "cdp", "chrome", "headless", "ai-agent", "llm"],
14
- "license": "MIT",
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/krshforever/bwb-browser.git"
18
- },
19
- "files": [
20
- "bin/bwb",
21
- "server.mjs",
22
- "README.md",
23
- "LICENSE"
11
+ "AGENTS.md",
12
+ "LICENSE",
13
+ "README.md"
24
14
  ],
25
15
  "scripts": {
26
16
  "start": "node server.mjs",
@@ -33,22 +23,21 @@
33
23
  "automation",
34
24
  "cdp",
35
25
  "chrome-devtools-protocol",
36
- "termux",
37
- "android",
38
26
  "headless",
39
27
  "bwb",
40
- "browser-without-bloat"
28
+ "browser-without-bloat",
29
+ "ai-agent"
41
30
  ],
42
- "author": "krsh",
31
+ "author": "Krish Tiwari (@krshforever)",
43
32
  "license": "MIT",
44
33
  "repository": {
45
34
  "type": "git",
46
- "url": "git+https://github.com/krshforever/bwb-browser-termux.git"
35
+ "url": "git+https://github.com/krshforever/bwb-browser.git"
47
36
  },
48
37
  "bugs": {
49
- "url": "https://github.com/krshforever/bwb-browser-termux/issues"
38
+ "url": "https://github.com/krshforever/bwb-browser/issues"
50
39
  },
51
- "homepage": "https://github.com/krshforever/bwb-browser-termux#readme",
40
+ "homepage": "https://github.com/krshforever/bwb-browser#readme",
52
41
  "engines": {
53
42
  "node": ">=18.0.0"
54
43
  },
package/server.mjs CHANGED
@@ -39,7 +39,7 @@ function parseArgs() {
39
39
  case "--headless": cfg.headless = args[++i] !== "false"; break;
40
40
  case "--screenshots-dir": cfg.screenshotsDir = args[++i]; break;
41
41
  case "--timeout": cfg.navTimeout = parseInt(args[++i], 10); break;
42
- case "--version": console.log("bwb-browser 2.0.0"); process.exit(0);
42
+ case "--version": console.log("bwb-browser 2.0.2"); process.exit(0);
43
43
  case "--help": printHelp(); process.exit(0);
44
44
  }
45
45
  }
@@ -600,7 +600,7 @@ async function waitForSelector(runtime, selector, opts = {}) {
600
600
 
601
601
  const server = new McpServer({
602
602
  name: "bwb-browser",
603
- version: "2.0.0",
603
+ version: "2.0.2",
604
604
  });
605
605
 
606
606
  // Tool implementations
@@ -800,7 +800,6 @@ const tools = {
800
800
  return { content: [{ type: "text", text: JSON.stringify(status) }] };
801
801
  },
802
802
  },
803
- };
804
803
 
805
804
  // ─── GROUNDBREAKING: Live Browser Event Capture ─────────────────────────
806
805
  // No other MCP browser server gives the agent feedback from the page.