@btraut/browser-bridge 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brent Traut
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Browser Bridge
2
+
3
+ Local Chrome control for coding agents. Browser Bridge provides a CLI and an
4
+ optional MCP server that drive a real Chrome instance and read page state
5
+ through a Chrome extension.
6
+
7
+ ## Requirements
8
+
9
+ - Node.js 20+
10
+ - Chrome (stable)
11
+ - Browser Bridge extension (Chrome Web Store; listing coming soon)
12
+ - Local-only usage (all services bind to 127.0.0.1)
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm i -g @btraut/browser-bridge
18
+ browser-bridge --help
19
+ ```
20
+
21
+ ## Quickstart
22
+
23
+ 1. Install the Chrome Web Store extension (listing coming soon). For local
24
+ testing without the store, you can load unpacked from:
25
+ - this repo: `packages/extension`
26
+ - npm install: `$(npm root -g)/@btraut/browser-bridge/extension`
27
+ 2. Install the Browser Bridge skill (see below).
28
+ 3. (Optional) Add Browser Bridge to your MCP client (Codex or Claude Code below).
29
+ 4. Run a quick CLI check:
30
+
31
+ ```bash
32
+ browser-bridge session create
33
+ # Use the session_id from the output for the next commands.
34
+ browser-bridge drive navigate --session-id <id> --url https://example.com
35
+ browser-bridge inspect dom-snapshot --session-id <id>
36
+ browser-bridge session close --session-id <id>
37
+ ```
38
+
39
+ ## Skills (Codex + Claude Code)
40
+
41
+ Copy the Browser Bridge skill into your agent skills directory:
42
+
43
+ ```bash
44
+ # From this repo:
45
+ # cp -R docs/skills/browser-bridge ~/.agents/skills/browser-bridge
46
+ # cp -R docs/skills/browser-bridge ~/.claude/skills/browser-bridge
47
+
48
+ # From npm (global install):
49
+ cp -R "$(npm root -g)/@btraut/browser-bridge/skills/browser-bridge" ~/.agents/skills/browser-bridge
50
+ cp -R "$(npm root -g)/@btraut/browser-bridge/skills/browser-bridge" ~/.claude/skills/browser-bridge
51
+ ```
52
+
53
+ Restart your agent app if it does not pick up the new skill automatically.
54
+
55
+ ## MCP Server (Optional)
56
+
57
+ The MCP server runs over stdio and forwards tool calls to Core. It is optional,
58
+ since you can use the CLI directly. MCP clients launch it automatically when
59
+ needed, so you typically do not run it yourself.
60
+
61
+ - Manual start (debugging): `browser-bridge mcp`
62
+ - Use your MCP client to call `tools/list`, then `session.create`
63
+ - Override Core host/port with `--host`, `--port`, or `BROWSER_BRIDGE_CORE_HOST` /
64
+ `BROWSER_BRIDGE_CORE_PORT`.
65
+
66
+ ## Add MCP (Codex CLI)
67
+
68
+ ```bash
69
+ codex mcp add browser-bridge -- browser-bridge mcp
70
+ ```
71
+
72
+ Optional custom host/port:
73
+
74
+ ```bash
75
+ codex mcp add browser-bridge \
76
+ --env BROWSER_BRIDGE_CORE_HOST=127.0.0.1 \
77
+ --env BROWSER_BRIDGE_CORE_PORT=3210 \
78
+ -- browser-bridge mcp
79
+ ```
80
+
81
+ ## Add MCP (Claude Code)
82
+
83
+ ```bash
84
+ claude mcp add --transport stdio browser-bridge -- browser-bridge mcp
85
+ ```
86
+
87
+ Optional custom host/port:
88
+
89
+ ```bash
90
+ claude mcp add --transport stdio browser-bridge \
91
+ --env BROWSER_BRIDGE_CORE_HOST=127.0.0.1 \
92
+ --env BROWSER_BRIDGE_CORE_PORT=3210 \
93
+ -- browser-bridge mcp
94
+ ```
95
+
96
+ ## Diagnostics
97
+
98
+ - CLI: `browser-bridge diagnostics doctor --session-id <id>`
99
+ - Reports extension and debugger status alongside session state.
100
+
101
+ ## Security Model (v1)
102
+
103
+ - Extension <-> Core WebSocket has no authentication; trust local machine only.
104
+ - Do not expose the port or run the Core daemon on shared hosts.
105
+
106
+ ## Development Notes
107
+
108
+ If you are contributing locally, load the extension unpacked:
109
+
110
+ 1. Open Chrome and navigate to `chrome://extensions`.
111
+ 2. Enable **Developer mode**.
112
+ 3. Click **Load unpacked** and select `packages/extension` (repo).
113
+ 4. Confirm the extension's background service worker is running.
114
+ 5. Start the Core daemon (or run `browser-bridge session create`) so the
115
+ extension can connect to `127.0.0.1`.
116
+
117
+ Additional manual test flows live in `docs/manual-test.md`.
package/dist/api.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ export type CoreServerStartOptions = {
2
+ host?: string;
3
+ port?: number;
4
+ };
5
+
6
+ export type CoreServerHandle = {
7
+ host: string;
8
+ port: number;
9
+ // Intentionally opaque: avoid forcing consumers to install @types/* packages.
10
+ server: unknown;
11
+ };
12
+
13
+ export declare const startCoreServer: (
14
+ options?: CoreServerStartOptions
15
+ ) => Promise<CoreServerHandle>;
16
+
17
+ export type McpAdapterOptions = {
18
+ name?: string;
19
+ version?: string;
20
+ host?: string;
21
+ port?: number | string;
22
+ timeoutMs?: number;
23
+ // Advanced: allow providing a preconfigured Core client.
24
+ coreClient?: unknown;
25
+ };
26
+
27
+ export type McpAdapterStartHandle = {
28
+ server: unknown;
29
+ client: unknown;
30
+ transport: unknown;
31
+ };
32
+
33
+ export declare const startMcpServer: (
34
+ options?: McpAdapterOptions
35
+ ) => Promise<McpAdapterStartHandle>;