@ractive-ch/tab-mcp-client 0.16.2 → 0.18.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +898 -0
  2. package/README.md +216 -90
  3. package/address.d.ts +8 -8
  4. package/allowed.d.ts +28 -0
  5. package/allowed.js +14 -0
  6. package/allowed.js.map +10 -0
  7. package/always-allowed.d.ts +140 -22
  8. package/cdn/allowed.min.js +4 -0
  9. package/cdn/allowed.min.js.map +10 -0
  10. package/cdn/confirm-f36n8xj5.min.js +4 -0
  11. package/cdn/confirm-f36n8xj5.min.js.map +10 -0
  12. package/cdn/connect-ph4xxen4.min.js +6 -0
  13. package/cdn/connect-ph4xxen4.min.js.map +12 -0
  14. package/cdn/{connection-w97tf22a.min.js → connection-0xqwz17v.min.js} +7 -7
  15. package/cdn/{connection-w97tf22a.min.js.map → connection-0xqwz17v.min.js.map} +5 -5
  16. package/cdn/{index-vt5zk9me.min.js → tab-mcp-client-2vx9mcww.min.js} +20 -9
  17. package/cdn/tab-mcp-client-2vx9mcww.min.js.map +12 -0
  18. package/cdn/tab-mcp-client-6gcmd7n8.min.js +5 -0
  19. package/cdn/tab-mcp-client-6gcmd7n8.min.js.map +10 -0
  20. package/cdn/tab-mcp-client.min.js +3 -3
  21. package/cdn/tab-mcp-client.min.js.map +4 -4
  22. package/{confirm-fgnjgd08.js → confirm-jbyqzy14.js} +29 -19
  23. package/confirm-jbyqzy14.js.map +10 -0
  24. package/confirm.d.ts +27 -20
  25. package/{connect-8jpb0k29.js → connect-13hkdpcx.js} +113 -16
  26. package/connect-13hkdpcx.js.map +10 -0
  27. package/connect.d.ts +2 -2
  28. package/{connection-g91xjjgm.js → connection-gang7f5x.js} +10 -23
  29. package/{connection-g91xjjgm.js.map → connection-gang7f5x.js.map} +5 -5
  30. package/connection.d.ts +2 -2
  31. package/dialog.d.ts +1 -1
  32. package/{index-jnz7w9xa.js → index-c1c266tm.js} +36 -98
  33. package/index-c1c266tm.js.map +11 -0
  34. package/index-dmh5vm5m.js.map +1 -1
  35. package/index-h8b3dc5p.js +245 -0
  36. package/index-h8b3dc5p.js.map +10 -0
  37. package/index.js +33 -22
  38. package/index.js.map +4 -4
  39. package/internal.d.ts +2 -0
  40. package/package.json +7 -2
  41. package/protocol.d.ts +6 -7
  42. package/react.d.ts +19 -0
  43. package/react.js +30 -1
  44. package/react.js.map +3 -3
  45. package/secret.d.ts +6 -0
  46. package/strings.d.ts +13 -4
  47. package/tab-mcp.d.ts +15 -5
  48. package/types.d.ts +32 -9
  49. package/visible.d.ts +1 -1
  50. package/cdn/confirm-y30cx7e1.min.js +0 -4
  51. package/cdn/confirm-y30cx7e1.min.js.map +0 -10
  52. package/cdn/connect-bbhj2y7w.min.js +0 -6
  53. package/cdn/connect-bbhj2y7w.min.js.map +0 -12
  54. package/cdn/index-vt5zk9me.min.js.map +0 -13
  55. package/confirm-fgnjgd08.js.map +0 -10
  56. package/connect-8jpb0k29.js.map +0 -10
  57. package/index-jnz7w9xa.js.map +0 -12
package/CHANGELOG.md ADDED
@@ -0,0 +1,898 @@
1
+ # Changelog of @ractive-ch/tab-mcp-client
2
+
3
+ All notable changes to the browser library `@ractive-ch/tab-mcp-client`, released with
4
+ the Git tag `client-v<version>`. The format follows
5
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
6
+ [Semantic Versioning](https://semver.org/). The relay has its own
7
+ [changelog](https://github.com/ractive/tab-mcp/blob/main/packages/tab-mcp/CHANGELOG.md).
8
+
9
+ ## [0.18.0][client-0.18.0] - 2026-11-20
10
+
11
+ ### Added
12
+
13
+ - **`@ractive-ch/tab-mcp-client/allowed`**, an entry of its own (not in the core):
14
+ `allowedTools(mcp)` returns the tools that run without asking, per connected AI app,
15
+ for a page that draws its own switches: `tools()` (the tools that ask, each with
16
+ `destructive`), `has`, `list`, `allow`, `ask`, `everything`, `setEverything`,
17
+ `forget`, `onChange` and `kept`. Types `AllowedTools`, `AllowedTool` (DEC-200). It
18
+ works with `alwaysAllow` unset too, kept in `storage`. Without a bundler:
19
+ `cdn/allowed.min.js` beside `cdn/tab-mcp-client.min.js` (package export
20
+ `./cdn/allowed`), sharing its chunks; a page that does not import it loads nothing
21
+ more.
22
+ - **"Allow everything, no questions asked"** per AI app: every tool runs without asking,
23
+ also ones registered later, changed and destructive ones.
24
+ - **Switches in the connect dialog**: under each connected app, a switch per tool that
25
+ asks (destructive ones marked) and "Allow everything, no questions asked" with a
26
+ sentence on what it means; checkboxes with `role="switch"` whose accessible names name
27
+ the app. Tools allowed but not registered right now are listed by name, to turn off.
28
+ Without `alwaysAllow`, only what is allowed for that app is shown, as switches that can
29
+ only be turned off. The methods of `allowedTools(mcp)` are bound; `ask` while
30
+ "everything" is on turns "everything" off for that app.
31
+ - `useAllowedTools(grantId)` in `@ractive-ch/tab-mcp-client/react`: the tools that ask,
32
+ each with `allowed`, `everything` and the `allowedTools` object to change them.
33
+ - `alwaysAllow: "until-reload"`.
34
+ - `ui.strings`: `alwaysAllow`, `alwaysAllowNote`, `destructive`, `allowToolApp`,
35
+ `allowDestructiveToolApp`, `allowEverything`, `allowEverythingApp`,
36
+ `allowEverythingNote`.
37
+
38
+ ### Changed
39
+
40
+ - **`alwaysAllow: true` keeps allowances until the app is disconnected**, in `storage`
41
+ under the secret's key with `#allowed` appended (grant ids, tool names, the title and
42
+ description the user saw, a fingerprint of the secret; no arguments). They end when
43
+ the relay reports the grant gone (disconnected, "Disconnect all apps", expired, signed
44
+ out), not on a dropped connection or a reload. With `storage: null` they are kept in
45
+ memory. `alwaysAllow: "until-reload"` is the old behaviour.
46
+ - **The confirmation's third button** says "Always allow" with `alwaysAllow: true`, and
47
+ "Allow until reload" with `"until-reload"` or `storage: null`, each with its own note.
48
+ - **An allowed call no longer reaches the page's own `onConfirm`**: it runs without
49
+ asking. React's provider always installs an `onConfirm`, so this holds there too.
50
+ - **A tool that is unregistered keeps its allowance** (a reload registers every tool
51
+ again); one registered again with another title or description is asked again, as
52
+ before.
53
+ - `ui.strings`: `runsWithoutAsking` is the heading over the switches ("Runs without
54
+ asking", without `{tools}`); `askAgain` and `askAgainApp` are gone ("Ask again" is
55
+ replaced by the switches).
56
+
57
+ ## [0.17.0][client-0.17.0] - 2026-11-19
58
+
59
+ ### Breaking
60
+
61
+ For relays with one fixed MCP address per app, `https://<relay>/s/<app>/mcp` (the relay
62
+ release after 0.11.0; DEC-196). Relays up to 0.11.0 are not supported, and that relay
63
+ release refuses clients before this one.
64
+
65
+ - **The address names the app, not the tab.** `session.address` is
66
+ `https://<relay>/s/<app>/mcp`, the same for every page of the app and every visitor;
67
+ the pairing code alone says which page an AI app is paired with. Every address from
68
+ before is gone: users add the new one to their AI apps and pair again.
69
+ - **`hello` carries `app: { id, name? }`**, which the relay requires. The `page` field
70
+ is no longer sent, and the `/tab` URL has no `?a=<address id>`.
71
+ - **`newAddress()` no longer changes the address.** It still takes the page back,
72
+ revokes every grant and makes a new secret, and `addressChanged` on its rejection
73
+ still says whether the secret changed. The dialogs call it "Disconnect all apps"
74
+ (was "New address"); every AI app then connects again at the same address with a new
75
+ code. The keys of `ui.strings` are unchanged (`newAddress`, `newAddressNote`,
76
+ `newAddressQuestionOne`, `newAddressQuestionMany`, `newAddressConfirm`,
77
+ `gettingNewAddress`, `newAddressDone`, `closeNote`, `replaced`); their English texts
78
+ changed. A page with its own texts for them should say the same.
79
+ - **`PairingCodeReason` has no `"locked"`.** The relay's codes have no attempts of their
80
+ own any more: `reason` is `start`, `used` or `expired`.
81
+
82
+ ### Added
83
+
84
+ - The option `app`: the app id, the `<app>` of the address. 1 to 32 characters of `a-z`,
85
+ `0-9` and `-`, not starting or ending with `-`; anything else is a `TypeError`.
86
+ Without it the id is made from `server.name`: lower case, letters without their marks,
87
+ each run of other characters as one `-`, at most 32 characters ("Bücher" gives
88
+ `bucher`). A `server.name` that leaves nothing, with `relay` set, is a `TypeError`
89
+ that says to set `app`. A relay may reserve an app id for certain origins; a page of
90
+ another origin that names it is refused (`connect()` rejects with reason `policy`).
91
+ The relay knows a page by its app id and its secret together, so a page that changes
92
+ its app id is a new page to the relay, and its AI apps pair again.
93
+
94
+ ### Changed
95
+
96
+ - The pairing code is 8 letters, shown as the relay sends it: `XXXX-XXXX`.
97
+ - The storage key of the secret is unchanged (`tab-mcp:secret:<relay origin>:<server.name>`
98
+ or `storageKey`).
99
+
100
+ ### Removed
101
+
102
+ - Close code 4009 (`address_mismatch`) is no longer known: relays do not send it.
103
+
104
+ ## [0.16.2][client-0.16.2] - 2026-11-14
105
+
106
+ ### Removed
107
+
108
+ - The copy of an address secret from the key of 0.4 and older
109
+ (`tab-mcp:secret:<relay origin>`, DEC-083): the library reads only
110
+ `tab-mcp:secret:<relay origin>:<server.name>` (or `storageKey`). A visitor whose last
111
+ visit to a page was while the page ran client 0.4 or older gets a new address there
112
+ and pairs their AI apps again; anyone whose page has loaded client 0.5 or later since
113
+ keeps their address. The core is 73 bytes smaller (6143 B gzipped).
114
+
115
+ ## [0.16.1][client-0.16.1] - 2026-11-13
116
+
117
+ ### Fixed
118
+
119
+ - With several `revoke()` calls pending, a refusal by the relay rejects only the one it
120
+ answers: relays from 0.10.2 name the message (`for`) and the grant (`grantId`) in
121
+ their `error`, which the library compares. Before, any `store_unavailable` or
122
+ `unknown_id` rejected every pending `revoke()` and `signOut()`, as it still does with
123
+ older relays.
124
+ - A grant the relay no longer knows (`unknown_id` for a `revoke()` of it: it expired)
125
+ leaves `grants`, with `grantschange`, and its `revoke()` resolves. Before, it stayed
126
+ listed and could not be disconnected. Grants that expire while the page is connected
127
+ leave `grants` too, through relay 0.10.2's `grant.removed` `expired`.
128
+ - In `tools/list`, a consequential tool's description no longer ends with "The page may
129
+ ask the user to allow each call, usually in the page's browser tab." when an
130
+ `onConfirm` answers: the page's, or for the calls of a served port its own. Such a
131
+ question may be anywhere (a side panel, the site's chat). 0.16.0 added the sentence
132
+ for every consequential tool.
133
+
134
+ ### Changed
135
+
136
+ - `revoke()` and `signOut()` reject with a `NetworkError` when the session ends after
137
+ the message was sent and before the relay answered (the relay may have done it), and
138
+ keep the `InvalidStateError` for a page that is not connected (nothing was sent). Both
139
+ were an `InvalidStateError`. Migration: code that checks `name === "InvalidStateError"`
140
+ for a lost session checks `"NetworkError"`.
141
+ - A rejection of `newAddress()` has `addressChanged`: `false` when the old address could
142
+ not be taken back (kept, with its grants), `true` when the address changed and only
143
+ connecting with the new one failed.
144
+ - The WebMCP mirror is a chunk of its own, loaded by a `TabMcp` made with `webmcp: true`
145
+ in a browser with native WebMCP; the core went from 6400 to 6082 B gzipped. Each
146
+ `TabMcp` still reads `document.modelContext` through `Document.prototype`'s getter when
147
+ it is made. The tools are registered natively once the chunk has loaded, a little
148
+ later than before.
149
+ - The README says exactly when `statechange` has a `reason`: on the change from
150
+ `connected`, and when `disconnect()` or `newAddress()` ends connecting or
151
+ reconnecting; not on later reconnect attempts (`reconnecting.reason` has it), a failed
152
+ `connect()` or the `disconnected` after a refusal (the `error` before it says why).
153
+ The behaviour is unchanged.
154
+
155
+ ## [0.16.0][client-0.16.0] - 2026-11-13
156
+
157
+ ### Breaking
158
+
159
+ The API before 1.0 (iteration 38). Each item says what to change.
160
+
161
+ - **`ConnectionState` has `"reconnecting"`, and the `reconnecting` event is gone.** While
162
+ the library connects again by itself, `state` is `reconnecting` (also during an
163
+ attempt, which used to be `connecting`); `statechange` fires for each attempt it
164
+ schedules, and the property `reconnecting` still says which attempt is next and when.
165
+ Migration: replace `addEventListener("reconnecting", …)` with `statechange` and
166
+ `mcp.state === "reconnecting"`; replace `mcp.reconnecting !== undefined` tests of the
167
+ state with `mcp.state === "reconnecting"`. A refusal that stops reconnecting comes as
168
+ `error` (with `state` already `disconnected`) just before the `statechange` to
169
+ `disconnected`, where it came before `reconnecting: null`.
170
+ - **The `connected` and `disconnected` events are gone; `statechange` carries the reason.**
171
+ `statechange` has `{ state, reason? }`: `reason` (a `DisconnectReason`) on the change
172
+ from `connected`, to `disconnected` or, when the connection broke, to `reconnecting`,
173
+ and when `disconnect()` or `newAddress()` ends connecting or reconnecting.
174
+ The close code is not reported any more; `DisconnectDetail` is gone, `StateChangeDetail`
175
+ is new. Migration: `connected` → `statechange` with `state === "connected"` and
176
+ `mcp.session`; `disconnected` → `statechange` with `e.detail.reason !== undefined`
177
+ (for example `reason === "user"` after `disconnect()`).
178
+ - **Every event detail is an object, and `undefined` stands for nothing.**
179
+ `pairingcode` has `{ pairingCode }` (was the code or `null`); `identitychange` has
180
+ `{ identity, identityMessage }` (was `{ state, message? }`). Migration:
181
+ `e.detail?.code` → `e.detail.pairingCode?.code`; `e.detail === null` →
182
+ `e.detail.pairingCode === undefined`; `e.detail.state` → `e.detail.identity`.
183
+ - **`revoke(grantId)` returns a promise** that resolves once the relay removed the grant
184
+ (at once for a grant not in `grants`) and rejects with an `InvalidStateError` while not
185
+ connected, when the session ends first, and with the relay's error when it refuses
186
+ (`code` `store_unavailable` or `unknown_id`), or with a `TimeoutError` when the relay has
187
+ not answered within 15 s. It returned `false` when it could not send. Migration: `mcp.revoke(id).catch(showProblem)` instead of checking the boolean.
188
+ - **`signOut()` returns a promise** that resolves once the relay removed the grants, and
189
+ rejects with an `InvalidStateError` while not connected to a relay that pairs by
190
+ sign-in, with the relay's `store_unavailable`, and with a `TimeoutError` after 15 s;
191
+ `identity` is cleared in any case. It returned whether it was sent.
192
+ Migration: `mcp.signOut().catch(() => {})` in a logout that does not wait.
193
+ - **`refreshIdentity()` resolves with the new `identity`** (`"bound"`, `"refused"` or
194
+ `"none"`) instead of `true`/`false`, and rejects with an `InvalidStateError` while not
195
+ connected and a `TypeError` without `identityAssertion` (it resolved `false`). Migration:
196
+ `(await mcp.refreshIdentity()) === "bound"`.
197
+ - **`newAddress()` resolves with nothing** (`Promise<void>`); it resolved with the new
198
+ session or `undefined`. Migration: read `mcp.session` after it.
199
+ - **`confirmInPage(request, { document })`** takes the document like
200
+ `showConnectDialog`; without it, the global document as before. Nothing to change for
201
+ pages that use the global one.
202
+ - **The options `confirmDelayMs`, `identityTimeoutMs` and `reconnect.delaysMs` are gone**;
203
+ the waits are fixed (750 ms, 15 s, about 5, 10, 20, 40, then 60 s). `reconnect` is a
204
+ boolean; `ReconnectOptions` is gone. Migration: remove them; `reconnect: { … }` becomes
205
+ `reconnect: true` (the default) or `false`.
206
+ - **The properties `address`, `appName` and `pairing` are gone.** Migration:
207
+ `mcp.address` → `mcp.session?.address`; `mcp.appName` → `mcp.session?.appName` (the
208
+ name the relay shows, which is the page's own unless the relay configures one); keep
209
+ your own flag for whether you called `startPairing()`.
210
+ - **"Always allow" is "Allow until reload"**, left of Allow, with the note "X will run for
211
+ <app> without asking, with any arguments, until you reload this page or disconnect
212
+ <app>". The option is still `alwaysAllow`. Migration: tests and guides that look for
213
+ the button's text.
214
+ - **React: `useTool(tool, options?)`**, without `deps`, which only registered the same tool
215
+ again. `connectLabel` is no longer exported, `TabMcpSnapshot` has no `address`, and
216
+ `ConnectButton`'s `data-state` is the state itself. Migration: `useTool(tool, [a], opts)`
217
+ → `useTool(tool, opts)`; `state.address` → `state.session?.address`; a label of your
218
+ own as `children` instead of `connectLabel`.
219
+ - **The setup steps are shorter.** ChatGPT's entry has no note (the Mac app's steps are in
220
+ the guide), and Codex's note no longer explains how to turn the feature off. Migration:
221
+ none for pages; an extension or page that tests the texts of `setupInstructions`
222
+ adjusts them.
223
+ - **The dialogs' chunk is split** into the confirmation and the connect dialog (with a
224
+ shared chunk), so a page without a relay loads no connect dialog. Code that imported the
225
+ UI chunk's internals from a built file (`ui-<hash>.js`) points at `confirm-<hash>.js`
226
+ (`confirmInPage(mcp, request, document, { alwaysAllow, ui })`) instead.
227
+ - **Styling: only the dialog classes and the button kinds are documented** (`.tab-mcp-dialog`,
228
+ `.tab-mcp-connect`, `.tab-mcp-confirm`, `.tab-mcp-replaced`, `.tab-mcp-primary`,
229
+ `.tab-mcp-danger`, `.tab-mcp-copy`); override with two classes. The check mark of a
230
+ connected app is drawn by the stylesheet, not an inline `svg`. A Copy button's name is
231
+ what it shows while it says "Copied" or "Press Ctrl+C", and that is what is announced
232
+ ("Copied", not "Address copied").
233
+ - **`RegisterToolOptions.webmcp` is gone; `callers` replaces it** (iteration 40). `callers`
234
+ lists who sees a tool: `"relay"`, `"local"` (a served port), `"webmcp"`; by default all
235
+ of them, and WebMCP gets a consequential tool only when `"webmcp"` is listed, as with
236
+ `webmcp: true` before. Migration: `{ webmcp: true }` → `{ callers: ["relay", "local",
237
+ "webmcp"] }` (or only the callers that should see it); `{ webmcp: false }` →
238
+ `{ callers: ["relay", "local"] }`; also in React's `useTool(tool, options)`. A
239
+ `callers` that is not a list of those three, and the old `webmcp` option (which would otherwise be ignored, and an ignored `webmcp: false` would put the tool into WebMCP), throw a `TypeError`. `TabMcpOptions.webmcp`
240
+ stays: it turns WebMCP on.
241
+
242
+ ### Added
243
+
244
+ - `ui: { strings }`: every text of the dialogs in one table (`DialogStrings`, keys and
245
+ English texts in `src/strings.ts`), replaceable key by key, with `lang` and `dir`.
246
+ - `ui: { setup: { guide, instructions } }`: the connect dialog's guide link (or none) and
247
+ its steps per AI app.
248
+ - The connect dialog lists the tools that run without asking under each app, with "Ask
249
+ again"; a tool registered again unchanged keeps its entry (React's `useTool`), one whose
250
+ title or description changed is asked again.
251
+ - A Disconnect in the connect dialog that the relay could not save says so ("The relay
252
+ could not save this. Try again.").
253
+ - The React provider disconnects its instance a moment after it unmounts, unless the
254
+ effect ran again: under StrictMode a child's `connect({ resume: true })` is no longer
255
+ cancelled ("The connection was cancelled").
256
+ - The connect dialog names every connected app in its confirmation ("A and B are
257
+ connected"), not only those that paired while it was open.
258
+ - `Tool.outputSchema` (the WebMCP draft of 12 November 2026 has it): an object schema of
259
+ the result, listed in `tools/list` and passed on to WebMCP.
260
+ - `RegisterToolOptions.exposedTo` is passed on to the native WebMCP registration of a
261
+ mirrored tool; it was accepted and ignored.
262
+ - `serve(port, { onConfirm })`: approves the consequential calls of that port in place of
263
+ the page's `onConfirm` and the library's dialog, for example as a question in the
264
+ site's own chat in the user's language; relay and WebMCP calls keep the page's. Same
265
+ answers as `onConfirm`; `request.signal` aborts when the call is cancelled, times out
266
+ or the serve closes. The question is never sent over the port. The README recommends it
267
+ for a site's own assistant instead of answering `true` for `kind === "local"`.
268
+ - `serve(port, { requestTimeoutMs })`: a time limit per request on the page's side, 300 s
269
+ by default as in `createTunnelFetch` (below 2^31 ms; a `subscriptions/listen` stream is
270
+ not limited). On expiry the call is aborted and ends as `cancelled`, a later answer is
271
+ dropped, and the other end gets the JSON-RPC error `-31002`.
272
+ - `RegisterToolOptions.callers` (`ToolCaller[]`): which callers see a tool, `"relay"`,
273
+ `"local"` and `"webmcp"`. `tools/list` and `notifications/tools/list_changed` are per
274
+ caller, and a call of a tool the caller does not see is answered as for an unknown tool.
275
+ - Every result of a tool marked `untrustedContentHint` carries
276
+ `_meta["ch.ractive.tab-mcp/annotations"]: { untrustedContentHint: true }`, through the
277
+ relay and through a port, next to the tool's own `_meta` (MCP has no such hint; in
278
+ `tools/list` it stays `openWorldHint` plus the original in `_meta`).
279
+ - README: a tested backend recipe for a site's own assistant (the MCP SDK's client pinned
280
+ to 2026-07-28 next to an agent framework, the tools as function tools, untrusted results
281
+ delimited), and page context in a read-only tool such as `get_page_context`.
282
+
283
+ ### Changed
284
+
285
+ - WebMCP: a mirrored tool that returns nothing resolves as `"Done."` (the browser cannot
286
+ serialize `undefined`, so the agent saw a failed call); an MCP result goes out as its
287
+ `structuredContent`, else as its text with other blocks (images) named as left out,
288
+ instead of the JSON of the whole result with base64 images.
289
+ - WebMCP: tools marked only with MCP's `destructiveHint` are left out of WebMCP unless
290
+ their `callers` list `"webmcp"`, like `consequentialHint`, and a mirrored one is
291
+ registered natively with `consequentialHint: true`.
292
+ - A call that is cancelled (the AI app gave up, the serve closed, its time ran out) ends
293
+ at once, with `toolcallend` outcome `cancelled`, also when the confirmation (an own
294
+ `onConfirm`) or `execute` does not heed the signal; what they answer later is dropped.
295
+ Before, the call ended only when they settled.
296
+ - WebMCP: each `TabMcp` reads the native `document.modelContext` when it is made (through
297
+ `Document.prototype`'s getter, as before), not when the library loads, so an
298
+ origin-trial token added by a script counts for a `TabMcp` made after it. A failed
299
+ native registration is no longer tried a second time.
300
+ - `registerTool` with an already aborted signal rejects with the signal's reason, as the
301
+ WebMCP draft does; it resolved without registering.
302
+ - `registerTool` rejects with a `TypeError` when a hint (`consequentialHint`,
303
+ `readOnlyHint`, any `…Hint`, `debugging`) or the `webmcp` option is not a boolean. Until
304
+ now such a hint was dropped, so `consequentialHint: "true"` registered a tool that ran
305
+ without asking. Other annotation keys that are not booleans are still ignored.
306
+ - Only an MCP result passes through as one: an object whose `content` is an array of MCP
307
+ content blocks (`type` `text`, `image`, `audio`, `resource_link` or `resource`, with the
308
+ fields that type needs, such as a string `text` or `data` and `mimeType`). Any other
309
+ value with a `content` array (a ProseMirror document, `{ title, content: [...] }`, also
310
+ with an empty `content`) is sent as JSON text with `structuredContent`, like other
311
+ objects. A passed-through
312
+ result keeps its own `_meta`. `structuredContent` is the parsed JSON text, so a `Date`
313
+ or `URL` (whose JSON is a string) has none.
314
+ - The confirmation: one dialog at a time per document; the others wait, and the shown one
315
+ says how many. Each dialog starts its Allow delay when it is shown, and again when
316
+ another dialog of the page closes over it, so the second click of a double click cannot
317
+ approve the next call. When the arguments overflow their box (now up to
318
+ `min(50vh, 24rem)`, `--tab-mcp-arguments-height`), Allow and Allow until reload wait until
319
+ the box has been scrolled to its end, and the dialog says so. Before the delay has run
320
+ out, Enter or Space on a button and Escape are ignored, so typing meant for the page
321
+ cannot refuse a call either. The dialog is described by its question (and short
322
+ arguments) for screen readers; each Disconnect button is named for its app.
323
+ - The dialogs' elements inherit the dialog's colour, buttons reset `width`,
324
+ `text-transform` and `letter-spacing`, and the dialogs set `pointer-events: auto`, so
325
+ a page's `p { color: … }`, a classless framework's buttons or Radix's
326
+ `body { pointer-events: none }` no longer change or block them.
327
+ - `serve` also ends when the port fires `close` (the other end went away), where the
328
+ browser has that event: Bun does; Chrome only with the `MessagePortCloseEvent` Blink
329
+ feature. Elsewhere, close the serve yourself as before.
330
+ - `newAddress()` always takes the old address back first: it connects with the stored
331
+ secret and `hello.revokeAll`, so the relay revokes every grant of the address, whether
332
+ the page was connected or not and whether it was taken over or not. Before, a page
333
+ that was not connected only made a new secret, and the old address kept its grants.
334
+ It rejects, and keeps the old secret, when the address cannot be taken back (relay
335
+ unreachable, taken over again first). A page that never had a secret makes one without
336
+ connecting. A second call while it runs returns the same promise; `connect()` waits
337
+ for it. Relays of 0.4 and older cannot take an address back: `newAddress()` rejects
338
+ there with `reason` `"policy"` (it sent `grants.revokeAll` and waited for every grant).
339
+ - `grants` is empty (with `grantschange`) after `newAddress()`.
340
+ - A refusal that stops reconnecting always emits `error`, also when a `connect()` of the
341
+ page waited on that attempt.
342
+ - Close codes 1001, 1011, 1012 and 1013 (a proxy in front of a restarting relay) mean
343
+ `shutdown`, so the page reconnects. The reconnect waits vary by up to 20 %.
344
+ - `hello` sends an empty page title: the relay never read it.
345
+ - Tabs of a page tell each other which address they claimed, so a tab on another address,
346
+ or one that claimed while this tab was still connecting, no longer makes a takeover
347
+ read as "Opened in another tab".
348
+ - The library no longer answers a relay message it cannot read with `error`.
349
+ - The connect dialog says in plain words why it could not connect or why the page was
350
+ disconnected ("Could not connect. Check your internet connection.", "The session
351
+ ended.", "Not connected." for a call without a user action) and offers "Connect again"
352
+ (`.tab-mcp-retry`); the error itself goes to the console. While the library reconnects
353
+ by itself, it says "Connection lost. Reconnecting…". Before, it showed the relay's
354
+ message after "Could not connect:" and had no way to connect again.
355
+ - With identity binding, the connect dialog shows the address only once the relay
356
+ accepted the page's sign-in, and says otherwise "Checking your sign-in…", "Sign in to
357
+ this page first." or that the sign-in was not accepted, with `identityMessage`.
358
+ - The connect dialog: "How do I add it?" comes right below the address, before the code;
359
+ "New address" moved from beside Copy to the end of the setup
360
+ (`.tab-mcp-new-address-row`), with a line on what it does.
361
+ - The setup steps (`./setup` and the dialog) end with the step that starts the sign-in:
362
+ `/mcp` and Authenticate for Claude Code, `codex mcp login <name>` as the third line of
363
+ Codex's command.
364
+ - A refused Copy says on the button what to do ("Press Ctrl+C", "Press ⌘C" on Apple
365
+ devices, "Selected" on a touch screen) instead of only telling screen readers.
366
+ "Copied" goes back to "Copy" after 2 seconds.
367
+ - While a confirmation is open in a hidden tab, the tab's title starts with "Allow? – ".
368
+ In `tools/list`, the description of a consequential tool ends with "The page may ask
369
+ the user to allow each call, usually in the page's browser tab."
370
+ - The dialogs carry `lang="en"` and `dir="ltr"`, so a screen reader on a page in another
371
+ language reads them with an English voice and a right-to-left page does not mirror
372
+ them.
373
+
374
+ ### Removed
375
+
376
+ - `<html data-tab-mcp-webmcp="…">`: the library no longer lists the tools it mirrors
377
+ into WebMCP on the page's root element. It was made for tab-mcp for Chrome, which has
378
+ not read it since its own review fixes. The library has no replacement for the list: a
379
+ name that could not be registered natively is still reported by a console warning, and
380
+ `toolcall` events with `client.kind === "webmcp"` say that an agent in the browser has
381
+ called a tool, not that the tools are mirrored.
382
+
383
+ ### Fixed
384
+
385
+ - The connect dialog's code row no longer overflows at 320 px: below 30rem, the code's
386
+ Copy goes under the code.
387
+
388
+ - The schema check at registration no longer reads `default`, `examples`, `const` and
389
+ `enum` values or property names as keywords: `examples: [{ pattern: "*.ts" }]` was
390
+ refused as an invalid regular expression. A malformed `%` escape in a `$ref` is a
391
+ `TypeError`, not a `URIError`.
392
+ - A tool result larger than the relay's `maxBodyBytes` is answered as an error result
393
+ that gives both sizes, and `toolcallend` says `error`; before, `toolcallend` said `ok`
394
+ and the AI app got a transport error (`-31006`) for a tool that ran. A result that is
395
+ not JSON now also ends with `toolcallend` `error`.
396
+ - Reconnecting no longer stops for good when a `statechange` listener calls `connect()`
397
+ after a failed attempt.
398
+
399
+ ## [0.15.0][client-0.15.0] - 2026-11-13
400
+
401
+ ### Added
402
+
403
+ - `mcp.serve(port, { client })` serves the page's tools over a message port, without a
404
+ relay: for a site's own assistant, e.g. a chat in an iframe whose backend runs the MCP
405
+ client. The port carries the relay's `http.*` messages as plain objects (a
406
+ `MessagePort` fits, or an object of your own with `postMessage` and `onmessage`). It
407
+ resolves with `{ close() }`, takes a `signal`, and may be called for several ports,
408
+ next to a relay connection and `webmcp: true`. Closing it tells the other end (`bye`). A port is a key to the tools: hand it
409
+ only to a frame whose origin you checked (README, "Your own assistant on the page";
410
+ threat model A15).
411
+ - `@ractive-ch/tab-mcp-client/tunnel`: `createTunnelFetch({ send })` is the other end, a
412
+ `fetch` for an MCP client such as the MCP SDK's
413
+ (`new StreamableHTTPClientTransport(url, { fetch })`). It needs only `Request`,
414
+ `Response` and web streams (Bun, Node, a browser frame) and shares no code with the
415
+ page's library. A timeout (`requestTimeoutMs`, 300 s), a closed tunnel and an invalid
416
+ answer are JSON-RPC errors with the relay's codes (`-31002`, `-31003`, `-31007`) at
417
+ HTTP 200; only an aborted `signal` rejects.
418
+ - `relay` is optional. Without it the page offers its tools only through `serve` and
419
+ WebMCP: `connect()`, `showConnectDialog()` and `newAddress()` reject with a `TypeError`,
420
+ no address secret is read or written, and React's `ConnectButton` renders nothing. New
421
+ getter `mcp.hasRelay`.
422
+ - New types `LocalClient`, `ServeOptions`, `ServeHandle`, `TunnelPort`.
423
+
424
+ ### Changed
425
+
426
+ - `ToolCallClient` has a new member, `{ kind: "local", id, name? }`: the caller of a port
427
+ served with `serve`, as the page named it. Code that switches over every `kind`, or
428
+ treats every caller that is not `"webmcp"` as a relay's AI app (reading `host` or
429
+ `grantId`), needs a case for it. It only occurs in pages that call `serve`. The
430
+ library's confirmation names it "<name> (this site's assistant)" and never offers
431
+ "Always allow" for it.
432
+ - `TabMcpOptions.relay` and the `relay` prop of `TabMcpProvider` are optional in the
433
+ types; `ConnectButton` may return `null`.
434
+
435
+ ## [0.14.0][client-0.14.0] - 2026-11-12
436
+
437
+ ### Added
438
+
439
+ - `onConfirm` may return (or resolve with) `"unanswered"` besides `true` and `false`: the
440
+ user was asked and did not answer, e.g. a question of the page's own that timed out.
441
+ The AI app then reads "The user was asked and did not answer." instead of "The user
442
+ declined", and an agent in the browser (`webmcp: true`) gets `{ error: "The user did not
443
+ answer whether <tool> may run." }`. New type `ConfirmAnswer`. Before, every answer but
444
+ `true` read as a refusal. A throw from `onConfirm` is still a refusal.
445
+
446
+ ### Changed
447
+
448
+ - `ToolCallOutcome` (the `toolcallend` event) has a new member, `unanswered`. Code that
449
+ switches over every outcome needs a case for it.
450
+
451
+ ## [0.13.1][client-0.13.1] - 2026-11-12
452
+
453
+ ### Changed
454
+
455
+ - A WebMCP call (`webmcp: true`) that fails resolves with `{ error: "<message>" }`
456
+ instead of rejecting: invalid arguments, "Don't allow" (`The user did not allow <tool>
457
+ to run.`), a tool that is gone, an error thrown by `execute` and an `isError` result.
458
+ Chrome 156 hands the agent every rejection as a bare `UnknownError`, so it could not
459
+ tell why a call failed or what to change. Two cases still reject: a call the browser
460
+ cancelled (`AbortError`), and a call when the library's lazily loaded part cannot be
461
+ loaded (a new deploy while the page stays open, the network; reloading the page fixes
462
+ it). `toolcallend` and calls through the relay are unchanged (DEC-120).
463
+
464
+ ## [0.13.0][client-0.13.0] - 2026-11-12
465
+
466
+ ### Added
467
+
468
+ - `webmcp: true` (`TabMcpOptions`): the tools are also registered with the browser's own
469
+ WebMCP (`document.modelContext.registerTool()`) where it has it, so that agents in the
470
+ browser (built into it, or an extension) can call them. Off by default. When turned on,
471
+ this changes what the page exposes: any agent in the browser can call the mirrored
472
+ tools, without pairing and without an identity. Consequential tools are left out
473
+ unless registered with `{ webmcp: true }` (`RegisterToolOptions.webmcp`, also the third
474
+ argument of `useTool`); `{ webmcp: false }` keeps a tool out. A WebMCP call gets the
475
+ same argument check, confirmation and `toolcall`/`toolcallend` events as an AI app's,
476
+ never "Always allow". Only the native object is used (through `Document.prototype`'s
477
+ getter, not a polyfill's own `document.modelContext`); a failed native registration
478
+ only warns in the console. `<html data-tab-mcp-webmcp>` lists the mirrored names for
479
+ tab-mcp for Chrome (DEC-115, DEC-119).
480
+
481
+ ### Changed
482
+
483
+ - `client` in `execute`'s options, `ConfirmRequest` and the `toolcall`/`toolcallend`
484
+ events is a union with a `kind`: `RelayClient` (`kind: "relay"`, with `grantId`, `id`,
485
+ `host` and `name` as before) or `WebMcpClient` (`kind: "webmcp"`, nothing more). Code
486
+ that reads `client.host` or `client.name` without checking `client.kind` first no
487
+ longer type-checks; at run time, calls through the relay carry the same fields as
488
+ before plus `kind`.
489
+ - `confirmInPage` treats a client without `kind: "relay"` as a caller in the browser: no
490
+ "Always allow", offered or applied. A page that calls it with a client object it builds
491
+ itself (for example for its own local MCP endpoint) has to add `kind: "relay"` to keep
492
+ "Always allow".
493
+
494
+ ## [0.12.1][client-0.12.1] - 2026-11-11
495
+
496
+ ### Fixed
497
+
498
+ - The npm build no longer carries Bun's chunk preload map. A page that bundles the
499
+ library again (Vite, webpack, Bun) got `<link rel="modulepreload">` requests for the
500
+ library's own chunk names (`./index-<hash>.js`) when the connect dialog loaded; they do
501
+ not exist in the page's build, so each one was a 404 and a console error. The CDN build
502
+ keeps the map: its chunks are served beside it.
503
+
504
+ ## [0.12.0][client-0.12.0] - 2026-11-11
505
+
506
+ ### Added
507
+
508
+ - `@ractive-ch/tab-mcp-client/setup`: `setupInstructions(serverName, address)`, the connect
509
+ dialog's steps per AI app (Claude, ChatGPT, Claude Code, Codex) as data (`id`, `app`,
510
+ `text`, `command`, `note`; types `SetupInstruction`, `SetupNotePart`), and `SETUP_GUIDE`,
511
+ the guide's address, for pages and extensions that show the steps in their own UI. An
512
+ entry of its own, out of the core; tab-mcp for Chrome uses it (DEC-118).
513
+ - `@ractive-ch/tab-mcp-client/visible`: `escapeInvisible(text)`, the escaping the
514
+ confirmation dialog uses for the arguments and the AI app's name, for pages (and tab-mcp
515
+ for Chrome) that ask in their own UI. An entry of its own, not in the core.
516
+
517
+ ### Changed
518
+
519
+ - The confirmation dialog also escapes C0 controls and DEL (but tab and line feed), lone
520
+ surrogates, every space but the plain one (U+00A0, U+2007, U+3000…) and the Braille
521
+ blank (U+2800) in the arguments and the AI app's name.
522
+ - The CDN build bundles `@cfworker/json-schema` 4.1.6 (was 4.1.4); the dependency is
523
+ pinned to it.
524
+
525
+ ## [0.11.0][client-0.11.0] - 2026-11-09
526
+
527
+ ### Added
528
+
529
+ - The connect dialog confirms a connected AI app at the top: a check mark, "Claude
530
+ (claude.ai) is connected" and what to do next, also announced to screen readers. It
531
+ shows the same when it opens while an app is connected. New styling hooks:
532
+ `--tab-mcp-success`, `.tab-mcp-success` (with `.tab-mcp-success-icon`,
533
+ `.tab-mcp-success-title`, `.tab-mcp-success-next`), `.tab-mcp-setup-toggle`,
534
+ `.tab-mcp-setup` and `.tab-mcp-code-used`.
535
+ - `PairingCode.reason` (`start`, `used`, `locked`, `expired`, type `PairingCodeReason`):
536
+ why the relay sent the code, when it says so. A missing or unknown reason is left out.
537
+
538
+ ### Changed
539
+
540
+ - Once an app is connected, the connect dialog's address, code and help are behind
541
+ "Connect another app", closed, and Done is its primary button (also when the dialog
542
+ opens while an app is connected; before, Done showed only after an app paired in it).
543
+ - After a code is entered, the dialog shows "Code used. Waiting for your AI app…" in its
544
+ place for up to 10 seconds instead of the next code, until the app connects. Only when
545
+ the relay says the code was used (see `PairingCode.reason`); codes from older relays
546
+ show at once, as before.
547
+
548
+ ### Fixed
549
+
550
+ - The confirmation shows more characters as `\uXXXX` escapes: controls (C0 and C1 but
551
+ tab and line feed), every space but U+0020 (U+00A0, U+2007, U+3000…), the Braille blank
552
+ U+2800 and lone surrogates, beside the format, default-ignorable (variation selectors,
553
+ U+034F, the Hangul fillers), private-use and unassigned characters it escaped before.
554
+ - The connect dialog no longer flickers when an app connects: it no longer shows the next
555
+ code before the app is connected, nor rebuilds its list of apps (a focused Disconnect
556
+ keeps the focus) or, on a reconnect with the same address, its help.
557
+ - The connect dialog names an app that holds two grants (paired twice) once, in its
558
+ confirmation and in the New address question.
559
+
560
+ ## [0.10.0][client-0.10.0] - 2026-11-01
561
+
562
+ ### Added
563
+
564
+ - `Tool<Input>` types `execute`'s input; `registerTool` and `useTool` infer it or take it
565
+ explicitly. Without it, `input` stays a `Record<string, unknown>`.
566
+ - README: tools that change `useState` state, the user-action rule next to
567
+ `ConnectButton`, its label function, and end-to-end tests with
568
+ `@ractive-ch/tab-mcp/testing`.
569
+
570
+ ### Changed
571
+
572
+ - `ConnectButton`'s default label says "Connection lost, retrying…" once three reconnect
573
+ attempts have failed, instead of "Reconnecting…" for as long as it tries.
574
+
575
+ ### Fixed
576
+
577
+ - The dialogs set `margin: auto`, so they stay centred on pages whose CSS reset sets
578
+ `margin: 0` on every element (Tailwind's preflight).
579
+
580
+ ### Removed
581
+
582
+ - `connecting.md` from the package: the guide's only source is now
583
+ https://ractive.ch/tab-mcp/connect/.
584
+
585
+ ### Changed
586
+
587
+ - The CDN build bundles `@cfworker/json-schema` 4.1.4 (was 4.1.1); the dependency is
588
+ pinned to it.
589
+
590
+ ## [0.9.1][client-0.9.1] - 2026-10-26
591
+
592
+ ### Changed
593
+
594
+ - The connect dialog's "How do I add it?" is a bordered, bold row across the dialog,
595
+ not a line of plain text, so it is easier to find.
596
+ - The help's guide link goes to https://ractive.ch/tab-mcp/connect/, not GitHub. The
597
+ package ships the guide as `connecting.md`.
598
+
599
+ ## [0.9.0][client-0.9.0] - 2026-10-25
600
+
601
+ ### Added
602
+
603
+ - `server.icons` (MCP `Icon`: `src`, `mimeType`, `sizes`, `theme`), sent in
604
+ `serverInfo` for the AI app's connector list (DEC-105). Without it, the page's
605
+ `<link rel="icon">` and `<link rel="apple-touch-icon">` are sent; `[]` sends none.
606
+ At most 8: `http(s):` URLs, or raster `data:` URIs up to 16 KiB (no inline SVG); only
607
+ in `server/discover`. In the connection chunk: the core does not grow.
608
+ - The connect dialog's help links to the new guide
609
+ [connecting an AI app](https://github.com/ractive/tab-mcp/blob/main/docs/connecting.md).
610
+
611
+ ### Changed
612
+
613
+ - The dialog's ChatGPT line: chatgpt.com's Plugins, and the Mac app's MCP servers (which
614
+ are Codex's and need its `mcp_2026_07_28` feature). Developer mode is gone.
615
+
616
+ ## [0.8.0][client-0.8.0] - 2026-10-25
617
+
618
+ ### Changed
619
+
620
+ - **Visible change: "Always allow" is opt-in** (DEC-096). The default confirmation now
621
+ shows only "Don't allow" and "Allow", so every call of a consequential tool asks.
622
+ `alwaysAllow: true` on `TabMcp` (or `TabMcpProvider`) brings "Always allow" back.
623
+ It lifted the only brake at run time for a tool until a reload, which is what a prompt
624
+ injection needs.
625
+ - `replaced` carries `detail: { sibling }` (was `null`): `true` when a tab of the same
626
+ page in this browser said on a `BroadcastChannel` that the relay accepted its session
627
+ for the address, `false` when none did (or without `BroadcastChannel`), which may be a
628
+ program with a copy of the address secret (DEC-095). The channel carries neither the
629
+ secret nor the address. Listeners that ignore the detail work as before.
630
+ - **Order of events when replaced:** the session ends at the relay's `bye`;
631
+ `disconnected` (reason `replaced`) comes at once, and `replaced` after it, up to a
632
+ second later while the library waits to hear from a sibling tab. Before, `replaced`
633
+ came first.
634
+ - `newAddress()` after `replaced` (from the event, during that second, or later) takes
635
+ the address back first: it connects with the old secret and `hello.revokeAll`, so the
636
+ relay revokes the AI apps that talk to whoever took it over in the same step, and
637
+ makes the new address only once the relay confirmed it (no grants left). Taken over
638
+ again before that, it rejects (`reason: "replaced"`), keeps the old secret, and a retry
639
+ takes it back again. Against a relay of 0.4 or older, which ignores the field, it sends
640
+ `grants.revokeAll` and waits until every grant is gone. It no longer needs a fresh user
641
+ action for the reconnect when the page was connected.
642
+ - The tools allowed with "Always allow" are kept in the lazily loaded UI chunk, which
643
+ makes the core smaller.
644
+
645
+ ### Added
646
+
647
+ - The default UI says when the page loses its address, once the page has opened the
648
+ connect dialog: "Opened in another tab" after a sibling tab, otherwise a warning that
649
+ another tab or program took over this page, with "New address" (the dialog
650
+ `.tab-mcp-replaced`). The connect dialog closes then.
651
+ - The WebSocket URL carries the address id: `wss://<relay>/tab?a=<id>`, never the
652
+ secret. The library computes the id from the secret with Web Crypto before it opens
653
+ the socket, so a load balancer in front of several relay instances can route the page
654
+ by it (see self-hosting, "Running several instances"). Where Web Crypto is missing (a
655
+ page on plain `http:` other than localhost) the URL has no id, which a single relay
656
+ accepts. The hashing is in the lazily loaded chunk; the core is unchanged.
657
+ - Close code 4009 (`address_mismatch`: the URL's id is not the secret's) is reported as
658
+ `policy` and not retried.
659
+
660
+ ## [0.7.0][client-0.7.0] - 2026-10-25
661
+
662
+ ### Changed
663
+
664
+ - The default dialogs have a designed look: the title, then the one next step as the
665
+ primary button (Copy the address; Done once an app is connected; "Don't allow" in the
666
+ confirmation), the pairing code large in its own box, the steps per AI app one below
667
+ the other, Disconnect buttons marked, visible
668
+ focus rings, and the arguments wrapped (also long words) and scrolling. The look comes
669
+ from a constructed stylesheet (no CSP exception), uses
670
+ system colours and the page's `color-scheme` (light and dark), fits 360 px, and does
671
+ not animate when the user prefers reduced motion. A new code or "Copied" moves nothing.
672
+ - More custom properties (`--tab-mcp-muted`, `--tab-mcp-surface`, `--tab-mcp-accent`,
673
+ `--tab-mcp-accent-text`, `--tab-mcp-danger`, `--tab-mcp-focus`, `--tab-mcp-shadow`,
674
+ `--tab-mcp-backdrop`, `--tab-mcp-arguments-height`) and class names on the buttons
675
+ (`.tab-mcp-primary`, `.tab-mcp-danger`, `.tab-mcp-deny`, `.tab-mcp-allow`,
676
+ `.tab-mcp-always`, `.tab-mcp-disconnect`, `.tab-mcp-copy`), all listed in the README.
677
+ Each rule has the specificity of one class, and the rules for hover, focus, disabled
678
+ and the primary and danger buttons have one class and two elements. So the page's rules
679
+ for elements, and for an element in a state (`button:hover`, `button:focus`,
680
+ `button:disabled`), do not change those rules. A page rule with two classes
681
+ (`.tab-mcp-dialog .tab-mcp-primary`) does.
682
+ Until now most values were inline styles that only the custom properties could change.
683
+ - The help ("How do I add it?") shows each command as a block with its own Copy, and has
684
+ steps for Codex: `codex features enable mcp_2026_07_28`, which Codex 0.163 needs for the
685
+ relay's MCP revision (for all its MCP servers; `codex features disable mcp_2026_07_28`
686
+ turns it off), then `codex mcp add <name> --url <address>`. The commands for Claude Code
687
+ and Codex name the server by a label made from the page's `server.name` (was always
688
+ `tools`). The label is safe in every shell without quoting: lower case, letters without
689
+ marks, each run of other characters as `-`, no `-` at either end, at most 40 characters,
690
+ `tools` if empty. The help shows commands only for an address made of plain URL
691
+ characters, and plain steps otherwise.
692
+ - The connect dialog says what each Copy did in a polite live region ("Address copied",
693
+ "Code copied", "Claude Code command copied", or "Selected: copy it with Ctrl+C or ⌘C" when
694
+ the clipboard is not available).
695
+ - The pairing code is `2em` by default (was `1.5em`), the default border is the text
696
+ colour at 22 % (was `GrayText`), the default radius `0.75rem` (was `0.5rem`).
697
+
698
+ ## [0.6.0][client-0.6.0] - 2026-10-24
699
+
700
+ ### Fixed
701
+
702
+ - The confirmation's "Allow" and "Always allow" can be clicked only once the page has been
703
+ visible and focused for `confirmDelayMs` with the dialog open. Until now the 750 ms ran
704
+ from when the dialog opened, usually in a tab in the background, so the click that
705
+ brought the tab forward could approve the call. Leaving the page disables both again;
706
+ coming back starts the wait again (DEC-087).
707
+ - The confirmation shows characters that are invisible or change the text direction
708
+ (U+202E, U+2066-2069, zero-width characters, tags, private-use and unassigned code
709
+ points, C1 controls) in the arguments as `\uXXXX` escapes, so an AI app cannot make
710
+ `"evil‮moc.elpmaxe@ecila"` read as another address. The text is still JSON for the
711
+ same arguments, and the tool gets them unchanged. The names of the AI app and the tool
712
+ are isolated left to right (`<bdi dir="ltr">`) (DEC-087).
713
+ - A tool result with a key `invalid` is passed through as a result; it was sent as a
714
+ JSON-RPC error `-32602` while `toolcallend` said `ok`.
715
+ - A schema that passes `registerTool` but that the validator cannot use (a `$ref` next to a
716
+ nested `$id`) no longer makes every call fail with `-32603` and a `toolcall` without its
717
+ `toolcallend`. Once `connect()` has loaded the validator, it compiles each schema at
718
+ registration: `registerTool` rejects such a schema with a `TypeError`, and a tool
719
+ registered before `connect()` with one is unregistered and reported in the event `error`.
720
+ Every `toolcall` now has its `toolcallend` (DEC-086).
721
+ - A consequential tool that is unregistered (or replaced under the same name) while the
722
+ user is asked no longer runs when the user allows it: the AI app gets the error result
723
+ "The tool is no longer available".
724
+ - `showConnectDialog()` while its dialog is open (a double click on the button) opens no
725
+ second dialog; the call resolves when the open one closes. Two dialogs shared one
726
+ pairing, so closing either stopped the code of both. A call for another `document` while
727
+ the dialog is open rejects with an `InvalidStateError`.
728
+ - `confirmDelayMs: NaN` turned the delay off. The constructor now throws a `TypeError` for
729
+ a `confirmDelayMs` or `identityTimeoutMs` that is not a number of milliseconds (finite,
730
+ 0 or more, below 2^31).
731
+ - `identityTimeoutMs` now counts from when `identityAssertion` is asked, so an assertion
732
+ that never comes no longer leaves `identity` at `pending` for good.
733
+
734
+ ### Changed
735
+
736
+ - `grants` (and the `grants` of the event `grantschange`) is a frozen array of frozen
737
+ grants, the same array until the grants change. Pages that changed it in place get a
738
+ `TypeError` in strict mode.
739
+ - The core grows to 5.4 KB gzipped (DEC-086).
740
+
741
+ ## [0.5.1][client-0.5.1] - 2026-10-23
742
+
743
+ ### Fixed
744
+
745
+ - When the relay refuses an attempt the library made by itself while reconnecting (from
746
+ its timer, or the tab coming back to the front), the event `error` now says why, just
747
+ before `reconnecting` turns `null`. Until now the page only saw `null` and could not
748
+ tell a refusal from a stop. An attempt made by the page's own `connect()` still
749
+ rejects its promise and emits no `error`.
750
+
751
+ ## [0.5.0][client-0.5.0] - 2026-10-23
752
+
753
+ ### Changed
754
+
755
+ - The address secret's default storage key is `tab-mcp:secret:<relay origin>:<server.name>`
756
+ instead of `tab-mcp:secret:<relay origin>`, so two pages of one site with different
757
+ server names no longer share an address by accident (the name is URI-encoded in the
758
+ key; renaming `server.name` changes the address). A secret under the old key is copied
759
+ to the new one once, so an existing page keeps its address; on a site with several pages
760
+ the first one to connect keeps it and the others get new addresses. The old key stays,
761
+ for pages still on 0.4 and for a rollback, and a `<old key>#moved` marker records that
762
+ it was taken. An explicit `storageKey` is used as given, without a copy. The core grows
763
+ to 5.1 KB gzipped (DEC-083).
764
+
765
+ ## [0.4.0][client-0.4.0] - 2026-10-23
766
+
767
+ ### Added
768
+
769
+ - Identity binding with relays that pair by `oidc`: the option `identityAssertion`, a
770
+ function that returns a tab assertion from your web app's backend for the signed-in
771
+ user and the page's address (or `null` when nobody is signed in). The library asks it
772
+ after every connect and sends the assertion to the relay. `refreshIdentity()` asks
773
+ again (after a sign-in without a page load), `signOut()` tells the relay the user
774
+ signed out, which ends every AI connection of the page at once. `identity` and the
775
+ event `identitychange` say whether the relay accepted the page's user; only the answer
776
+ to the newest assertion counts, and `identityTimeoutMs` (15 s) ends the wait.
777
+ - `SessionInfo.pairing` (`code` or `oidc`). With `oidc` the connect dialog shows no code
778
+ but "sign in with the account you use on this page".
779
+ - React bindings for single-page apps: `@ractive-ch/tab-mcp-client/react` with
780
+ `TabMcpProvider`, `useTabMcp()`, `useTabMcpState()` (state, address, grants, pairing
781
+ code, identity, reconnecting, tools; renders only on change), `useTool(tool, deps?)`
782
+ (registers while mounted, survives StrictMode, the latest `execute` without registering
783
+ again), `useToolCalls({ limit })` and `ConnectButton`. React 18.3 or 19 is an optional
784
+ peer dependency; the module starts with `"use client"`; not in the CDN build.
785
+ - Reconnecting: after the connection broke (reason `network`, `heartbeat` or `shutdown`)
786
+ the library connects again after 5, 10, 20 and 40 s, then every 60 s, and at once when
787
+ the tab comes back to the front or the network returns. The property and event
788
+ `reconnecting` report it; the option `reconnect` (`false`, or `{ delaysMs }`) changes
789
+ it. A reconnect asks `identityAssertion` again like a fresh connect. An attempt the
790
+ relay refuses (not merely unreachable) stops reconnecting.
791
+ - `identityMessage`: why the relay refused the page's identity, while `identity` is
792
+ `refused`.
793
+ - `confirmInPage(request)`: the library's own confirmation dialog, for an `onConfirm`
794
+ that hands some calls to it.
795
+
796
+ ### Changed
797
+
798
+ - The library now reconnects by itself by default (see above). Pages that reconnected in
799
+ their own `disconnected` listener keep working (the library then does not schedule its
800
+ own attempt) but can drop that code; `reconnect: false` keeps the old behaviour.
801
+
802
+ ## [0.3.0][client-0.3.0] - 2026-10-23
803
+
804
+ ### Added
805
+
806
+ - A Copy button next to the pairing code in the connect dialog, like the address's Copy
807
+ ("Copied" once copied). It copies the code shown at the time, and is back to "Copy"
808
+ when a new code appears. The code is plain, selectable text (one click selects it).
809
+
810
+ ### Changed
811
+
812
+ - The connect dialog has no prominent button under the code until an AI app connects:
813
+ only a small Close at the bottom (and Escape), next to a note that closing stops the
814
+ code while the address stays the same, and that the page can show it again. Once an
815
+ app connects in the dialog, a "Done" button replaces it. Pages and tests that click
816
+ "Close" after pairing should click "Done".
817
+ - The connect dialog opens with the focus on the address's Copy instead of Close. The
818
+ two Copy buttons are labelled "Copy address" and "Copy code" for assistive technology.
819
+
820
+ ## [0.2.0][client-0.2.0] - 2026-10-20
821
+
822
+ ### Added
823
+
824
+ - "Always allow" in the default confirmation. That tool then runs without asking for that
825
+ AI app until the page is reloaded or the app is disconnected. Like "Allow", it stays
826
+ disabled for a moment after the dialog opens. A custom `onConfirm` is asked every time,
827
+ as before.
828
+ - The events `toolcall` and `toolcallend`: every call of a known tool by an AI app as it
829
+ starts (id, tool, arguments, AI app) and as it ends (outcome `ok`, `error`, `declined`
830
+ or `cancelled`, the result, the duration). For an activity log in the page.
831
+
832
+ ## [0.1.0][client-0.1.0] - 2026-10-20
833
+
834
+ The first stable release, on the npm dist-tag `latest`; install without `@alpha`.
835
+
836
+ ### Added
837
+
838
+ - "New address" in the connect dialog. It calls `newAddress()`, which disconnects every
839
+ connected AI app and makes a new address. While apps are connected, the dialog first
840
+ names them and asks.
841
+ - The connect dialog notes that a new pairing code appears every 2 minutes and after each
842
+ use, and announces each newly connected AI app.
843
+
844
+ ### Changed
845
+
846
+ - The default dialog says "AI app" instead of "AI tool": its title is now "Connect your
847
+ AI app". Pages that quote the old wording should follow.
848
+ - `appName` must be 1-64 characters without control characters, as the relay requires
849
+ (before, only the length was checked).
850
+ - README: how to get a relay, pairing, consequential tools and your own UI. Cursor is no
851
+ longer named among the AI apps, because it cannot connect yet.
852
+
853
+ ## [0.1.0-alpha.1][client-0.1.0-alpha.1] - 2026-10-20
854
+
855
+ No changes to the library. Published through the release workflow (trusted publishing)
856
+ to validate it; the release step now reads `npm view` output from npm 11 and 12 alike.
857
+
858
+ ## [0.1.0-alpha.0][client-0.1.0-alpha.0] - 2026-10-19
859
+
860
+ First alpha of the browser library, on the npm dist-tag `alpha`.
861
+
862
+ ### Added
863
+
864
+ - `TabMcp`: register tools WebMCP-style (`registerTool` with JSON Schema input, annotations
865
+ and an abort signal), connect to a tab-mcp relay and answer MCP requests in the page.
866
+ - A small core; `connect()` loads the connection and the dialogs on demand.
867
+ - Default dialogs: "Connect your AI tool" with the address and connected apps, and a
868
+ confirmation for consequential tools.
869
+ - ESM build for bundlers with type declarations, and a self-contained build for
870
+ `<script type="module">` under `@ractive-ch/tab-mcp-client/cdn`.
871
+ - The connect dialog shows the pairing code from the relay.
872
+
873
+ [client-0.18.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.18.0
874
+ [client-0.17.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.17.0
875
+ [client-0.16.2]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.16.2
876
+ [client-0.16.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.16.1
877
+ [client-0.16.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.16.0
878
+ [client-0.15.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.15.0
879
+ [client-0.14.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.14.0
880
+ [client-0.13.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.13.1
881
+ [client-0.13.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.13.0
882
+ [client-0.12.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.12.1
883
+ [client-0.12.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.12.0
884
+ [client-0.11.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.11.0
885
+ [client-0.10.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.10.0
886
+ [client-0.9.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.9.1
887
+ [client-0.9.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.9.0
888
+ [client-0.8.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.8.0
889
+ [client-0.7.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.7.0
890
+ [client-0.6.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.6.0
891
+ [client-0.5.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.5.1
892
+ [client-0.5.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.5.0
893
+ [client-0.4.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.4.0
894
+ [client-0.3.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.3.0
895
+ [client-0.2.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.2.0
896
+ [client-0.1.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.1.0
897
+ [client-0.1.0-alpha.1]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.1.0-alpha.1
898
+ [client-0.1.0-alpha.0]: https://github.com/ractive/tab-mcp/releases/tag/client-v0.1.0-alpha.0