browser-debug-mcp-bridge 1.10.0 → 1.11.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/README.md +267 -195
- package/apps/mcp-server/dist/db/events-repository.js +61 -9
- package/apps/mcp-server/dist/db/events-repository.js.map +1 -1
- package/apps/mcp-server/dist/db/migrations.js +470 -70
- package/apps/mcp-server/dist/db/migrations.js.map +1 -1
- package/apps/mcp-server/dist/db/schema.js +134 -1
- package/apps/mcp-server/dist/db/schema.js.map +1 -1
- package/apps/mcp-server/dist/document-response-rewriter.js +196 -0
- package/apps/mcp-server/dist/document-response-rewriter.js.map +1 -0
- package/apps/mcp-server/dist/json-rewrite.js +189 -0
- package/apps/mcp-server/dist/json-rewrite.js.map +1 -0
- package/apps/mcp-server/dist/main.js +339 -2
- package/apps/mcp-server/dist/main.js.map +1 -1
- package/apps/mcp-server/dist/mcp/server.js +2146 -176
- package/apps/mcp-server/dist/mcp/server.js.map +1 -1
- package/apps/mcp-server/dist/next-asset-mapper.js +701 -0
- package/apps/mcp-server/dist/next-asset-mapper.js.map +1 -0
- package/apps/mcp-server/dist/next-source-override-planner.js +601 -0
- package/apps/mcp-server/dist/next-source-override-planner.js.map +1 -0
- package/apps/mcp-server/dist/override-audit-contract.js +51 -0
- package/apps/mcp-server/dist/override-audit-contract.js.map +1 -0
- package/apps/mcp-server/dist/override-audit.js +740 -0
- package/apps/mcp-server/dist/override-audit.js.map +1 -0
- package/apps/mcp-server/dist/override-capabilities.js +136 -0
- package/apps/mcp-server/dist/override-capabilities.js.map +1 -0
- package/apps/mcp-server/dist/override-observed-assets.js +179 -0
- package/apps/mcp-server/dist/override-observed-assets.js.map +1 -0
- package/apps/mcp-server/dist/override-poc.js +336 -0
- package/apps/mcp-server/dist/override-poc.js.map +1 -0
- package/apps/mcp-server/dist/override-profile-generator.js +403 -0
- package/apps/mcp-server/dist/override-profile-generator.js.map +1 -0
- package/apps/mcp-server/dist/override-response-planner.js +557 -0
- package/apps/mcp-server/dist/override-response-planner.js.map +1 -0
- package/apps/mcp-server/dist/override-rule-types.js +32 -0
- package/apps/mcp-server/dist/override-rule-types.js.map +1 -0
- package/apps/mcp-server/dist/retention.js +4 -3
- package/apps/mcp-server/dist/retention.js.map +1 -1
- package/apps/mcp-server/dist/rsc-flight-patch-safety.js +269 -0
- package/apps/mcp-server/dist/rsc-flight-patch-safety.js.map +1 -0
- package/apps/mcp-server/dist/websocket/messages.js +5 -0
- package/apps/mcp-server/dist/websocket/messages.js.map +1 -1
- package/apps/mcp-server/dist/websocket/websocket-server.js +10 -0
- package/apps/mcp-server/dist/websocket/websocket-server.js.map +1 -1
- package/apps/mcp-server/package.json +1 -0
- package/package.json +12 -1
package/README.md
CHANGED
|
@@ -1,106 +1,64 @@
|
|
|
1
1
|
# Browser Debug MCP Bridge
|
|
2
2
|
|
|
3
|
-
Chrome
|
|
3
|
+
Chrome extension plus local MCP runtime for debugging real browser sessions with an AI client.
|
|
4
4
|
|
|
5
|
-
It captures
|
|
5
|
+
It captures console logs, network calls, navigation, UI events, DOM snapshots, styles, layout, screenshots, and persisted failure context from an actual Chrome tab. The MCP server exposes that evidence as tools your AI client can call while you reproduce a bug.
|
|
6
6
|
|
|
7
|
-
## What
|
|
7
|
+
## What It Does
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- Keep privacy controls enabled (safe mode, allowlist, redaction)
|
|
17
|
-
|
|
18
|
-
## How It Works
|
|
19
|
-
|
|
20
|
-
1. Chrome extension captures session telemetry.
|
|
21
|
-
2. Local server ingests via HTTP/WebSocket on `127.0.0.1:8065`.
|
|
22
|
-
3. Data is persisted in local SQLite.
|
|
23
|
-
4. MCP stdio server exposes tools to your AI client.
|
|
9
|
+
- Debugs a real Chrome page instead of guessing from source code alone.
|
|
10
|
+
- Stores session telemetry locally in SQLite.
|
|
11
|
+
- Lets your AI client query recent events, console errors, failed requests, and API calls.
|
|
12
|
+
- Captures live DOM, styles, layout metrics, UI snapshots, and live console logs on demand.
|
|
13
|
+
- Correlates user actions, network failures, runtime errors, and snapshots into timelines.
|
|
14
|
+
- Keeps privacy controls local with safe mode, domain allowlists, redaction, and bounded payloads.
|
|
15
|
+
- Includes an experimental exact-asset override workflow for replacing production JS/CSS assets with local files during debugging.
|
|
24
16
|
|
|
25
17
|
## Requirements
|
|
26
18
|
|
|
27
19
|
- Node.js `>=20`
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- Chrome (Developer Mode to load unpacked extension)
|
|
31
|
-
|
|
32
|
-
## Setup Modes
|
|
33
|
-
|
|
34
|
-
### Recommended for Most Users: No-Repo Quick Setup
|
|
20
|
+
- Chrome or Chromium with extension Developer Mode enabled
|
|
21
|
+
- An MCP-capable AI client
|
|
35
22
|
|
|
36
|
-
|
|
23
|
+
## Install
|
|
37
24
|
|
|
38
|
-
|
|
25
|
+
Install the MCP runtime:
|
|
39
26
|
|
|
40
27
|
```bash
|
|
41
28
|
npm i -g browser-debug-mcp-bridge
|
|
42
29
|
```
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- `https://github.com/RobertoM80/browser-debug-mcp-bridge/releases/latest`
|
|
47
|
-
|
|
48
|
-
1. Extract the archive and load extension in Chrome:
|
|
49
|
-
|
|
50
|
-
1. Open `chrome://extensions`
|
|
51
|
-
1. Enable Developer mode
|
|
52
|
-
1. Click **Load unpacked**
|
|
53
|
-
1. Select the extracted extension folder
|
|
31
|
+
Download the Chrome extension archive from the latest GitHub release:
|
|
54
32
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
1. Find npm global root: `npm root -g`
|
|
58
|
-
1. Use script path: `<NPM_GLOBAL_ROOT>/browser-debug-mcp-bridge/scripts/mcp-start.cjs`
|
|
59
|
-
|
|
60
|
-
1. Alternative quick runtime (secondary):
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npx -y browser-debug-mcp-bridge
|
|
33
|
+
```text
|
|
34
|
+
https://github.com/RobertoM80/browser-debug-mcp-bridge/releases/latest
|
|
64
35
|
```
|
|
65
36
|
|
|
66
|
-
|
|
37
|
+
Load the extension:
|
|
67
38
|
|
|
68
|
-
|
|
39
|
+
1. Extract `chrome-extension-dist.tgz`.
|
|
40
|
+
2. Open `chrome://extensions`.
|
|
41
|
+
3. Enable Developer mode.
|
|
42
|
+
4. Click **Load unpacked**.
|
|
43
|
+
5. Select the extracted extension folder.
|
|
69
44
|
|
|
70
|
-
|
|
71
|
-
git clone https://github.com/RobertoM80/browser-debug-mcp-bridge.git
|
|
72
|
-
cd browser-debug-mcp-bridge
|
|
73
|
-
pnpm install
|
|
74
|
-
pnpm nx build mcp-server
|
|
75
|
-
pnpm nx build chrome-extension
|
|
76
|
-
```
|
|
45
|
+
## Configure Your MCP Client
|
|
77
46
|
|
|
78
|
-
|
|
47
|
+
Recommended launch method: direct `node` command pointing at the installed package script.
|
|
79
48
|
|
|
80
|
-
|
|
81
|
-
2. Enable Developer mode
|
|
82
|
-
3. Click **Load unpacked**
|
|
83
|
-
4. Select `dist/apps/chrome-extension`
|
|
84
|
-
|
|
85
|
-
Start MCP runtime:
|
|
49
|
+
Find the global npm root:
|
|
86
50
|
|
|
87
51
|
```bash
|
|
88
|
-
|
|
52
|
+
npm root -g
|
|
89
53
|
```
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
If you are using local repo mode, generate ready-to-paste snippets:
|
|
55
|
+
Use this script path:
|
|
94
56
|
|
|
95
|
-
```
|
|
96
|
-
|
|
57
|
+
```text
|
|
58
|
+
<NPM_GLOBAL_ROOT>/browser-debug-mcp-bridge/scripts/mcp-start.cjs
|
|
97
59
|
```
|
|
98
60
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Best-practice launch path: use direct `node` launch to the installed script path.
|
|
102
|
-
|
|
103
|
-
Edit `~/.codex/config.toml` (Windows: `C:\Users\<you>\.codex\config.toml`) and add:
|
|
61
|
+
OpenAI Codex CLI / Codex in VS Code example:
|
|
104
62
|
|
|
105
63
|
```toml
|
|
106
64
|
[mcp_servers.browser_debug]
|
|
@@ -108,25 +66,7 @@ command = "node"
|
|
|
108
66
|
args = ["C:\\Users\\<you>\\AppData\\Roaming\\npm\\node_modules\\browser-debug-mcp-bridge\\scripts\\mcp-start.cjs"]
|
|
109
67
|
```
|
|
110
68
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
```toml
|
|
114
|
-
[mcp_servers.browser_debug]
|
|
115
|
-
command = "node"
|
|
116
|
-
args = ["C:\\ABSOLUTE\\PATH\\TO\\browser-debug-mcp-bridge\\scripts\\mcp-start.cjs"]
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
npm quick mode (secondary):
|
|
120
|
-
|
|
121
|
-
```toml
|
|
122
|
-
[mcp_servers.browser_debug]
|
|
123
|
-
command = "npx"
|
|
124
|
-
args = ["-y", "browser-debug-mcp-bridge"]
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### OpenCode
|
|
128
|
-
|
|
129
|
-
Use JSON MCP config:
|
|
69
|
+
OpenCode or JSON-style MCP host example:
|
|
130
70
|
|
|
131
71
|
```json
|
|
132
72
|
{
|
|
@@ -141,53 +81,112 @@ Use JSON MCP config:
|
|
|
141
81
|
}
|
|
142
82
|
```
|
|
143
83
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
Use the same values:
|
|
84
|
+
Quick secondary option:
|
|
147
85
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"
|
|
151
|
-
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"browser-debug": {
|
|
90
|
+
"command": "npx",
|
|
91
|
+
"args": ["-y", "browser-debug-mcp-bridge"]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
152
96
|
|
|
153
|
-
|
|
97
|
+
## First Debug Session
|
|
154
98
|
|
|
155
|
-
|
|
99
|
+
1. Start your MCP client so it launches the bridge.
|
|
100
|
+
2. Open the target page in Chrome.
|
|
101
|
+
3. Open the Browser Debug extension popup.
|
|
102
|
+
4. Add the page origin to the allowlist.
|
|
103
|
+
5. Click **Start session**.
|
|
104
|
+
6. Ask your AI client to call `list_sessions`.
|
|
105
|
+
7. Pick a session where `liveConnection.connected` is `true`.
|
|
156
106
|
|
|
157
|
-
|
|
158
|
-
- Open extension popup, allowlist domain, start a session.
|
|
159
|
-
- Ask your AI client to run:
|
|
107
|
+
Useful first tool call:
|
|
160
108
|
|
|
161
109
|
```json
|
|
162
110
|
{ "name": "list_sessions", "arguments": { "sinceMinutes": 60 } }
|
|
163
111
|
```
|
|
164
112
|
|
|
165
|
-
|
|
166
|
-
- Run query tools first (`get_session_summary`, `get_recent_events`, `get_network_failures`).
|
|
167
|
-
- Use live tools (`get_dom_document`, `capture_ui_snapshot`, `get_live_console_logs`) only on connected sessions.
|
|
113
|
+
Then query persisted evidence first with `get_session_summary`, `get_recent_events`, `get_console_events`, `get_network_failures`, and `get_network_calls`.
|
|
168
114
|
|
|
169
|
-
|
|
115
|
+
Use live capture tools only on connected sessions: `get_dom_document`, `get_dom_subtree`, `get_computed_styles`, `get_layout_metrics`, `capture_ui_snapshot`, and `get_live_console_logs`.
|
|
170
116
|
|
|
171
|
-
|
|
172
|
-
- Telemetry from unbound tabs is rejected to avoid cross-tab contamination.
|
|
173
|
-
- Use the popup `Session Tabs` panel to explicitly add/remove tabs from the active session.
|
|
174
|
-
- If all bound tabs are removed/closed, the session auto-stops.
|
|
117
|
+
## Tool List
|
|
175
118
|
|
|
176
|
-
|
|
119
|
+
Session and health:
|
|
177
120
|
|
|
178
|
-
- `
|
|
179
|
-
- `
|
|
180
|
-
- `
|
|
121
|
+
- `list_sessions`
|
|
122
|
+
- `get_live_session_health`
|
|
123
|
+
- `get_session_summary`
|
|
181
124
|
|
|
182
|
-
|
|
125
|
+
Events, console, and navigation:
|
|
183
126
|
|
|
184
127
|
- `get_recent_events`
|
|
185
128
|
- `get_navigation_history`
|
|
186
129
|
- `get_console_events`
|
|
130
|
+
- `get_console_summary`
|
|
131
|
+
- `get_event_summary`
|
|
132
|
+
- `get_live_console_logs`
|
|
133
|
+
|
|
134
|
+
Network and API debugging:
|
|
135
|
+
|
|
187
136
|
- `get_network_failures`
|
|
188
137
|
- `get_network_calls`
|
|
138
|
+
- `wait_for_network_call`
|
|
139
|
+
- `get_request_trace`
|
|
140
|
+
- `get_body_chunk`
|
|
141
|
+
|
|
142
|
+
Live UI capture:
|
|
143
|
+
|
|
144
|
+
- `get_element_refs`
|
|
145
|
+
- `get_dom_subtree`
|
|
146
|
+
- `get_dom_document`
|
|
147
|
+
- `get_computed_styles`
|
|
148
|
+
- `get_layout_metrics`
|
|
149
|
+
- `capture_ui_snapshot`
|
|
150
|
+
|
|
151
|
+
Failure analysis and snapshots:
|
|
152
|
+
|
|
153
|
+
- `explain_last_failure`
|
|
154
|
+
- `get_event_correlation`
|
|
155
|
+
- `list_snapshots`
|
|
156
|
+
- `get_snapshot_for_event`
|
|
157
|
+
- `get_snapshot_asset`
|
|
158
|
+
|
|
159
|
+
Experimental overrides:
|
|
160
|
+
|
|
161
|
+
- `list_override_profiles`
|
|
162
|
+
- `create_override_profile`
|
|
163
|
+
- `validate_override_profile`
|
|
164
|
+
- `observe_override_assets`
|
|
165
|
+
- `list_observed_override_assets`
|
|
166
|
+
- `map_next_override_assets`
|
|
167
|
+
- `plan_next_source_override`
|
|
168
|
+
- `enable_overrides`
|
|
169
|
+
- `disable_overrides`
|
|
170
|
+
- `get_override_status`
|
|
171
|
+
- `get_override_request_log`
|
|
172
|
+
- `diagnose_overrides`
|
|
173
|
+
|
|
174
|
+
## Session Scope
|
|
175
|
+
|
|
176
|
+
Sessions are tab-bound by default.
|
|
177
|
+
|
|
178
|
+
- The active tab is bound when you start a session.
|
|
179
|
+
- Telemetry from unbound tabs is rejected to avoid cross-tab contamination.
|
|
180
|
+
- Use the popup `Session Tabs` panel to add or remove tabs from the active session.
|
|
181
|
+
- If all bound tabs are removed or closed, the session auto-stops.
|
|
189
182
|
|
|
190
|
-
|
|
183
|
+
Query tools accept `sessionId`, `url`, or both.
|
|
184
|
+
|
|
185
|
+
- `sessionId`: only that session.
|
|
186
|
+
- `url`: that origin across sessions, for example `http://localhost:3000`.
|
|
187
|
+
- `sessionId` plus `url`: intersection of both filters.
|
|
188
|
+
|
|
189
|
+
Example URL-only query:
|
|
191
190
|
|
|
192
191
|
```json
|
|
193
192
|
{
|
|
@@ -196,7 +195,7 @@ Example: URL-only query
|
|
|
196
195
|
}
|
|
197
196
|
```
|
|
198
197
|
|
|
199
|
-
Example
|
|
198
|
+
Example session and URL query:
|
|
200
199
|
|
|
201
200
|
```json
|
|
202
201
|
{
|
|
@@ -205,20 +204,23 @@ Example: session + URL intersection
|
|
|
205
204
|
}
|
|
206
205
|
```
|
|
207
206
|
|
|
208
|
-
## Live Console Logs
|
|
209
|
-
|
|
210
|
-
`get_live_console_logs` reads from extension in-memory ring buffers (session-scoped), so this live stream can be filtered without DB scanning.
|
|
207
|
+
## Live Console Logs
|
|
211
208
|
|
|
212
|
-
|
|
213
|
-
- optional filters: `url` (origin), `tabId`, `levels`, `contains`, `sinceTs`
|
|
214
|
-
- supports substring filters like `"[auth]"` directly server-side
|
|
215
|
-
- results are bounded by `limit` and buffer capacity
|
|
209
|
+
`get_live_console_logs` reads from extension memory, not the SQLite event log. It is useful for current-page console debugging with server-side filters.
|
|
216
210
|
|
|
217
|
-
|
|
211
|
+
Supported filters:
|
|
218
212
|
|
|
219
|
-
-
|
|
220
|
-
-
|
|
221
|
-
-
|
|
213
|
+
- `sessionId`
|
|
214
|
+
- `url`
|
|
215
|
+
- `tabId`
|
|
216
|
+
- `levels`
|
|
217
|
+
- `contains`
|
|
218
|
+
- `sinceTs`
|
|
219
|
+
- `dedupeWindowMs`
|
|
220
|
+
- `responseProfile`
|
|
221
|
+
- `includeArgs`
|
|
222
|
+
- `maxResponseBytes`
|
|
223
|
+
- `limit`
|
|
222
224
|
|
|
223
225
|
Example:
|
|
224
226
|
|
|
@@ -230,105 +232,175 @@ Example:
|
|
|
230
232
|
"url": "http://localhost:3000",
|
|
231
233
|
"levels": ["info", "error"],
|
|
232
234
|
"contains": "[auth]",
|
|
235
|
+
"responseProfile": "compact",
|
|
233
236
|
"limit": 100
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
239
|
```
|
|
237
240
|
|
|
238
|
-
##
|
|
241
|
+
## Experimental Asset Overrides
|
|
239
242
|
|
|
240
|
-
|
|
243
|
+
Overrides let you test local JS/CSS files against a real production page by intercepting exact asset URLs in one selected tab.
|
|
241
244
|
|
|
242
|
-
|
|
243
|
-
- On Windows, launcher tries automatic stale bridge recovery first.
|
|
244
|
-
- If port is still occupied, startup fails with `MCP_STARTUP_PORT_IN_USE`.
|
|
245
|
-
- In that case, free/reserve port `8065` for this bridge and restart.
|
|
246
|
-
- Launcher reports `Started` only after `/health` becomes reachable on `127.0.0.1:8065`.
|
|
247
|
-
- In `mcp-stdio` mode, bridge lifecycle is tied to the host and should stop when host transport closes.
|
|
248
|
-
- If a stale process still remains, stop it explicitly with `node scripts/mcp-start.cjs --stop`.
|
|
249
|
-
- Optional: set `MCP_STARTUP_TIMEOUT_MS` (default `15000`) for slower machines.
|
|
245
|
+
Current scope:
|
|
250
246
|
|
|
251
|
-
|
|
247
|
+
- One active profile with one or more exact URL-to-file rules.
|
|
248
|
+
- One explicitly selected bound tab.
|
|
249
|
+
- Cache disable and service-worker bypass through Chrome debugger protocol.
|
|
250
|
+
- Durable run and request logs.
|
|
251
|
+
- MCP control, status, request log, and diagnosis tools.
|
|
252
|
+
- Candidate profile generation through adapters.
|
|
253
|
+
- Live production asset observation, persistence, and Next.js source-to-chunk candidate mapping.
|
|
254
|
+
- Optional production/local drift checks with fetched asset hashes and normalized signatures.
|
|
255
|
+
- Next.js source-edit planning with temp overlay builds and safe literal patching of observed chunks.
|
|
252
256
|
|
|
253
|
-
|
|
257
|
+
Supported generator adapters:
|
|
254
258
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
| Adapter | Use case | Main inputs |
|
|
260
|
+
| --- | --- | --- |
|
|
261
|
+
| `nextjs` | Next.js apps built into `.next` | `targetBaseUrl`, optional `projectRoot`, optional `nextDir` |
|
|
262
|
+
| `static` | Any built asset directory, including Vite, Angular, Vue, SvelteKit, Remix, or no framework | `targetBaseUrl`, optional `projectRoot`, optional `assetRoot` |
|
|
259
263
|
|
|
260
|
-
|
|
264
|
+
The override runtime is framework-agnostic. Adapters only generate exact `targetAssetUrl` to `localFilePath` rules. The same browser replacement, validation, audit, and diagnosis path is used for every framework.
|
|
261
265
|
|
|
262
|
-
|
|
266
|
+
Observe production assets from a live session:
|
|
263
267
|
|
|
264
|
-
```
|
|
265
|
-
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"name": "observe_override_assets",
|
|
271
|
+
"arguments": { "sessionId": "sess_123" }
|
|
272
|
+
}
|
|
266
273
|
```
|
|
267
274
|
|
|
268
|
-
|
|
275
|
+
Observed assets are persisted per session and can be reused when the live tab is no longer connected:
|
|
269
276
|
|
|
270
|
-
```
|
|
271
|
-
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"name": "list_observed_override_assets",
|
|
280
|
+
"arguments": { "sessionId": "sess_123" }
|
|
281
|
+
}
|
|
272
282
|
```
|
|
273
283
|
|
|
274
|
-
|
|
284
|
+
Map observed Next.js assets back to local build chunks and source paths:
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"name": "map_next_override_assets",
|
|
289
|
+
"arguments": {
|
|
290
|
+
"sessionId": "sess_123",
|
|
291
|
+
"projectRoot": "C:/path/to/app",
|
|
292
|
+
"route": "/products",
|
|
293
|
+
"sourcePaths": ["src/app/products/page.tsx"],
|
|
294
|
+
"fetchProductionAssets": true
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
275
298
|
|
|
276
|
-
|
|
277
|
-
- `MCP_STARTUP_PORT_IN_USE`: required MCP port is blocked. Fix: stop the process using that port and restart bridge.
|
|
299
|
+
`fetchProductionAssets` reports whether observed production bytes match the local build. Hash/signature drift lowers confidence and adds a `PRODUCTION_LOCAL_DRIFT` blocker. Drift checks are opt-in and bounded by `maxDriftCandidates` (default 20), `productionFetchConcurrency` (default 4), `productionFetchTimeoutMs`, and `maxProductionAssetBytes` so normal mapping stays fast.
|
|
278
300
|
|
|
279
|
-
|
|
301
|
+
Plan a browser-only source edit for an observed Next.js route:
|
|
280
302
|
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"name": "plan_next_source_override",
|
|
306
|
+
"arguments": {
|
|
307
|
+
"sessionId": "sess_123",
|
|
308
|
+
"projectRoot": "C:/path/to/app",
|
|
309
|
+
"route": "/products",
|
|
310
|
+
"sourceEdits": [
|
|
311
|
+
{
|
|
312
|
+
"filePath": "src/app/products/page.tsx",
|
|
313
|
+
"search": "Original headline",
|
|
314
|
+
"replacement": "Override headline"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"configPath": "C:/path/to/app/override-poc.local.json",
|
|
318
|
+
"writeConfig": true,
|
|
319
|
+
"overlayTtlMs": 86400000
|
|
320
|
+
}
|
|
321
|
+
}
|
|
293
322
|
```
|
|
294
323
|
|
|
295
|
-
|
|
324
|
+
Temp overlay builds are created under `tmp/bn/<id>`. Expired overlays are cleaned automatically when `plan_next_source_override` runs.
|
|
325
|
+
|
|
326
|
+
`diagnose_overrides` also uses persisted observations to report target URL mismatches, SRI, CSP meta tags, and service-worker control. The extension popup surfaces the same compact blocker summary.
|
|
296
327
|
|
|
297
|
-
|
|
328
|
+
Generate a Next.js candidate profile:
|
|
298
329
|
|
|
299
|
-
|
|
300
|
-
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"name": "create_override_profile",
|
|
333
|
+
"arguments": {
|
|
334
|
+
"adapter": "nextjs",
|
|
335
|
+
"projectRoot": "C:/path/to/app",
|
|
336
|
+
"targetBaseUrl": "https://www.example.com/_next/",
|
|
337
|
+
"writeConfig": true
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
```
|
|
301
341
|
|
|
302
|
-
|
|
342
|
+
Generate a generic static-assets profile:
|
|
303
343
|
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"name": "create_override_profile",
|
|
347
|
+
"arguments": {
|
|
348
|
+
"adapter": "static",
|
|
349
|
+
"projectRoot": "C:/path/to/app",
|
|
350
|
+
"assetRoot": "dist/assets",
|
|
351
|
+
"targetBaseUrl": "https://www.example.com/assets/",
|
|
352
|
+
"writeConfig": true
|
|
353
|
+
}
|
|
354
|
+
}
|
|
307
355
|
```
|
|
308
356
|
|
|
357
|
+
Generated configs are disabled by default. Review exact production URLs before enabling.
|
|
358
|
+
|
|
359
|
+
To make the runtime load your config, set `OVERRIDE_POC_CONFIG_PATH` in your MCP server environment to the generated config file path, then restart the MCP server.
|
|
360
|
+
|
|
361
|
+
Planned adapter direction:
|
|
362
|
+
|
|
363
|
+
1. Keep `static` as the universal fallback.
|
|
364
|
+
2. Add framework-specific manifest adapters only when they improve mapping confidence.
|
|
365
|
+
3. Add observed production URL ingestion for stronger generated mappings.
|
|
366
|
+
4. Add dedicated Angular, Vue/Nuxt, Vite, SvelteKit, Remix, and other adapters as needed.
|
|
367
|
+
|
|
368
|
+
Known current limits:
|
|
369
|
+
|
|
370
|
+
- Exact URL matching only.
|
|
371
|
+
- No pattern or fuzzy matching yet.
|
|
372
|
+
- No robust SRI/CSP rewrite flow yet.
|
|
373
|
+
- Generated profiles do not yet ingest observed production network URLs.
|
|
374
|
+
|
|
375
|
+
## Runtime Storage
|
|
376
|
+
|
|
377
|
+
Runtime data is local to your machine.
|
|
378
|
+
|
|
379
|
+
- Windows: `%LOCALAPPDATA%\browser-debug-mcp-bridge`
|
|
380
|
+
- macOS: `~/Library/Application Support/browser-debug-mcp-bridge`
|
|
381
|
+
- Linux: `$XDG_STATE_HOME/browser-debug-mcp-bridge` or `$XDG_DATA_HOME/browser-debug-mcp-bridge`
|
|
382
|
+
- Fallback: `~/.local/share/browser-debug-mcp-bridge`
|
|
383
|
+
|
|
384
|
+
Set `DATA_DIR` only if you want to override the default local storage path.
|
|
385
|
+
|
|
386
|
+
## Port And Startup
|
|
387
|
+
|
|
388
|
+
Default local port: `8065`.
|
|
389
|
+
|
|
390
|
+
- The launcher uses a single-instance lock.
|
|
391
|
+
- Startup reports ready only after `/health` responds on `127.0.0.1:8065`.
|
|
392
|
+
- `MCP_STARTUP_PORT_IN_USE` means another process is using the port.
|
|
393
|
+
- `LIVE_SESSION_DISCONNECTED` means the session is historical or no extension is currently connected.
|
|
394
|
+
|
|
395
|
+
Stop a stale bridge process:
|
|
396
|
+
|
|
309
397
|
```bash
|
|
310
|
-
|
|
311
|
-
bash ./install.sh
|
|
398
|
+
node <NPM_GLOBAL_ROOT>/browser-debug-mcp-bridge/scripts/mcp-start.cjs --stop
|
|
312
399
|
```
|
|
313
400
|
|
|
314
|
-
##
|
|
401
|
+
## Docs
|
|
315
402
|
|
|
316
403
|
- [MCP tools reference](https://github.com/RobertoM80/browser-debug-mcp-bridge/blob/main/docs/MCP_TOOLS.md)
|
|
317
404
|
- [MCP client setup](https://github.com/RobertoM80/browser-debug-mcp-bridge/blob/main/docs/MCP_CLIENT_SETUP.md)
|
|
318
405
|
- [Troubleshooting](https://github.com/RobertoM80/browser-debug-mcp-bridge/blob/main/docs/TROUBLESHOOTING.md)
|
|
319
|
-
- [Architecture](https://github.com/RobertoM80/browser-debug-mcp-bridge/blob/main/docs/ARCHITECTURE.md)
|
|
320
406
|
- [Security and privacy](https://github.com/RobertoM80/browser-debug-mcp-bridge/blob/main/SECURITY.md)
|
|
321
|
-
|
|
322
|
-
## Repository Layout
|
|
323
|
-
|
|
324
|
-
```text
|
|
325
|
-
apps/
|
|
326
|
-
mcp-server/ Fastify + WebSocket ingest + MCP server
|
|
327
|
-
chrome-extension/ MV3 extension (background/content/injected)
|
|
328
|
-
viewer/ Optional UI
|
|
329
|
-
libs/
|
|
330
|
-
shared/ Shared schemas/types/utils
|
|
331
|
-
redaction/ Privacy redaction engine
|
|
332
|
-
selectors/ Selector generation
|
|
333
|
-
mcp-contracts/ MCP tool contracts and schemas
|
|
334
|
-
```
|