@branch42-labs/netraptor-mcp 0.5.0 → 0.6.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 CHANGED
@@ -1,9 +1,13 @@
1
1
  # @branch42-labs/netraptor-mcp
2
2
 
3
- Netraptor's local, read-only MCP server lets coding agents query API traffic captured by the Netraptor Chrome extension. Captured data stays on your computer.
3
+ Netraptor's local, read-only MCP server lets coding agents query API traffic captured by the Netraptor Chrome extension. Captured requests are stored in your browser; the local bridge shares tool results with your chosen MCP clients.
4
+
5
+ **Supported setup:** Chrome stable on desktop (normal windows), one browser profile per bridge, and MCP clients running on the same computer. Several clients can share that bridge. Edge, Brave, incognito, remote/container clients and running several browsers at once are not part of the initial support. See the [support contract](https://github.com/branch42-labs/netraptor-extension/blob/master/docs/support-contract.md).
4
6
 
5
7
  ## Setup
6
8
 
9
+ **Upgrading to 0.6.0:** update both this package and the Chrome extension. Refresh the package with `npx -y @branch42-labs/netraptor-mcp@latest`, stop the old bridge, restart your agent, then call `list_sessions` and confirm the source again. Mixed 0.5.x/0.6.x pairs refuse traffic reads; the browser identity checks are never bypassed for compatibility.
10
+
7
11
  1. In Netraptor, open **Settings → Local MCP server** and copy the pairing command.
8
12
  2. Run it once, then enable the Local MCP server switch.
9
13
  3. Configure your MCP client.
@@ -37,51 +41,123 @@ Cursor (use `~/.cursor/mcp.json` for every project):
37
41
  }
38
42
  ```
39
43
 
40
- The bridge listens only on `127.0.0.1:47321`. Set `NETRAPTOR_MCP_PORT` for the server and use the same port in extension settings to change it.
44
+ The bridge listens only on `127.0.0.1:47321`. Codex, Claude Code, Cursor, and concurrent agent sessions share one authenticated local bridge. Closing one agent does not disconnect the others. The bridge exits five seconds after the last agent disconnects; a later agent starts it again. Stop any older running Netraptor MCP process once when upgrading to this shared-bridge version.
45
+
46
+ ## Ports, config directories and more than one browser
47
+
48
+ Two settings select a bridge, and the pairing secret belongs to the second one:
49
+
50
+ | Setting | Default | Set in the extension | Set for the MCP process |
51
+ | --- | --- | --- | --- |
52
+ | Port | `47321` | Settings → Local MCP server → Port | `NETRAPTOR_MCP_PORT` |
53
+ | Config directory | `~/.netraptor` | not applicable | `NETRAPTOR_HOME` (and the `pair` command) |
54
+
55
+ `pair` writes the secret to `$NETRAPTOR_HOME/mcp.json`, not to a file named after the port. Two browsers that use different ports but the same directory therefore overwrite each other's pairing. A port alone does not isolate secrets.
56
+
57
+ One bridge serves one browser at a time. If a second browser authenticates to the same bridge, it replaces the first connection and pending calls to the first fail. Do not point two browsers at one bridge.
58
+
59
+ To run an independent second browser or profile, give it **both** its own port and its own directory, and use the same pair in the extension and in the client. Use an absolute directory path. Replace the placeholders; the pairing code is secret, so paste it into your own terminal only.
60
+
61
+ 1. In browser B, set **Settings → Local MCP server → Port** to `47322` and turn the server on.
62
+ 2. Pair browser B into its own directory:
63
+
64
+ ```sh
65
+ NETRAPTOR_HOME="$HOME/.netraptor-browser-b" npx -y @branch42-labs/netraptor-mcp pair <PAIRING_CODE_FROM_BROWSER_B>
66
+ ```
67
+
68
+ 3. Add a second MCP server entry that starts with the same directory and port.
69
+
70
+ Codex:
71
+
72
+ ```sh
73
+ codex mcp add netraptor-b --env NETRAPTOR_HOME="$HOME/.netraptor-browser-b" --env NETRAPTOR_MCP_PORT=47322 -- npx -y @branch42-labs/netraptor-mcp
74
+ ```
41
75
 
42
- Codex, Claude Code, Cursor, and concurrent agent sessions share one authenticated local bridge. Closing one agent does not disconnect the others. The bridge exits five seconds after the last agent disconnects; a later agent starts it again. Stop any older running Netraptor MCP process once when upgrading to this shared-bridge version.
76
+ Claude Code (keep `--transport stdio` between the last `--env` and the server name):
77
+
78
+ ```sh
79
+ claude mcp add --scope user --env NETRAPTOR_HOME="$HOME/.netraptor-browser-b" --env NETRAPTOR_MCP_PORT=47322 --transport stdio netraptor-b -- npx -y @branch42-labs/netraptor-mcp
80
+ ```
81
+
82
+ Cursor:
83
+
84
+ ```json
85
+ {
86
+ "mcpServers": {
87
+ "netraptor-b": {
88
+ "command": "npx",
89
+ "args": ["-y", "@branch42-labs/netraptor-mcp"],
90
+ "env": {
91
+ "NETRAPTOR_HOME": "/absolute/path/to/.netraptor-browser-b",
92
+ "NETRAPTOR_MCP_PORT": "47322"
93
+ }
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ Set the variables before the client starts, and start a new agent session after changing them. A running bridge keeps the directory and port of the process that started it, so a client configured with a different directory fails authentication, and one with a different port reaches a different bridge. Shell examples are for macOS/Linux shells; on Windows use your shell's own syntax for the same variables. Always confirm which browser's session an agent is reading (see below).
43
100
 
44
101
  ## Query and follow live API traffic
45
102
 
46
- Match the **Tab ID** and **Session #ID** shown in Netraptor's popup or panel. Before reading traffic, the agent must show them with the name, origin and capture state and ask you to confirm. If you already supplied an explicit ID, that counts as confirmation. If two or more live sessions are available, the agent must ask which one to use. Content tools require a `tabId` or `sessionId`; they never silently choose the newest capture. Prefer `tabId` for live recordings: it keeps following that tab when Stop/Start gives it a new Session #ID. Confirm again before switching.
103
+ Match the **Tab ID** and **Session #ID** shown in Netraptor's popup or panel. Before reading traffic, the agent must show them with the name, origin and capture state and ask you to confirm. If you already supplied an explicit ID, that counts as confirmation. If two or more live sessions are available, the agent must ask which one to use. It never silently chooses the newest capture.
104
+
105
+ **`browserInstanceId` is required on all five traffic-read tools** (`watch_requests`, `list_endpoints`, `get_endpoint`, `search`, `get_request`), including saved sessions and request IDs. Pass the value from the confirmed `list_sessions` entry together with the `tabId` or `sessionId` (`get_request` takes `sessionId`). The extension rejects a missing or different value, and the server withholds any answer whose echoed identity differs. An older extension or MCP server that does not send or echo it gets an update error instead of traffic; `list_sessions` then reports `browserInstanceId: null`.
106
+
107
+ Session, request and tab IDs are numbered per browser profile. `browserInstanceId` changes, and every earlier confirmation, saved sessions included, is rejected, when:
108
+
109
+ - the browser restarts;
110
+ - the Netraptor extension is reloaded, updated, disabled and re-enabled (Chrome clears the extension's session storage);
111
+ - a different browser or profile is the one connected to the bridge (for example after pairing another browser).
112
+
113
+ Call `list_sessions` and confirm again. This is intentionally conservative. A reconnect of the same browser's service worker does not change it.
114
+
115
+ For a live recording pass the `tabId`: it keeps following that tab when Stop/Start gives it a new Session #ID. Pass `sessionId` for saved sessions that no tab is recording. A recording belongs to its tab until you stop it, turn Keep history off or close the tab, so it follows that tab across navigations to other origins; navigating to a different app does not by itself start a new session. Stop and Start does.
47
116
 
48
117
  With extension **0.5.0 or newer**, `list_sessions` reports `captureState`, `isLive`, `lastRequestAt` and `lastRequestId`. Live means an open tab has history enabled and its capture channel is responding; the old `status: running` flag alone does not prove this. Paused, inactive, history-off, disconnected and unverified channels are distinguished. Older extensions report unknown live state. An empty watch batch is an idle interval, not evidence that history is off. Compare the request cursor and last-call time after generating a known API call to verify traffic is arriving.
49
118
 
50
- The **DevTools-only feed** includes all network resource types and is separate from saved API traffic. It has no MCP session ID. Use the saved Session #ID, rather than comparing its API-call count to the DevTools feed's total request count.
119
+ ### Saved history versus the DevTools feed
51
120
 
52
- Turn on **Keep history for this site** in the extension and use your app normally. New fetch/XHR calls are saved continuously, even with DevTools closed, and MCP queries read those current records. The temporary DevTools live table is a separate capture source and is not exposed through MCP.
121
+ These are two sources with different contents:
53
122
 
54
- The live feed requires Chrome extension **0.4.0 or newer**. The other five tools continue to work with earlier extension versions while the update rolls out.
123
+ - **Saved history** (what MCP reads): `fetch` and `XMLHttpRequest` calls made by page scripts in tabs with **Keep history** or temporary crawl recording, including frames Netraptor can hook inside them. It runs with DevTools closed. Images, scripts, stylesheets, documents, WebSocket, EventSource, `sendBeacon` and requests made by service or web workers are not saved, and calls before recording began cannot be recovered. Reload after enabling Keep history. Request headers reflect what the page supplied, so browser-added request headers such as `Cookie` are absent; response headers are those the browser exposes to the page.
124
+ - **DevTools-only feed**: everything Chrome's DevTools network log reports for the one tab being inspected, all resource types, only while the Netraptor DevTools panel is open. It is held in memory in that panel, has no MCP session ID and is unavailable through MCP. Parallel history recording saves page fetch/XHR calls separately, not this full resource feed. Its request count is not comparable to a saved session's API-call count.
125
+
126
+ ### Tools
55
127
 
56
128
  1. `list_sessions` discovers saved sessions, their origins, checked capture state, last activity and IDs. Ask the user to confirm the correct Session #ID.
57
- 2. `list_endpoints` lists its API endpoints; pass `tabId` or `sessionId` to keep the query scoped to the right app.
58
- 3. `search` finds endpoints by URL, template, or GraphQL operation within the confirmed `tabId` or `sessionId`.
59
- 4. `get_endpoint` returns schema and examples. Prefer its stable `key`, and pass `tabId` or `sessionId`.
60
- 5. `get_request` reads headers and bodies for an example's request ID. Pass the confirmed `sessionId` too; a request from another session is rejected.
61
- 6. `watch_requests` follows newly captured requests: start with `{ "tabId": 123, "afterId": 0 }`, then use each response's `nextCursor` as the next `afterId`. Drain `hasMore` pages before adding `waitMs: 5000` to wait for new calls. Empty batches are normal. Results contain request IDs and compact metadata; use `get_request` for bodies.
129
+ 2. `list_endpoints` lists its API endpoints, e.g. `{ "sessionId": 12, "browserInstanceId": "<from list_sessions>" }`.
130
+ 3. `search` finds endpoints by URL, template, or GraphQL operation within the confirmed `tabId` or `sessionId`. Redacted URL values cannot be searched.
131
+ 4. `get_endpoint` returns schema and examples. Prefer its stable `key`.
132
+ 5. `get_request` reads headers and bodies for an example's request ID. Pass the confirmed `sessionId` and `browserInstanceId`; a request from another session or browser is rejected.
133
+ 6. `watch_requests` follows newly captured requests: start with `{ "tabId": 123, "browserInstanceId": "<from list_sessions>", "afterId": 0 }`, then use each response's `nextCursor` as the next `afterId`. Drain `hasMore` pages before adding `waitMs: 5000` to wait for new calls. Empty batches are normal. Results contain request IDs and compact metadata; use `get_request` for bodies.
62
134
 
63
- This live feed uses bounded long polling. It does not push unsolicited notifications into an agent conversation. Recording must be enabled for the site, and an agent must call the tools to read traffic. Choose a new session ID if you stop recording and begin a new session.
135
+ This live feed uses bounded long polling. It does not push unsolicited notifications into an agent conversation. Recording must be enabled for the site, and an agent must call the tools to read traffic.
64
136
 
65
137
  ## Connection troubleshooting
66
138
 
67
- - **Pairing failed:** run the current browser's pairing command again, then use **Reconnect** in Netraptor Settings. Regenerating a code also requires pairing again. Pairing another browser replaces the secret stored on this computer.
68
- - **Waiting for server:** launch or reconnect Netraptor in your coding agent. The extension's switch connects to the server; it does not start an agent process.
139
+ - **Pairing failed:** run the current browser's pairing command again (with the same `NETRAPTOR_HOME` the client uses), then use **Reconnect** in Netraptor Settings. Regenerating a code also requires pairing again.
140
+ - **Waiting for server:** launch or reconnect Netraptor in your coding agent. The extension's switch connects to the server; it does not start an agent process. Check that the extension port and `NETRAPTOR_MCP_PORT` match.
69
141
  - **Tools missing after setup:** start a new agent session or reload its MCP configuration. In Codex, verify registration with `codex mcp list`.
142
+ - **Another browser took over:** a bridge has one active extension. The newest authenticated one wins. Use one browser per bridge, or the separate port and directory setup above.
70
143
  - **Empty sessions / no new calls:** enable **Keep history for this site**, then reload or exercise the app. Queries cannot recover requests made before recording was enabled.
71
- - **A session appears stuck:** check its exact ID, `captureState` and `lastRequestAt`, rather than selecting by name or highest count. An extension update can orphan the relay in an existing page; 0.5.0 repairs that relay without wrapping fetch/XHR again. If it reports `reload_required`, reload that page. `save_failed` means requests could not reach saved history; `unverified` means generate a new API call to verify the channel. Browsing another app in the same tab starts a new session ID.
144
+ - **A session appears stuck:** check its exact ID, `captureState` and `lastRequestAt`, rather than selecting by name or highest count. An extension update can orphan the relay in an existing page; 0.5.0 repairs that relay without wrapping fetch/XHR again. If it reports `reload_required`, reload that page. `save_failed` means requests could not reach saved history; `unverified` means generate a new API call to verify the channel.
72
145
 
73
146
  ## Security model
74
147
 
75
148
  - The listener binds to loopback only.
76
149
  - The browser-data WebSocket accepts only a `chrome-extension://` Origin. The separate agent channel requires the native client's Origin and an agent-specific HMAC proof. Both channels mutually authenticate before captured data flows.
77
- - Pairing codes look like `NR-772S-Y1F1-Q74G-R12P-8P1J-1CYS-D0` (128-bit secret). Pairing stores a derived secret in `~/.netraptor/mcp.json` with mode `0600`.
150
+ - Pairing codes look like `NR-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX` (128-bit secret). Treat them as secrets. Pairing stores a derived secret in `$NETRAPTOR_HOME/mcp.json` (default `~/.netraptor/mcp.json`) with mode `0600`.
78
151
  - Every connection performs mutual HMAC-SHA256 challenge/response before captured data is accepted or sent.
79
152
  - Agent processes authenticate separately to the shared bridge using an agent-specific HMAC role. A web page cannot use this channel.
80
153
  - Only one authenticated extension connection is active; a newer connection replaces it.
81
- - All exposed tools are read-only, and authorization/cookie headers are redacted.
154
+ - Pairing again, or regenerating the code in Netraptor, replaces the stored secret. The bridge re-reads it at connection upgrade, tool forwarding, handshake completion and browser response delivery. When a successful read observes a changed or removed secret, it closes the old browser and agent connections and fails their pending calls before accepting the handshake or releasing the response. An idle connection stays open until its next boundary. If reading `mcp.json` fails, the loaded secret stays in force. Agents reconnect with the new secret on their next call and must list and reconfirm sessions before reading, because the connected browser may be a different one.
155
+ - All exposed tools are read-only. Credential-like headers, URL query and fragment parameters (including OAuth `code`), URL userinfo, `Location`/`Referer`-style URL headers (relative references such as `//cdn.example/cb` keep their target), form fields and JSON fields at any depth (including GraphQL variables) are redacted by name. A truncated or unparseable JSON body is withheld (`requestBodyOmitted`/`responseBodyOmitted`). Values under unrecognized names, plain text and binary bodies are returned as captured.
82
156
 
83
157
  To pair again, generate a new code in Netraptor Settings and run:
84
158
 
85
159
  ```sh
86
- npx -y @branch42-labs/netraptor-mcp pair <code>
160
+ npx -y @branch42-labs/netraptor-mcp pair <PAIRING_CODE>
87
161
  ```
162
+
163
+ If the client uses a non-default `NETRAPTOR_HOME`, run it with the same variable set. Removing the extension does not delete the pairing file on your computer; delete `$NETRAPTOR_HOME` (default `~/.netraptor`) yourself if you no longer use Netraptor.
@@ -14,7 +14,12 @@ export declare class ExtensionBridgeServer {
14
14
  private counter;
15
15
  private readonly pending;
16
16
  private readonly agents;
17
+ private generation;
18
+ private reads;
19
+ private applied;
17
20
  constructor(pairing: PairingConfig | undefined, host?: string, port?: number, requestTimeoutMs?: number, loadPairing?: (() => Promise<PairingConfig | undefined>) | undefined, onAgentsChanged?: ((count: number) => void) | undefined);
21
+ /** Re-pairing or unpairing revokes every socket and pending call authenticated with the old secret. */
22
+ private refreshPairing;
18
23
  get address(): {
19
24
  host: string;
20
25
  port: number;
@@ -23,6 +28,7 @@ export declare class ExtensionBridgeServer {
23
28
  listen(): Promise<void>;
24
29
  close(): Promise<void>;
25
30
  request(method: string, params: Record<string, unknown>): Promise<unknown>;
31
+ private forward;
26
32
  private authenticate;
27
33
  private agentRequest;
28
34
  private rejectPending;
@@ -18,6 +18,9 @@ export class ExtensionBridgeServer {
18
18
  counter = 0;
19
19
  pending = new Map();
20
20
  agents = new Set();
21
+ generation = 0;
22
+ reads = 0;
23
+ applied = 0;
21
24
  constructor(pairing, host = "127.0.0.1", port = 47321, requestTimeoutMs = REQUEST_TIMEOUT_MS,
22
25
  // Re-read on each connection so pairing after the agent started the server works.
23
26
  loadPairing, onAgentsChanged) {
@@ -36,8 +39,11 @@ export class ExtensionBridgeServer {
36
39
  response.writeHead(404).end();
37
40
  });
38
41
  this.http.on("upgrade", async (request, socket, head) => {
39
- if (this.loadPairing)
40
- this.pairing = await this.loadPairing().catch(() => this.pairing);
42
+ // A client can reset while pairing is re-read; without a listener that error kills the shared daemon.
43
+ socket.on("error", () => socket.destroy());
44
+ await this.refreshPairing();
45
+ if (socket.destroyed)
46
+ return;
41
47
  // Web pages can't send a chrome-extension:// Origin; the HMAC handshake then
42
48
  // proves the extension holds the pairing secret.
43
49
  const agent = request.url === "/agent" && request.headers.origin === "netraptor-mcp";
@@ -50,6 +56,31 @@ export class ExtensionBridgeServer {
50
56
  this.wss.handleUpgrade(request, socket, head, (ws) => this.authenticate(ws, agent));
51
57
  });
52
58
  }
59
+ /** Re-pairing or unpairing revokes every socket and pending call authenticated with the old secret. */
60
+ async refreshPairing() {
61
+ if (!this.loadPairing)
62
+ return;
63
+ const read = ++this.reads;
64
+ let next;
65
+ try {
66
+ next = { pairing: await this.loadPairing() };
67
+ }
68
+ catch {
69
+ // A failed read keeps the current pairing; callers at a boundary must never see a rejection.
70
+ }
71
+ // Concurrent reads can settle out of order; an older read must not restore a revoked secret.
72
+ if (!next || read < this.applied)
73
+ return;
74
+ this.applied = read;
75
+ if (next.pairing?.secret === this.pairing?.secret)
76
+ return;
77
+ this.pairing = next.pairing;
78
+ this.generation++;
79
+ this.rejectPending();
80
+ this.active = undefined;
81
+ for (const client of this.wss.clients)
82
+ client.close(1008, "Pairing changed");
83
+ }
53
84
  get address() {
54
85
  const address = this.http.address();
55
86
  return address && typeof address === "object"
@@ -82,11 +113,16 @@ export class ExtensionBridgeServer {
82
113
  this.http.close((error) => error ? reject(error) : resolve());
83
114
  });
84
115
  }
85
- async request(method, params) {
86
- if (!this.pairing && this.loadPairing)
87
- this.pairing = await this.loadPairing();
116
+ request(method, params) {
117
+ return this.forward(method, params);
118
+ }
119
+ async forward(method, params, generation) {
120
+ await this.refreshPairing();
88
121
  if (!this.pairing)
89
122
  throw new Error(NOT_PAIRED);
123
+ // An agent authenticated with a revoked secret must not reach the newly paired browser.
124
+ if (generation !== undefined && generation !== this.generation)
125
+ throw new Error(NOT_CONNECTED);
90
126
  const ws = this.active;
91
127
  if (!ws || ws.readyState !== WebSocket.OPEN)
92
128
  throw new Error(NOT_CONNECTED);
@@ -108,6 +144,7 @@ export class ExtensionBridgeServer {
108
144
  }
109
145
  authenticate(ws, agent = false) {
110
146
  const pairing = this.pairing;
147
+ const generation = this.generation;
111
148
  if (!pairing) {
112
149
  ws.close(1008, "Not paired");
113
150
  return;
@@ -122,7 +159,49 @@ export class ExtensionBridgeServer {
122
159
  this.rejectPending(ws);
123
160
  });
124
161
  const fail = () => ws.close(1008, "Authentication failed");
162
+ let finishing = false;
163
+ const complete = () => {
164
+ clearTimeout(timeout);
165
+ ws.off("message", onHandshake);
166
+ if (agent) {
167
+ this.agents.add(ws);
168
+ this.onAgentsChanged?.(this.agents.size);
169
+ ws.once("close", () => {
170
+ this.agents.delete(ws);
171
+ this.onAgentsChanged?.(this.agents.size);
172
+ });
173
+ ws.on("message", (raw) => {
174
+ const request = parseMessage(raw);
175
+ if (request?.type === "ping") {
176
+ ws.send(JSON.stringify({ type: "pong" }));
177
+ }
178
+ else if (typeof request?.id === "string" && typeof request.method === "string") {
179
+ const params = request.params && typeof request.params === "object" && !Array.isArray(request.params)
180
+ ? request.params : {};
181
+ void this.agentRequest(ws, generation, request.method, params).then((result) => { if (ws.readyState === WebSocket.OPEN)
182
+ ws.send(JSON.stringify({ id: request.id, result })); }, (error) => { if (ws.readyState === WebSocket.OPEN)
183
+ ws.send(JSON.stringify({ id: request.id, error: error instanceof Error ? error.message : String(error) })); });
184
+ }
185
+ });
186
+ ws.send(JSON.stringify({ type: "authenticated" }));
187
+ return;
188
+ }
189
+ const previous = this.active;
190
+ this.active = ws;
191
+ if (previous && previous !== ws) {
192
+ this.rejectPending(previous);
193
+ previous.close(4001, "Replaced by newer connection");
194
+ }
195
+ ws.on("message", (data) => void this.onMessage(ws, data));
196
+ ws.on("close", () => {
197
+ if (this.active === ws)
198
+ this.active = undefined;
199
+ });
200
+ ws.send(JSON.stringify({ type: "authenticated" }));
201
+ };
125
202
  const onHandshake = (raw) => {
203
+ if (finishing)
204
+ return;
126
205
  const message = parseMessage(raw);
127
206
  if (message?.type === "client-challenge" && typeof message.challenge === "string" && !clientChallenge) {
128
207
  clientChallenge = message.challenge;
@@ -136,43 +215,14 @@ export class ExtensionBridgeServer {
136
215
  if (message?.type === "client-proof"
137
216
  && serverProved
138
217
  && validHmac(pairing.secret, agent ? "agent" : "extension", serverChallenge, message.proof)) {
139
- clearTimeout(timeout);
140
- ws.off("message", onHandshake);
141
- if (agent) {
142
- this.agents.add(ws);
143
- this.onAgentsChanged?.(this.agents.size);
144
- ws.once("close", () => {
145
- this.agents.delete(ws);
146
- this.onAgentsChanged?.(this.agents.size);
147
- });
148
- ws.on("message", (raw) => {
149
- const request = parseMessage(raw);
150
- if (request?.type === "ping") {
151
- ws.send(JSON.stringify({ type: "pong" }));
152
- }
153
- else if (typeof request?.id === "string" && typeof request.method === "string") {
154
- const params = request.params && typeof request.params === "object" && !Array.isArray(request.params)
155
- ? request.params : {};
156
- void this.agentRequest(ws, request.method, params).then((result) => { if (ws.readyState === WebSocket.OPEN)
157
- ws.send(JSON.stringify({ id: request.id, result })); }, (error) => { if (ws.readyState === WebSocket.OPEN)
158
- ws.send(JSON.stringify({ id: request.id, error: error instanceof Error ? error.message : String(error) })); });
159
- }
160
- });
161
- ws.send(JSON.stringify({ type: "authenticated" }));
162
- return;
163
- }
164
- const previous = this.active;
165
- this.active = ws;
166
- if (previous && previous !== ws) {
167
- this.rejectPending(previous);
168
- previous.close(4001, "Replaced by newer connection");
169
- }
170
- ws.on("message", (data) => this.onMessage(ws, data));
171
- ws.on("close", () => {
172
- if (this.active === ws)
173
- this.active = undefined;
218
+ finishing = true;
219
+ // The proof can arrive long after the upgrade; accept it only if the pairing is still current now.
220
+ void this.refreshPairing().then(() => {
221
+ if (generation !== this.generation || ws.readyState !== WebSocket.OPEN)
222
+ fail();
223
+ else
224
+ complete();
174
225
  });
175
- ws.send(JSON.stringify({ type: "authenticated" }));
176
226
  return;
177
227
  }
178
228
  fail();
@@ -180,7 +230,7 @@ export class ExtensionBridgeServer {
180
230
  ws.on("message", onHandshake);
181
231
  ws.send(JSON.stringify({ type: "server-challenge", challenge: serverChallenge }));
182
232
  }
183
- async agentRequest(ws, method, params) {
233
+ async agentRequest(ws, generation, method, params) {
184
234
  // The agent can initialize before the extension's reconnect timer fires.
185
235
  const deadline = Date.now() + 12_000;
186
236
  while (!this.connected && ws.readyState === WebSocket.OPEN && Date.now() < deadline) {
@@ -188,18 +238,18 @@ export class ExtensionBridgeServer {
188
238
  }
189
239
  if (ws.readyState !== WebSocket.OPEN)
190
240
  throw new Error(NOT_CONNECTED);
191
- return this.request(method, params);
241
+ return this.forward(method, params, generation);
192
242
  }
193
243
  rejectPending(ws) {
194
244
  for (const [id, pending] of this.pending) {
195
- if (pending.socket !== ws)
245
+ if (ws && pending.socket !== ws)
196
246
  continue;
197
247
  clearTimeout(pending.timer);
198
248
  this.pending.delete(id);
199
249
  pending.reject(new Error(NOT_CONNECTED));
200
250
  }
201
251
  }
202
- onMessage(ws, raw) {
252
+ async onMessage(ws, raw) {
203
253
  const message = parseMessage(raw);
204
254
  if (message?.type === "ping") {
205
255
  ws.send(JSON.stringify({ type: "pong" }));
@@ -207,11 +257,16 @@ export class ExtensionBridgeServer {
207
257
  }
208
258
  if (typeof message?.id !== "string")
209
259
  return;
210
- const pending = this.pending.get(message.id);
260
+ const id = message.id;
261
+ const pending = this.pending.get(id);
211
262
  if (!pending || pending.socket !== ws)
212
263
  return;
264
+ // A response can be held across a re-pairing; revoked, timed-out or closed calls are gone from the map afterwards.
265
+ await this.refreshPairing();
266
+ if (this.pending.get(id) !== pending)
267
+ return;
213
268
  clearTimeout(pending.timer);
214
- this.pending.delete(message.id);
269
+ this.pending.delete(id);
215
270
  if (typeof message.error === "string")
216
271
  pending.reject(new Error(message.error));
217
272
  else
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-server.js","sourceRoot":"","sources":["../src/bridge-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAgB,MAAM,IAAI,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAsB,MAAM,eAAe,CAAC;AAEjE,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,yTAAyT,CAAC;AACvV,MAAM,CAAC,MAAM,UAAU,GAAG,iHAAiH,CAAC;AAS5I,MAAM,OAAO,qBAAqB;IAStB;IACS;IACA;IACA;IAEA;IACA;IAdF,IAAI,CAAa;IACjB,GAAG,GAAG,IAAI,eAAe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CAAC;QACxB,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;;YAC3E,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -10,34 +10,44 @@ function text(value) {
10
10
  }],
11
11
  };
12
12
  }
13
+ const browserInstanceId = z.string().min(1)
14
+ .describe("browserInstanceId from the list_sessions entry the user confirmed. Required for every traffic read. It changes when the browser restarts or a different browser connects. Tab IDs can be reused and saved IDs are local to each browser profile; call list_sessions and reconfirm, including saved sessions after a restart.");
13
15
  const target = {
14
16
  tabId: z.number().int().positive().optional()
15
17
  .describe("Browser Tab ID confirmed with the user (tabIds in list_sessions). Follows that tab's current recording."),
18
+ browserInstanceId,
16
19
  sessionId: z.number().int().positive().optional()
17
20
  .describe("Session ID confirmed with the user; match Session #ID in Netraptor. Use for saved sessions no tab is recording."),
18
21
  };
19
22
  const hasTarget = ({ tabId, sessionId }) => tabId !== undefined || sessionId !== undefined;
20
23
  const targetMessage = { message: "Provide the confirmed tabId or sessionId." };
24
+ const CONTENT_TOOLS = new Set(["watch_requests", "list_endpoints", "get_endpoint", "search", "get_request"]);
25
+ const UPDATE_EXTENSION = "This Netraptor Chrome extension cannot prove its traffic comes from the browser the user confirmed. Update the extension, then call list_sessions and ask the user to confirm the session or tab again.";
21
26
  export function createMcpServer(bridge) {
22
27
  const server = new McpServer({ name: "netraptor", version }, {
23
- instructions: "Netraptor provides read-only access to saved API traffic. FIRST call list_sessions. Before reading session traffic, ask the user to confirm the browser tab (Tab ID from tabIds), Session #ID, name, origin and captureState exactly as shown in Netraptor. If the user already explicitly supplied that tab or session ID, treat it as confirmation. If two or more live sessions are available, ask which one to use; NEVER choose by newest timestamp or request count. For a live recording pass the confirmed tabId: it keeps following that tab when Stop/Start gives it a new Session #ID. Pass sessionId for saved sessions that no tab is recording. isLive/captureState report checked browser recording state; historical status=running alone does NOT mean live. Unknown/unverified requires checking, reload_required means reload the affected page, and an empty watch batch only means no new saved requests during the wait, not that history is disabled. list_sessions and all session responses include lastRequestAt/lastRequestId to verify activity. The DevTools-only feed is separate and unavailable through MCP. After confirmation use scoped search, get_endpoint and get_request. Follow traffic with watch_requests and nextCursor; drain hasMore then wait up to 5000ms. Reconfirm before switching tabs or sessions. Sensitive headers, URLs and top-level JSON fields are redacted; other body data may remain sensitive.",
28
+ instructions: "Netraptor provides read-only access to saved API traffic. FIRST call list_sessions. Before reading session traffic, ask the user to confirm the browser tab (Tab ID from tabIds), Session #ID, name, origin and captureState exactly as shown in Netraptor. If the user already explicitly supplied that tab or session ID, treat it as confirmation. If two or more live sessions are available, ask which one to use; NEVER choose by newest timestamp or request count. Every traffic read must pass browserInstanceId from the confirmed list_sessions entry. For a live recording pass the confirmed tabId: it keeps following that tab when Stop/Start gives it a new Session #ID. Pass sessionId for saved sessions that no tab is recording. Tab IDs can be reused after a browser restart, and saved IDs are local to each browser profile. A changed browserInstanceId rejects earlier confirmations, including saved sessions after a restart; call list_sessions and ask the user to reconfirm. isLive/captureState report checked browser recording state; historical status=running alone does NOT mean live. Unknown/unverified requires checking, reload_required means reload the affected page, and an empty watch batch only means no new saved requests during the wait, not that history is disabled. list_sessions and all session responses include lastRequestAt/lastRequestId to verify activity. The DevTools-only feed is separate and unavailable through MCP. After confirmation use scoped search, get_endpoint and get_request. Follow traffic with watch_requests and nextCursor; drain hasMore then wait up to 5000ms. Reconfirm before switching tabs or sessions. Credential-like headers, URL parameters, userinfo, redirect URLs, form fields and JSON fields at any depth are redacted by name; structured bodies that cannot be parsed are omitted. Other body data may remain sensitive.",
24
29
  });
25
30
  const annotations = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
26
31
  const proxy = async (method, params) => {
27
32
  try {
28
33
  const value = await bridge.request(method, params);
29
- if (params.tabId !== undefined && (!value || typeof value !== "object" || !("tabId" in value) || value.tabId !== params.tabId)) {
30
- return { ...text("Following a tab requires Netraptor Chrome extension 0.5.0 or newer. Update the extension, or pass the confirmed sessionId instead."), isError: true };
34
+ const echo = value && typeof value === "object" ? value : {};
35
+ if (CONTENT_TOOLS.has(method) && (echo.browserInstanceId !== params.browserInstanceId || echo.tabId !== params.tabId)) {
36
+ return { ...text(UPDATE_EXTENSION), isError: true };
31
37
  }
32
38
  if (method === "get_request" && (!value || typeof value !== "object" || !("sessionId" in value) || value.sessionId !== params.sessionId)) {
33
39
  return { ...text("This request does not belong to the confirmed session. Check list_sessions and select the correct sessionId before reading it."), isError: true };
34
40
  }
35
41
  if (method === "list_sessions" && Array.isArray(value)) {
36
- return text(value.map((session) => session.captureState ? session : {
37
- ...session, label: `Session #${session.id}`, source: "saved_api",
38
- captureState: "unknown", isLive: false,
39
- lastRequestAt: null, lastRequestId: null,
40
- activityNotice: "This extension cannot verify live recording state. Update Netraptor to 0.5.0 or newer; do not infer live capture from status=running.",
42
+ return text(value.map((entry) => {
43
+ const session = entry.captureState ? entry : {
44
+ ...entry, label: `Session #${entry.id}`, source: "saved_api",
45
+ captureState: "unknown", isLive: false,
46
+ lastRequestAt: null, lastRequestId: null,
47
+ activityNotice: "This extension cannot verify live recording state. Update Netraptor to 0.6.0 or newer; do not infer live capture from status=running.",
48
+ };
49
+ return typeof session.browserInstanceId === "string" ? session
50
+ : { ...session, browserInstanceId: null, sourceNotice: UPDATE_EXTENSION };
41
51
  }));
42
52
  }
43
53
  return text(value);
@@ -45,18 +55,18 @@ export function createMcpServer(bridge) {
45
55
  catch (error) {
46
56
  const message = error instanceof Error ? error.message : String(error);
47
57
  const detail = method === "watch_requests" && message.includes("Unknown MCP method")
48
- ? "Live request following requires Netraptor Chrome extension 0.4.0 or newer. Update the extension and reopen its settings. Existing list_sessions, list_endpoints, search, get_endpoint and get_request tools still work with earlier versions."
58
+ ? UPDATE_EXTENSION
49
59
  : message;
50
60
  return { ...text(detail), isError: true };
51
61
  }
52
62
  };
53
63
  server.registerTool("list_sessions", {
54
64
  annotations,
55
- description: "Start here. Match Tab ID (tabIds), Session #ID, name and origin to the browser UI, and ask the user to confirm before reading traffic. If two or more sessions have isLive=true, ask which ID to use. Do not infer live state from status=running; check captureState and lastRequestAt. An empty list means no saved sessions exist yet, not proof that history is off.",
65
+ description: "Start here. Match Tab ID (tabIds), Session #ID, name and origin to the browser UI, and ask the user to confirm before reading traffic. Pass the entry's browserInstanceId with every traffic read. If two or more sessions have isLive=true, ask which ID to use. Do not infer live state from status=running; check captureState and lastRequestAt. An empty list means no saved sessions exist yet, not proof that history is off.",
56
66
  inputSchema: z.object({}),
57
67
  }, () => proxy("list_sessions", {}));
58
68
  server.registerTool("watch_requests", {
59
- description: "Follow live captured API calls in one browser tab or session. Use list_sessions, check captureState/isLive and ask the user to confirm its Tab ID and Session #ID first. Prefer tabId for live recordings so Stop/Start in that tab is followed; the response session shows which Session #ID was read. Start afterId at 0, then pass nextCursor as afterId on each call. Drain hasMore pages before waiting. waitMs long-polls for up to 5000ms; an empty batch is normal and does not prove recording is disabled. The session metadata reports recording health and last saved activity. Requests are returned in ID order without repeats or skipped pages. Use get_request with id and the confirmed sessionId for headers and bodies. This is a bounded pull feed, not unsolicited push notifications.",
69
+ description: "Follow live captured API calls in one browser tab or session. Use list_sessions, check captureState/isLive and ask the user to confirm its Tab ID and Session #ID first. Prefer tabId for live recordings so Stop/Start in that tab is followed; the response session shows which Session #ID was read. Start afterId at 0, then pass nextCursor as afterId on each call. Drain hasMore pages before waiting. waitMs long-polls for up to 5000ms; an empty batch is normal and does not prove recording is disabled. The session metadata reports recording health and last saved activity. Requests are returned in ID order without repeats or skipped pages. Use get_request with id, the confirmed sessionId and browserInstanceId for headers and bodies. This is a bounded pull feed, not unsolicited push notifications.",
60
70
  annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
61
71
  inputSchema: z.object({
62
72
  ...target,
@@ -106,10 +116,11 @@ export function createMcpServer(bridge) {
106
116
  }, (params) => proxy("search", params));
107
117
  server.registerTool("get_request", {
108
118
  annotations,
109
- description: "Get one captured request with sensitive headers, URL parameters, and top-level JSON fields redacted and bodies bounded. Netraptor records from inside the page, so requestHeaders only contains headers the site's code set (not browser-added ones like cookies or user-agent). status 0 comes with failure: network-error, aborted, timeout, opaque (no-cors), or unknown (recorded before Netraptor tracked failures). bodyTruncated is true when either the capture or maxBodyChars cut a body.",
119
+ description: "Get one captured request with credential-like headers, URL parameters, form fields and JSON fields (at any depth) redacted and bodies bounded. A truncated or unparseable JSON/structured body is withheld as null with requestBodyOmitted/responseBodyOmitted: true. Netraptor records from inside the page, so requestHeaders only contains headers the site's code set (not browser-added ones like cookies or user-agent). status 0 comes with failure: network-error, aborted, timeout, opaque (no-cors), or unknown (recorded before Netraptor tracked failures). bodyTruncated is true when either the capture or maxBodyChars cut a body.",
110
120
  inputSchema: z.object({
111
121
  id: z.number().int().positive().describe("Captured request ID."),
112
122
  sessionId: z.number().int().positive().describe("Confirmed session ID; rejects requests from another capture."),
123
+ browserInstanceId,
113
124
  maxBodyChars: z.number().int().min(100).max(200_000).default(20_000)
114
125
  .describe("Maximum characters for each request or response body (default 20000, max 200000)."),
115
126
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAwB,CAAC;AAE7F,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAA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0",
4
4
  "description": "Local read-only MCP bridge for Netraptor",
5
5
  "private": false,
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@modelcontextprotocol/server": "^2.3.1",
33
33
  "ws": "^8.22.0",
34
- "zod": "^4.3.6"
34
+ "zod": "^4.6.6"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@modelcontextprotocol/client": "^2.3.1",