mcp-browser-dev-tools 0.0.1-beta.1 → 0.0.1-beta.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.
package/README.md CHANGED
@@ -10,9 +10,10 @@ It is designed for a local trust boundary:
10
10
 
11
11
  - A stdio MCP server for local desktop and terminal clients
12
12
  - Browser discovery and attach/detach for Chromium-family browsers and Firefox
13
- - Read-oriented tools for DOM inspection, element lookup, console messages, network requests, screenshots, tab listing, and buffered events
13
+ - Inspection tools for DOM lookup, richer element details, console messages, network requests, screenshots, tab listing, and buffered events
14
+ - Page interaction tools for navigation, reload, click, hover, type, select, key presses, scroll, and viewport overrides
14
15
  - Optional JavaScript evaluation behind an explicit environment flag
15
- - Helper commands to check browser connectivity and launch a debug-enabled browser
16
+ - Helper commands to check browser connectivity, launch a debug-enabled browser, and relay CDP traffic across a local machine boundary
16
17
 
17
18
  ## Requirements
18
19
 
@@ -22,6 +23,8 @@ It is designed for a local trust boundary:
22
23
 
23
24
  ## Install
24
25
 
26
+ If you are trying the prerelease from npm, replace `mcp-browser-dev-tools` below with `mcp-browser-dev-tools@beta`.
27
+
25
28
  One-off execution with `npx`:
26
29
 
27
30
  ```bash
@@ -42,6 +45,35 @@ npm install mcp-browser-dev-tools
42
45
  npx mcp-browser-dev-tools serve
43
46
  ```
44
47
 
48
+ ## Try It Locally
49
+
50
+ You can smoke-test the broker before wiring it into an MCP client.
51
+
52
+ For Windows, WSL, macOS, and Linux-specific setup paths, see [docs/setup.md](docs/setup.md).
53
+
54
+ Quick Chromium flow:
55
+
56
+ ```bash
57
+ # Launch a local browser with remote debugging enabled
58
+ npx -y mcp-browser-dev-tools@beta open https://example.com --family chromium
59
+
60
+ # Verify that the browser endpoint and page are reachable
61
+ npx -y mcp-browser-dev-tools@beta doctor --url https://example.com
62
+
63
+ # Start the MCP server in a dedicated terminal
64
+ npx -y mcp-browser-dev-tools@beta serve
65
+ ```
66
+
67
+ `serve` stays attached to stdio because MCP clients talk to it over standard input and output. Run it in its own terminal or let your MCP client spawn it directly.
68
+
69
+ If you already have a browser listening on `http://127.0.0.1:9222`, `doctor` is enough to confirm that the broker can reach it:
70
+
71
+ ```bash
72
+ CDP_BASE_URL=http://127.0.0.1:9222 npx -y mcp-browser-dev-tools@beta doctor
73
+ ```
74
+
75
+ If you need to bridge Windows Chrome into WSL without changing WSL networking mode, run the relay on Windows and point WSL at the relay port instead. The full procedure is in [docs/setup.md](docs/setup.md).
76
+
45
77
  ## MCP Client Configuration
46
78
 
47
79
  Generic stdio client configuration:
@@ -68,6 +100,7 @@ For Firefox, switch `MCP_BROWSER_FAMILY` to `firefox` and set `FIREFOX_BIDI_WS_U
68
100
  - `serve` runs the MCP broker over stdio
69
101
  - `doctor [--url URL]` checks browser reachability, local display state, and optional page access
70
102
  - `open <url>` launches a local browser with remote debugging enabled
103
+ - `relay` forwards TCP traffic, useful for Windows-to-WSL DevTools bridging
71
104
  - `--help` and `help` print usage
72
105
  - `--version` and `version` print the package version
73
106
 
@@ -77,6 +110,7 @@ Examples:
77
110
  mcp-browser-dev-tools doctor
78
111
  mcp-browser-dev-tools doctor --url http://127.0.0.1:3000
79
112
  mcp-browser-dev-tools open http://127.0.0.1:3000 --family chromium
113
+ mcp-browser-dev-tools relay --wsl
80
114
  ```
81
115
 
82
116
  ## Configuration
@@ -92,6 +126,8 @@ mcp-browser-dev-tools open http://127.0.0.1:3000 --family chromium
92
126
 
93
127
  The `open` command also requires `MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1` before it will bind Chromium remote debugging to a non-loopback address.
94
128
 
129
+ The `relay` command defaults to `127.0.0.1:9223 -> 127.0.0.1:9222`. Non-loopback relay binds require either `--wsl` on Windows or `MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1`.
130
+
95
131
  ## Exposed Tools
96
132
 
97
133
  - `browser_status`
@@ -99,6 +135,16 @@ The `open` command also requires `MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1` before i
99
135
  - `list_sessions`
100
136
  - `attach_tab`
101
137
  - `detach_tab`
138
+ - `get_page_state`
139
+ - `navigate`
140
+ - `reload`
141
+ - `click`
142
+ - `hover`
143
+ - `type`
144
+ - `select`
145
+ - `press_key`
146
+ - `scroll`
147
+ - `set_viewport`
102
148
  - `get_console_messages`
103
149
  - `get_network_requests`
104
150
  - `get_document`
@@ -110,11 +156,33 @@ The `open` command also requires `MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1` before i
110
156
 
111
157
  For tools that take `sessionId`, call `attach_tab` first and reuse the returned session.
112
158
 
159
+ ### Locator Syntax
160
+
161
+ Interaction and inspection tools accept these locator forms:
162
+
163
+ - CSS selectors such as `#app button.primary` or `css=.modal button`
164
+ - visible-text lookup such as `text=プラン比較`
165
+ - role plus accessible name such as `role=button[name="プラン比較"]`
166
+ - accessible-name lookup such as `name=プラン比較`
167
+
168
+ `inspect_element` returns layout and accessibility-focused metadata including bounding box, visibility flags, interactivity flags, accessible name, inferred role, and a subset of computed styles. Invalid CSS selectors now return an explicit locator error instead of a generic DOM failure.
169
+
170
+ ### Screenshot Output
171
+
172
+ `take_screenshot` returns base64 image data plus metadata such as `mimeType`, `byteLength`, and `scope`. Pass `selector` to capture a single element instead of the full page.
173
+
113
174
  ## Browser Notes
114
175
 
115
176
  - Chromium uses the standard DevTools endpoints at `/json/version` and `/json/list`
116
177
  - Firefox support expects a direct BiDi websocket endpoint
117
178
  - In WSL, Linux browser executables are preferred before Windows fallback paths
179
+ - For Windows Chrome + WSL, prefer the `relay` command over changing Chrome's remote debugging bind
180
+
181
+ ## Debugging Notes
182
+
183
+ - `attach_tab` now seeds network history from the Performance API so already-loaded pages still show useful requests
184
+ - console buffers include source URL, line and column where the browser reports them, plus stack frames when available
185
+ - `get_page_state` reports the current URL, title, viewport, and scroll position without enabling `evaluate_js`
118
186
 
119
187
  ## Safety Defaults
120
188
 
@@ -137,5 +205,6 @@ The repository uses `pnpm` for local development and CI. End-user installation a
137
205
  Additional docs:
138
206
 
139
207
  - [Architecture](docs/architecture.md)
208
+ - [Setup Guide](docs/setup.md)
140
209
  - [Repository Settings](docs/repository-settings.md)
141
210
  - [Publishing](PUBLISHING.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-browser-dev-tools",
3
- "version": "0.0.1-beta.1",
3
+ "version": "0.0.1-beta.3",
4
4
  "description": "Local MCP server for Chromium DevTools Protocol and Firefox WebDriver BiDi",
5
5
  "author": "Hinaser <rindo.hinase@gmail.com>",
6
6
  "type": "module",
@@ -31,9 +31,11 @@
31
31
  "src/index.mjs",
32
32
  "src/json-rpc-stdio.mjs",
33
33
  "src/mcp-server.mjs",
34
+ "src/page-context.mjs",
34
35
  "src/package-info.mjs",
35
36
  "src/session-events.mjs",
36
37
  "src/server.mjs",
38
+ "src/tcp-relay.mjs",
37
39
  "README.md"
38
40
  ],
39
41
  "bin": {