@ractive-ch/tab-mcp-client 0.20.0 → 0.21.0-rc.2
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/CHANGELOG.md +76 -0
- package/README.md +156 -58
- package/cdn/confirm-xgm1ymd0.min.js +4 -0
- package/cdn/confirm-xgm1ymd0.min.js.map +10 -0
- package/cdn/{connect-my0pbqd7.min.js → connect-3reh9k1f.min.js} +4 -4
- package/cdn/{connect-my0pbqd7.min.js.map → connect-3reh9k1f.min.js.map} +4 -4
- package/cdn/connection-cxgns38v.min.js +17 -0
- package/cdn/{connection-5x2krvfs.min.js.map → connection-cxgns38v.min.js.map} +5 -5
- package/cdn/strings.min.js +1 -1
- package/cdn/tab-mcp-client-gdj1e1wh.min.js +5 -0
- package/cdn/tab-mcp-client-gdj1e1wh.min.js.map +11 -0
- package/cdn/{tab-mcp-client-8r6h3wza.min.js → tab-mcp-client-yjcmhpdf.min.js} +5 -5
- package/cdn/tab-mcp-client-yjcmhpdf.min.js.map +11 -0
- package/cdn/tab-mcp-client.min.js +3 -3
- package/cdn/tab-mcp-client.min.js.map +4 -4
- package/cdn/webmcp-8xby3trn.min.js +4 -0
- package/cdn/{webmcp-ny13npet.min.js.map → webmcp-8xby3trn.min.js.map} +3 -3
- package/command.d.ts +9 -3
- package/{confirm-hymzwx3b.js → confirm-7de6dvpb.js} +11 -6
- package/confirm-7de6dvpb.js.map +10 -0
- package/confirm.d.ts +10 -5
- package/{connect-fhtjdmf3.js → connect-bc628ax6.js} +4 -4
- package/{connection-krd3ncrn.js → connection-arq7qm7b.js} +26 -11
- package/connection-arq7qm7b.js.map +16 -0
- package/connection.d.ts +8 -3
- package/dialog.d.ts +2 -2
- package/{index-7qqhn3zv.js → index-bt1rkngm.js} +3 -5
- package/index-bt1rkngm.js.map +10 -0
- package/{index-00p8b969.js → index-erm4h3sn.js} +2 -3
- package/index-erm4h3sn.js.map +11 -0
- package/{index-1tssct09.js → index-xx4gmtk5.js} +6 -4
- package/index-xx4gmtk5.js.map +11 -0
- package/index.js +15 -8
- package/index.js.map +4 -4
- package/internal.d.ts +7 -3
- package/mcp.d.ts +12 -5
- package/package.json +1 -1
- package/react.js +9 -5
- package/react.js.map +3 -3
- package/secret.d.ts +2 -1
- package/setup.d.ts +5 -5
- package/setup.js +2 -2
- package/skill/SKILL.md +476 -0
- package/skill/references/react.md +59 -0
- package/skill/references/sign-in.md +28 -0
- package/strings.d.ts +0 -1
- package/strings.js +1 -1
- package/tab-mcp.d.ts +2 -2
- package/types.d.ts +40 -18
- package/{webmcp-acj1tef8.js → webmcp-gw6rrbnh.js} +24 -3
- package/{webmcp-acj1tef8.js.map → webmcp-gw6rrbnh.js.map} +3 -3
- package/webmcp.d.ts +11 -4
- package/cdn/confirm-ba3dkf9p.min.js +0 -4
- package/cdn/confirm-ba3dkf9p.min.js.map +0 -10
- package/cdn/connection-5x2krvfs.min.js +0 -17
- package/cdn/tab-mcp-client-8r6h3wza.min.js.map +0 -11
- package/cdn/tab-mcp-client-nnxcwrxp.min.js +0 -5
- package/cdn/tab-mcp-client-nnxcwrxp.min.js.map +0 -11
- package/cdn/webmcp-ny13npet.min.js +0 -4
- package/confirm-hymzwx3b.js.map +0 -10
- package/connection-krd3ncrn.js.map +0 -16
- package/index-00p8b969.js.map +0 -11
- package/index-1tssct09.js.map +0 -11
- package/index-7qqhn3zv.js.map +0 -10
- /package/{connect-fhtjdmf3.js.map → connect-bc628ax6.js.map} +0 -0
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tab-mcp
|
|
3
|
+
description: Add tab-mcp to a web app so that AI apps (Claude, ChatGPT, Claude Code, Codex) can call the page's functions as MCP tools while it is open in a browser tab. Covers installing @ractive-ch/tab-mcp-client, registering tools WebMCP-style, the React bindings, the connect and pairing flow (by code or by sign-in), confirmation for consequential tools, registering the same tools with the browser's WebMCP (`webmcp: true`), serving them to the site's own assistant without a relay (`serve`), security defaults and running a tab-mcp relay. Use when the user wants to expose a web page's features to AI apps over MCP, mentions tab-mcp, WebMCP or registerTool, "Connect your AI app", or needs to self-host the tab-mcp relay.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Browser library for any web page (ES modules); the relay needs Bun 1.4.4+ or Docker.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Add tab-mcp to a web app
|
|
9
|
+
|
|
10
|
+
This skill describes `@ractive-ch/tab-mcp-client` 0.21.0-rc.2. The package's
|
|
11
|
+
[README](../README.md)
|
|
12
|
+
is the full reference; read the section you need there when this skill is not enough. Its
|
|
13
|
+
[CHANGELOG](../CHANGELOG.md)
|
|
14
|
+
says what changed between versions. The package ships this skill for its own version as
|
|
15
|
+
`node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md`: when the project has another
|
|
16
|
+
version installed, follow that copy; an installed version without it is older than this
|
|
17
|
+
skill, so update the package first.
|
|
18
|
+
|
|
19
|
+
tab-mcp lets AI apps call tools that a web page offers while it is open in a browser tab.
|
|
20
|
+
The page uses the browser library `@ractive-ch/tab-mcp-client`, which connects to a
|
|
21
|
+
tab-mcp relay (`@ractive-ch/tab-mcp`) over a WebSocket and shows its app's MCP address,
|
|
22
|
+
the same for every page of the app. The user adds that address to their AI app and pairs
|
|
23
|
+
it with a code shown in the page, which says which page is meant. The relay
|
|
24
|
+
forwards the AI app's requests to the page; the tools run in the page.
|
|
25
|
+
|
|
26
|
+
Facts to keep in mind:
|
|
27
|
+
|
|
28
|
+
- Only MCP revision 2026-07-28, and only AI apps that register through OAuth Client ID
|
|
29
|
+
Metadata Documents. Claude Code, claude.ai, Claude Desktop, ChatGPT and Codex work
|
|
30
|
+
(Codex and ChatGPT for Mac with Codex's feature `mcp_2026_07_28` on); VS Code, Cursor
|
|
31
|
+
and Gemini CLI cannot connect. claude.ai, Claude Desktop and ChatGPT on the web connect
|
|
32
|
+
from their own servers and need a relay with a public HTTPS address.
|
|
33
|
+
- The page needs a relay that allows its origin; run one (section 7).
|
|
34
|
+
- [WebMCP](https://webmachinelearning.github.io/webmcp/) (`document.modelContext`) is the
|
|
35
|
+
browser's own API for tools that agents in the browser call. tab-mcp is for AI apps
|
|
36
|
+
outside the browser. With `webmcp: true` the library offers the page's tools both ways
|
|
37
|
+
(section 5). A page that only registers WebMCP tools natively needs no library: the tab-mcp browser extension passes them on to an AI app through a relay.
|
|
38
|
+
- tab-mcp fits state that lives only in the browser, and acting as the signed-in user in
|
|
39
|
+
their open tab. If the state lives on the site's server, suggest an MCP server on that
|
|
40
|
+
backend instead: it works without an open tab and without a relay.
|
|
41
|
+
|
|
42
|
+
## 1. Install the client
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm install @ractive-ch/tab-mcp-client
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Without a bundler, import the self-contained build from a CDN:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<script type="module">
|
|
52
|
+
import { TabMcp } from "https://cdn.jsdelivr.net/npm/@ractive-ch/tab-mcp-client@0.21.0-rc.2/cdn/tab-mcp-client.min.js";
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 2. Create the client and register tools
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { TabMcp } from "@ractive-ch/tab-mcp-client";
|
|
60
|
+
|
|
61
|
+
const mcp = new TabMcp({
|
|
62
|
+
relay: "https://relay.example.com", // your relay (section 7); http: only on localhost
|
|
63
|
+
server: { name: "notes", version: "1.0.0", instructions: "Notes shown on the page." },
|
|
64
|
+
appName: "notes", // 1-64 characters, a name for people
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const tools = new AbortController();
|
|
68
|
+
await mcp.registerTool<{ text: string }>( // types `input`; the schema is what is checked
|
|
69
|
+
{
|
|
70
|
+
name: "add_note", // 1-128 of A-Z a-z 0-9 _ - .
|
|
71
|
+
title: "Add a note",
|
|
72
|
+
description: "Add a note (at most 500 characters) to the list on the page and return its id.",
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: "object", // required: the schema must be an object
|
|
75
|
+
properties: { text: { type: "string", minLength: 1, maxLength: 500 } },
|
|
76
|
+
required: ["text"],
|
|
77
|
+
additionalProperties: false,
|
|
78
|
+
},
|
|
79
|
+
execute: ({ text }) => addNote(text), // second argument: { signal, client }
|
|
80
|
+
},
|
|
81
|
+
{ signal: tools.signal }, // abort to remove the tool
|
|
82
|
+
);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
In development, `relay` is the local relay of section 7 (`http://localhost:8080`), and
|
|
86
|
+
the page's exact origin (scheme and port: `http://localhost:5173` for Vite) must be in the
|
|
87
|
+
relay's `TAB_MCP_ALLOWED_ORIGINS`. Take the relay address from the app's configuration
|
|
88
|
+
(an environment variable of the build), not a constant.
|
|
89
|
+
|
|
90
|
+
Rules for tools:
|
|
91
|
+
|
|
92
|
+
- The shape follows the WebMCP draft (`document.modelContext.registerTool`); the second
|
|
93
|
+
argument is `{ signal, callers, exposedTo }`. There is no `unregisterTool`: abort the
|
|
94
|
+
registration signal. AI apps that listen get a tool-list-changed notification.
|
|
95
|
+
- `callers` (default: all) lists who sees a tool: `"relay"` (AI apps), `"local"` (the
|
|
96
|
+
site's own assistant on a served port), `"webmcp"` (whatever calls through the
|
|
97
|
+
browser's WebMCP). Tools that ask go to every caller, but who asks differs (section
|
|
98
|
+
5): an AI app through the relay gets the page's question (`onConfirm`, else the
|
|
99
|
+
library's dialog); a WebMCP call the tab-mcp browser extension vouched for was asked in
|
|
100
|
+
the extension and skips the page's question and `onConfirm` (`trustExtension`, on by
|
|
101
|
+
default; `false` hands it to `onConfirm` like any other WebMCP call); any other WebMCP
|
|
102
|
+
call gets no question from the library, only the page's `onConfirm` decides, and
|
|
103
|
+
without one it runs. Leave a caller out for privacy
|
|
104
|
+
(`["local"]`: data the site's own assistant may read, not an AI app through the relay),
|
|
105
|
+
identity (`["relay"]`: the tool needs to know which AI app calls), or for a tool no
|
|
106
|
+
unvouched WebMCP caller may run (`["relay", "local"]`). For the others the tool does
|
|
107
|
+
not exist (not listed, no list-changed, a call answered as for an unknown tool).
|
|
108
|
+
- `registerTool` returns a promise. It rejects with a `TypeError` for an invalid tool and
|
|
109
|
+
an `InvalidStateError` for a duplicate name. Do not use `x-mcp-header` in schemas.
|
|
110
|
+
- Arguments are validated against `inputSchema` before `execute` runs, so `execute`
|
|
111
|
+
needs no casts such as `String(text)`; give the type as `registerTool<{ text: string }>`
|
|
112
|
+
and keep it in step with the schema. Still treat the values as untrusted input (limits
|
|
113
|
+
such as `maxLength` in the schema, no HTML from them).
|
|
114
|
+
- Write `description` for a model: what the tool does, its units, an example.
|
|
115
|
+
- `execute` results: a string becomes one text block; an MCP result (`content` an array
|
|
116
|
+
of MCP content blocks: `text`, `image`, `audio`, `resource_link`, `resource`) is passed
|
|
117
|
+
through (use it for images); any other JSON value, also an object whose `content` holds
|
|
118
|
+
something else, is sent as JSON text and, for objects, as `structuredContent`.
|
|
119
|
+
Annotation hints must be `true` or `false`; anything else is a `TypeError`. A thrown error becomes an error
|
|
120
|
+
result with its message, so throw errors that tell the model what to do.
|
|
121
|
+
- `signal` aborts when the caller gives up; the call ends then even if `execute` keeps
|
|
122
|
+
going, and its late result is dropped. `client` names the caller:
|
|
123
|
+
`{ kind: "relay", grantId, id, host, name? }` for an AI app (verified `host`, declared
|
|
124
|
+
`name`), `{ kind: "local", id, name? }` for the site's own assistant on a served port
|
|
125
|
+
(what the page passed to `serve`, section 3), or `{ kind: "webmcp", via?, name?,
|
|
126
|
+
host? }` for a WebMCP caller: `via: "tab-mcp-extension"` with the AI app's
|
|
127
|
+
`name` and verified `host` when the tab-mcp browser extension ran the call for an AI
|
|
128
|
+
app connected to it (section 5), else nothing more is known (an agent in the browser,
|
|
129
|
+
another extension, an `exposedTo` origin: the page cannot tell which). Check `client.kind`
|
|
130
|
+
before reading `host`; a label for a log, e.g. `kind === "relay" ? name ?? host :
|
|
131
|
+
kind === "local" ? name ?? id : via ? (name ?? host) + " through the tab-mcp browser
|
|
132
|
+
extension" : "an agent in this browser"`.
|
|
133
|
+
- Annotations: `readOnlyHint` for tools that only read; `consequentialHint` for tools
|
|
134
|
+
whose effect cannot be undone in the page or reaches outside it (section 4);
|
|
135
|
+
`untrustedContentHint` for results that contain text from the user, another AI app or
|
|
136
|
+
third parties (a list of notes, todos, labels); every result of such a tool carries
|
|
137
|
+
`_meta["ch.ractive.tab-mcp/annotations"].untrustedContentHint: true`, which a consumer
|
|
138
|
+
should read (MCP has no such hint; `tools/list` shows `openWorldHint`). MCP hints
|
|
139
|
+
(`destructiveHint`, `idempotentHint`, `openWorldHint`) may be set directly.
|
|
140
|
+
|
|
141
|
+
## 3. Connect and pair
|
|
142
|
+
|
|
143
|
+
Add a button and open the library's dialog from its click handler:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
connectButton.addEventListener("click", () => mcp.showConnectDialog());
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
What happens:
|
|
150
|
+
|
|
151
|
+
1. `showConnectDialog()` calls `connect()`, which opens the WebSocket. Browsers that
|
|
152
|
+
report user activation refuse `connect()` outside a user action, so never call it on
|
|
153
|
+
page load.
|
|
154
|
+
2. The "Connect your AI app" dialog shows the address
|
|
155
|
+
(`https://<relay>/s/<app>/mcp`, the same for every page of the app; `<app>` is the `app` option, else made from
|
|
156
|
+
`server.name`), a Copy button, steps for Claude, ChatGPT, Claude
|
|
157
|
+
Code and Codex (the two commands with a Copy each, named by a shell-safe label made from `server.name`; Codex's first
|
|
158
|
+
turns on its feature `mcp_2026_07_28`), a code of 8 letters (`XXXX-XXXX`) and "Disconnect all apps". The code says
|
|
159
|
+
which page the AI app is paired with; it is valid for 2 minutes and is replaced by itself.
|
|
160
|
+
3. The user adds the address to the AI app, for example
|
|
161
|
+
`claude mcp add --transport http notes <address>` and then `/mcp` → Authenticate in
|
|
162
|
+
Claude Code.
|
|
163
|
+
4. The AI app opens the relay's `/authorize` page in the browser. The page names the AI
|
|
164
|
+
app and the page origin. The user types the code there. Codes work once and allow 5
|
|
165
|
+
attempts.
|
|
166
|
+
5. The dialog lists the connected app with a Disconnect button. The AI app can now call
|
|
167
|
+
the tools while the page is connected.
|
|
168
|
+
|
|
169
|
+
The relay knows the page again across visits (by a secret per relay and server name in `localStorage`), and paired
|
|
170
|
+
apps stay paired across reloads. While the page is closed, their calls wait up to 10 s
|
|
171
|
+
for it (the relay's `TAB_MCP_PAGE_WAIT_S`) and then get a tool result saying the page is
|
|
172
|
+
not open. Renaming `server.name` changes the secret's storage key and, without the `app` option, the address, so the
|
|
173
|
+
apps pair again.
|
|
174
|
+
|
|
175
|
+
When the connection breaks (reason `network`, `heartbeat` or `shutdown`: a dropped
|
|
176
|
+
network, a phone pausing the tab in the background, a relay restart), the library
|
|
177
|
+
connects again by itself: after 5, 10, 20 and 40 s, then every 60 s, and at once when the
|
|
178
|
+
tab comes back to the front or the network returns. Do not write your own retry loop;
|
|
179
|
+
show `state === "reconnecting"` and the property `reconnecting` (the next attempt, its
|
|
180
|
+
number and time); `statechange` fires for each attempt, and when the relay refused one,
|
|
181
|
+
`error` says why just before the `statechange` to `disconnected`. It never reconnects after `disconnect()`, `disconnectAll()`, another
|
|
182
|
+
tab taking the page's place (`replaced`), an expired or idle session or a refusal by the
|
|
183
|
+
relay, and a first `connect()` that fails is not retried (show the error and let the
|
|
184
|
+
user try again). `reconnect: false` turns it off.
|
|
185
|
+
|
|
186
|
+
The library does not connect on page load by itself: if the page offers a "Keep AI
|
|
187
|
+
access on" switch that the user turned on, call `connect({ resume: true })` on load.
|
|
188
|
+
|
|
189
|
+
"Disconnect all apps" in the dialog calls `mcp.disconnectAll()`: it disconnects every app
|
|
190
|
+
and makes a new address secret, and the dialog asks first when apps are connected. The
|
|
191
|
+
address stays the same; each AI app connects again with a new code. A custom UI calls
|
|
192
|
+
`mcp.disconnectAll()` from a click.
|
|
193
|
+
|
|
194
|
+
For a custom UI, use `connect()`, `startPairing()`/`stopPairing()` (codes come only while
|
|
195
|
+
pairing is on), `revoke(grantId)` (resolves once the relay removed the grant),
|
|
196
|
+
`disconnect()`, the properties `state` (`disconnected`, `connecting`, `connected`,
|
|
197
|
+
`reconnecting`), `session` (its `address` is the MCP address), `pairingCode`,
|
|
198
|
+
`pairingUntil` (identity binding) and `grants`, and the events `statechange` (`{ state,
|
|
199
|
+
reason? }`, `reason` when a session ended), `pairingcode` (`{ pairingCode }`),
|
|
200
|
+
`pairinguntil` (`{ pairingUntil }`), `grantschange` (`{ grants }`), `replaced` and
|
|
201
|
+
`error`. Every detail is an object; a value that is gone is `undefined`. Methods that ask
|
|
202
|
+
the relay reject with an `InvalidStateError` while not connected. The dialogs' texts can
|
|
203
|
+
be replaced (`ui: { strings }`, the keys of
|
|
204
|
+
[`STRINGS`](../strings.d.ts),
|
|
205
|
+
with `lang` and `dir`; see
|
|
206
|
+
[Translating](../README.md#translating)),
|
|
207
|
+
and their help gets its own guide link and steps (`ui: { setup: { guide,
|
|
208
|
+
instructions } }`).
|
|
209
|
+
|
|
210
|
+
When another tab or program takes the page's place (it connects with the same address
|
|
211
|
+
secret), the page gets a `statechange` to
|
|
212
|
+
`disconnected` (reason `replaced`) and then, up to a second later, `replaced`. Once the page has opened the
|
|
213
|
+
default dialog, the library says so itself: "Opened in another tab" when a tab of the
|
|
214
|
+
same page said on its `BroadcastChannel` that its session started, otherwise a warning
|
|
215
|
+
with "Disconnect all apps". A custom UI does the same with `event.detail.sibling`: `true` is the
|
|
216
|
+
usual, harmless second tab; `false` means it may be a program with a copy of the address
|
|
217
|
+
secret, which the paired AI apps now use, so offer a "Disconnect all apps" button that calls
|
|
218
|
+
`mcp.disconnectAll()`. It takes the page back with the relay revoking those apps in the
|
|
219
|
+
same step, then connects with a new secret; if it rejects with `reason: "replaced"`, the
|
|
220
|
+
page was taken over again first: say so and let the user try again.
|
|
221
|
+
|
|
222
|
+
**Sign-in instead of a code** (a relay that pairs by `oidc`): see
|
|
223
|
+
[references/sign-in.md](references/sign-in.md). **React** single-page apps: see
|
|
224
|
+
[references/react.md](references/react.md).
|
|
225
|
+
|
|
226
|
+
**The site's own assistant, without a relay.** A site whose AI assistant runs on the page
|
|
227
|
+
(a chat in an iframe whose backend runs the MCP client) can serve the tools to it over a
|
|
228
|
+
`MessagePort`: no relay, no pairing, no address.
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
const mcp = new TabMcp({ server: { name: "shop", version: "1.0.0" } }); // no relay
|
|
232
|
+
const served = await mcp.serve(port, {
|
|
233
|
+
client: { id: "assistant", name: "Shop assistant" },
|
|
234
|
+
onConfirm: (request) => askInChat(request), // the user's click in the chat answers
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
- The other end uses `createTunnelFetch` from `@ractive-ch/tab-mcp-client/tunnel` as the
|
|
239
|
+
`fetch` of the MCP SDK's client, pinned to `2026-07-28` (an agent framework's own MCP
|
|
240
|
+
client may not speak it), and passes the messages over its own channel; it hands the
|
|
241
|
+
framework the tools as function tools. The README's
|
|
242
|
+
[Your own assistant on the page](../README.md#your-own-assistant-on-the-page)
|
|
243
|
+
has the whole setup and a tested backend recipe.
|
|
244
|
+
- A port is a key: whoever holds the other end calls the tools without pairing. Hand it
|
|
245
|
+
only to a frame whose origin you checked, with that origin as the `postMessage` target,
|
|
246
|
+
never `"*"`.
|
|
247
|
+
- Calls arrive with `client: { kind: "local", id, name }`. A consequential tool still
|
|
248
|
+
asks: recommend `serve`'s `onConfirm`, which asks in the site's chat, in the user's
|
|
249
|
+
language, for that port's calls only (relay calls keep the page's `onConfirm` or
|
|
250
|
+
dialog, WebMCP calls the page's `onConfirm`, section 5; same answers;
|
|
251
|
+
`request.signal` aborts on cancel, timeout or close). The answer must come from the user's click, never from a message of the
|
|
252
|
+
assistant's backend: the library does not send the question over the port for that
|
|
253
|
+
reason. Do not answer `true` for `kind === "local"` to skip the question: tool results
|
|
254
|
+
bring third-party text into the model. Without it the dialog names "Shop assistant
|
|
255
|
+
(this site's assistant)", no "Always allow".
|
|
256
|
+
- Page state that changes (the product shown, the cart) belongs in a read-only tool such
|
|
257
|
+
as `get_page_context`, not in `instructions`: MCP has no notification for changed
|
|
258
|
+
instructions.
|
|
259
|
+
- `requestTimeoutMs` (300 s) limits each request on the page's side (`-31002`, the call
|
|
260
|
+
ends as `cancelled`); a port has none of the relay's other limits.
|
|
261
|
+
- `served.close()` (or `options.signal`) ends it; close it when the channel is gone.
|
|
262
|
+
Without `relay`, `connect()`, `showConnectDialog()` and `disconnectAll()` reject with a
|
|
263
|
+
`TypeError` and React's `ConnectButton` renders nothing. `serve`, the relay and
|
|
264
|
+
`webmcp: true` can be used together: one registration reaches all three.
|
|
265
|
+
|
|
266
|
+
## 4. Consequential tools
|
|
267
|
+
|
|
268
|
+
Give `consequentialHint: true` to a tool whose effect the user cannot undo in the page,
|
|
269
|
+
or that acts outside it: it deletes for good, sends, buys, books, publishes, or changes
|
|
270
|
+
data on the server. A change the user sees in the page and can take back (add a note, move
|
|
271
|
+
a shape in an editor with Undo) gets none: a question on every call teaches users to click
|
|
272
|
+
Allow without reading. The live examples follow this rule: the todo list asks before
|
|
273
|
+
deleting, the sign-in example before deleting notes; adding and completing do not ask.
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
await mcp.registerTool<{ id: string }>({
|
|
277
|
+
name: "delete_note",
|
|
278
|
+
description: "Delete a note by its id. It cannot be restored.",
|
|
279
|
+
inputSchema: { type: "object", properties: { id: { type: "string" } }, required: ["id"] },
|
|
280
|
+
annotations: { consequentialHint: true },
|
|
281
|
+
execute: ({ id }) => deleteNote(id),
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Write the description as what the tool does and that it cannot be undone; do not promise
|
|
286
|
+
a question ("the page asks first"): the library does not ask a WebMCP call the tab-mcp
|
|
287
|
+
browser extension did not vouch for (section 5), and an agent told it will be asked may
|
|
288
|
+
click the page's own buttons instead.
|
|
289
|
+
|
|
290
|
+
The page then asks before every call of an AI app through the relay (WebMCP calls: section 5): a dialog names the AI app and shows the arguments,
|
|
291
|
+
"Don't allow" has the focus, and "Allow once" turns on only after the page has been visible and
|
|
292
|
+
focused for 750 ms with the dialog open (leaving the page starts the wait again).
|
|
293
|
+
Invisible and direction-changing characters in the arguments are shown as `\uXXXX`. The
|
|
294
|
+
dialog offers "Don't allow" and "Allow once"; "Always allow" (that tool runs without asking for
|
|
295
|
+
that AI app, with any arguments, until the app is disconnected, kept in `storage`; the
|
|
296
|
+
connect dialog shows a switch per tool and "Always allow everything" under
|
|
297
|
+
each app) appears only with `alwaysAllow: true` on `TabMcp` (`"until-reload"`: memory
|
|
298
|
+
only, "Allow until reload"). A page can draw its own switches with `allowedTools(mcp)` of
|
|
299
|
+
`@ractive-ch/tab-mcp-client/allowed`. Leave it off unless the user really need not check
|
|
300
|
+
each call: it lifts the only brake on a prompt injection for up to the grant's 90 days,
|
|
301
|
+
and the relay's one `tools` scope covers every tool, so consent per tool is the page's. A refusal becomes an error result. The AI app also sees `destructiveHint: true`. To ask in the page's own UI,
|
|
302
|
+
pass `onConfirm: (request) => ConfirmAnswer | Promise<ConfirmAnswer>` to `TabMcp`, where
|
|
303
|
+
`ConfirmAnswer` is `true` (run), `false` (the user refused) or `"unanswered"` (the user
|
|
304
|
+
was asked and did not answer, e.g. the page's own question timed out: the AI app reads
|
|
305
|
+
"The user was asked and did not answer." and `toolcallend` has the outcome
|
|
306
|
+
`unanswered`); anything else, and a throw, is a refusal. `request` has
|
|
307
|
+
`tool`, `arguments`, `client` and `signal`; close the question when `signal` aborts.
|
|
308
|
+
`mcp.confirmInPage(request, { document? })` is the library's dialog, for example for
|
|
309
|
+
`client.kind === "local"`; for `client.kind === "webmcp"` it resolves `true` unshown, as
|
|
310
|
+
without `onConfirm`. A served port can have its own `onConfirm` (section 3).
|
|
311
|
+
Without `onConfirm` and without a `document`,
|
|
312
|
+
calls are declined.
|
|
313
|
+
|
|
314
|
+
## 5. WebMCP: agents in the browser
|
|
315
|
+
|
|
316
|
+
```ts
|
|
317
|
+
const mcp = new TabMcp({ relay, server, webmcp: true });
|
|
318
|
+
await mcp.registerTool(deleteNoteTool); // an AI app is asked; an unvouched WebMCP call is not
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Whether anyone asks before a tool that asks runs, and who, depends on the caller
|
|
322
|
+
(DEC-215); for some callers nobody does. The last three rows all arrive as
|
|
323
|
+
`client: { kind: "webmcp" }` without `via`; the page cannot tell them apart:
|
|
324
|
+
|
|
325
|
+
| Caller | Can it click in the tab? | Who asks |
|
|
326
|
+
|---|---|---|
|
|
327
|
+
| An AI app through the relay | no | the page: `onConfirm`, else the library's dialog |
|
|
328
|
+
| An AI app through the tab-mcp browser extension (a WebMCP call it vouched for) | no | the extension, in its side panel; the page skips its question and `onConfirm` (`trustExtension`, on by default; `false`: `onConfirm` decides, as for the rows below) |
|
|
329
|
+
| An agent in the browser that drives the tab | yes | the agent in its chat, if it heeds `consequentialHint`; the page's `onConfirm` if any; never the library's dialog |
|
|
330
|
+
| Another extension passing on an AI app's calls | no, unless that extension lets it | that extension, if it asks; the page's `onConfirm` if any; never the library's dialog |
|
|
331
|
+
| A document of an origin in the tool's `exposedTo` | no, not in the page | only the page's `onConfirm`, if any |
|
|
332
|
+
|
|
333
|
+
- `webmcp: true` (off by default) also registers each tool with the browser's native
|
|
334
|
+
`document.modelContext.registerTool()`, where the browser has it (in Chrome: sites in
|
|
335
|
+
the WebMCP origin trial, or `chrome://flags/#enable-webmcp-testing`). Agents in the
|
|
336
|
+
browser (built in, or an extension) then call the tools without pairing. It is a
|
|
337
|
+
change in what the page exposes: turn it on only when the user wants that.
|
|
338
|
+
- Every tool goes there, tools with `consequentialHint` or `destructiveHint` included
|
|
339
|
+
(since client 0.20, DEC-209): hiding them did not stop an agent that drives the tab, it
|
|
340
|
+
clicked the page's own controls instead, with no question. `callers` without
|
|
341
|
+
`"webmcp"` keeps a tool out (React: `useTool(tool, { callers: ["relay", "local"] })`).
|
|
342
|
+
- The library shows an unvouched WebMCP call no question (since client 0.21, DEC-215;
|
|
343
|
+
0.20 showed its dialog): an agent that
|
|
344
|
+
drives the tab clicked "Allow once" in the dialog itself. For another extension or an
|
|
345
|
+
`exposedTo` origin the dialog was a real check, and it is gone too. Such a tool is
|
|
346
|
+
registered with `consequentialHint: true`, so a caller that heeds it asks its user.
|
|
347
|
+
The page's `onConfirm` still gets the call (`client.kind === "webmcp"`, no `via`):
|
|
348
|
+
decide there in code (refuse, or a rule), never by showing something, which an agent
|
|
349
|
+
can click too. Without `onConfirm` the call runs. A tool that must not run on such a
|
|
350
|
+
caller's word leaves `"webmcp"` out of `callers`, and gets no `exposedTo` (the library
|
|
351
|
+
warns in the console about a tool that asks with `exposedTo` on a page without
|
|
352
|
+
`onConfirm`).
|
|
353
|
+
- **The tab-mcp browser extension.** With `webmcp: true` the page and the extension
|
|
354
|
+
shake hands. A call the user has just allowed in the extension (asked in its side
|
|
355
|
+
panel, or covered by its "Always allow" switch; the same tool, equal arguments, within
|
|
356
|
+
2 seconds) runs without `onConfirm`, so `onConfirm` is not a hook that sees every
|
|
357
|
+
call; its caller is `{ kind: "webmcp", via: "tab-mcp-extension", name, host }`.
|
|
358
|
+
`trustExtension: false` on `TabMcp` hands such a call to `onConfirm` like an
|
|
359
|
+
unvouched one; without `onConfirm` it then runs as well, so the option only matters
|
|
360
|
+
to a page with an `onConfirm`. `mcp.extension` (event `extensionchange`, React:
|
|
361
|
+
`extension` of `useTabMcpState()`) is `{ name, version, apps, whileInFront }` while
|
|
362
|
+
the extension serves the page, `apps` being the AI apps connected through it
|
|
363
|
+
(`{ name, host }`), else `undefined`; the connect dialog already says so. Details:
|
|
364
|
+
[With the tab-mcp browser extension](../README.md#with-the-tab-mcp-browser-extension).
|
|
365
|
+
- A WebMCP call gets the same argument check as an AI app's and fires `toolcall` and
|
|
366
|
+
`toolcallend` with `client.kind === "webmcp"`, so the page's record of calls still
|
|
367
|
+
lists it.
|
|
368
|
+
- The agent gets what `execute` returned. A failure (invalid arguments, a refusal of
|
|
369
|
+
`onConfirm`, a tool that is gone, a thrown error, an `isError` result) comes back as
|
|
370
|
+
`{ error: "<message>" }`, not as a rejection, which Chrome would hand the agent as a
|
|
371
|
+
bare `UnknownError`. Two cases still reject: a call the browser cancelled
|
|
372
|
+
(`AbortError`), and a call when the library's lazily loaded part cannot be loaded (a
|
|
373
|
+
new deploy while the page stays open, the network); reloading the page fixes that.
|
|
374
|
+
- Only the native object is used, never a polyfill such as `@mcp-b/global`. A failed
|
|
375
|
+
native registration (a name already registered natively, a frame without
|
|
376
|
+
`allow="tools"`) only warns in the console; the tool stays offered through the relay.
|
|
377
|
+
A page that registers tools natively itself leaves `webmcp` off or uses other names.
|
|
378
|
+
- The tab-mcp browser extension offers mirrored tools like any page tool, so an AI app connected to
|
|
379
|
+
both the page and the extension sees them twice.
|
|
380
|
+
|
|
381
|
+
## 6. Security defaults
|
|
382
|
+
|
|
383
|
+
Keep these; do not work around them.
|
|
384
|
+
|
|
385
|
+
- Sessions start only from a click. Do not call `connect()` from timers or on load
|
|
386
|
+
without the user's opt-in.
|
|
387
|
+
- Relays must be `https:`; `http:` works only for `localhost`, `127.0.0.1` and `[::1]`.
|
|
388
|
+
- Keep XSS out of the page and do not log or expose the secret under
|
|
389
|
+
`tab-mcp:secret:<relay origin>:<server name>`: whoever has it can take the page's place,
|
|
390
|
+
and the AI apps paired with it then use them until the page makes a new secret
|
|
391
|
+
(`disconnectAll()`).
|
|
392
|
+
Run the page on its own origin (not a shared one such as `*.github.io`) and keep
|
|
393
|
+
third-party scripts off it.
|
|
394
|
+
- For a page with user accounts, use identity binding
|
|
395
|
+
([references/sign-in.md](references/sign-in.md)): a copied secret then gets nothing.
|
|
396
|
+
On a page that pairs by code, grants follow the browser profile, not the person, so the
|
|
397
|
+
next user of a shared browser gets the AI apps the previous one paired: call
|
|
398
|
+
`mcp.disconnectAll()` when the user logs out.
|
|
399
|
+
- The relay's pairing page names the AI app and the app id of the address, not the page:
|
|
400
|
+
the code alone says which page is paired. Tell users never to pass their code on.
|
|
401
|
+
- Tools act with the user's rights in the page. Expose only what the user may do anyway,
|
|
402
|
+
and nothing that leaks other users' data.
|
|
403
|
+
- Connecting an AI app means trusting the page. Describe tools honestly; tool text and
|
|
404
|
+
results go to the model.
|
|
405
|
+
- Do not open the relay to every origin (`TAB_MCP_ALLOWED_ORIGINS=*`) in production.
|
|
406
|
+
|
|
407
|
+
## 7. Run the relay
|
|
408
|
+
|
|
409
|
+
Local development (a page on `http://localhost:3000`):
|
|
410
|
+
|
|
411
|
+
```sh
|
|
412
|
+
docker run --rm -p 8080:8080 -e NODE_ENV=development \
|
|
413
|
+
-e TAB_MCP_PUBLIC_URL=http://localhost:8080 \
|
|
414
|
+
-e TAB_MCP_ALLOWED_ORIGINS=http://localhost:3000 \
|
|
415
|
+
-e TAB_MCP_STORE=memory ractive/tab-mcp:0.13.2-rc.1
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Production: name the image version (pre-releases have no `latest` tag), keep `/data` on
|
|
419
|
+
a volume, and put the relay behind TLS:
|
|
420
|
+
|
|
421
|
+
```sh
|
|
422
|
+
docker run -d -p 127.0.0.1:8080:8080 -v tab-mcp-data:/data \
|
|
423
|
+
-e TAB_MCP_PUBLIC_URL=https://relay.example.com \
|
|
424
|
+
-e TAB_MCP_ALLOWED_ORIGINS=https://app.example.com \
|
|
425
|
+
-e TAB_MCP_TRUST_PROXY=x-real-ip ractive/tab-mcp:0.13.2-rc.1
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
`x-real-ip` fits an nginx proxy that sets `X-Real-IP $remote_addr`; behind Caddy use
|
|
429
|
+
`x-forwarded-for`. Set it only to a header your proxy overwrites, and never when clients
|
|
430
|
+
can reach the relay directly, or they can pick their own IP and get around the per-IP
|
|
431
|
+
limits.
|
|
432
|
+
|
|
433
|
+
Without Docker: `bun add --global @ractive-ch/tab-mcp`, then `tab-mcp` with the same
|
|
434
|
+
variables (Bun 1.4.4+). Run one relay process per public address. The reverse proxy must
|
|
435
|
+
forward WebSockets on `/tab`, must not buffer event streams on `/s/…/mcp`, and must allow
|
|
436
|
+
requests of up to 300 s. The relay starts event streams after 20 s, which keeps 60 s
|
|
437
|
+
first-byte limits of CDNs happy. Health check: `GET /healthz`.
|
|
438
|
+
|
|
439
|
+
## 8. Common mistakes
|
|
440
|
+
|
|
441
|
+
- `connect()` or `showConnectDialog()` on page load, in a `useEffect` or from a timer:
|
|
442
|
+
the browser refuses it. Open the dialog from a click; on load only
|
|
443
|
+
`connect({ resume: true })`, and only after the user turned AI access on.
|
|
444
|
+
- The page's origin is missing from `TAB_MCP_ALLOWED_ORIGINS`, or differs in scheme or
|
|
445
|
+
port: the relay refuses the page.
|
|
446
|
+
- `consequentialHint` on every tool that writes: only for effects the user cannot undo
|
|
447
|
+
in the page (section 4).
|
|
448
|
+
- A tool description or `instructions` that promise a question ("the page asks
|
|
449
|
+
first"): an unvouched WebMCP call is not asked by the library, and an agent told it
|
|
450
|
+
will be may click the page's own buttons instead. Say what the tool does and that it
|
|
451
|
+
cannot be undone (section 4).
|
|
452
|
+
- Casts or hand-written checks of the arguments in `execute`: the schema is checked
|
|
453
|
+
first; put the limits in it.
|
|
454
|
+
- A React tool that reads state the previous call changed from the component's props or
|
|
455
|
+
`useState`: it gets the old value. Read from a store or a ref
|
|
456
|
+
([references/react.md](references/react.md)).
|
|
457
|
+
- A retry loop around `connect()`: the library reconnects by itself (section 3).
|
|
458
|
+
- Renaming `server.name` after release: the page gets a new secret (and, without `app`, a
|
|
459
|
+
new address), so every AI app pairs again. Choose it once.
|
|
460
|
+
- Handing `serve`'s port to a frame with `"*"` as the target: transfer it as
|
|
461
|
+
`frame.contentWindow.postMessage({ type: "tools-port" }, "https://chat.example", [port2])`,
|
|
462
|
+
with the frame's checked origin (section 3).
|
|
463
|
+
|
|
464
|
+
## Check your work
|
|
465
|
+
|
|
466
|
+
Try the pairing flow by hand with Claude Code against a local relay. For automated
|
|
467
|
+
tests of the page's tools, `@ractive-ch/tab-mcp/testing` starts a relay in the test
|
|
468
|
+
process and gives a token without pairing
|
|
469
|
+
([the relay's README](https://github.com/ractive/tab-mcp/tree/relay-v0.13.2-rc.1/packages/tab-mcp#testing-a-pages-tools)).
|
|
470
|
+
Live pages to try are at <https://ractive.ch/tab-mcp/>. The relay's docs cover every
|
|
471
|
+
setting and the proxy details:
|
|
472
|
+
[configuration](https://github.com/ractive/tab-mcp/blob/relay-v0.13.2-rc.1/docs/configuration.md),
|
|
473
|
+
[self-hosting](https://github.com/ractive/tab-mcp/blob/relay-v0.13.2-rc.1/docs/self-hosting.md),
|
|
474
|
+
[compatibility](https://github.com/ractive/tab-mcp/blob/main/docs/compatibility.md) (which
|
|
475
|
+
AI apps work, kept up to date) and the
|
|
476
|
+
[security policy](https://github.com/ractive/tab-mcp/blob/main/SECURITY.md).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# React
|
|
2
|
+
|
|
3
|
+
Single-page apps with React 18.3 or 19 use `@ractive-ch/tab-mcp-client/react` (not in the
|
|
4
|
+
CDN build). The provider makes one `TabMcp` for the tree, each component registers the
|
|
5
|
+
tools it owns while mounted:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { ConnectButton, TabMcpProvider, useTabMcpState, useTool } from "@ractive-ch/tab-mcp-client/react";
|
|
9
|
+
|
|
10
|
+
export function App() {
|
|
11
|
+
return (
|
|
12
|
+
<TabMcpProvider relay="https://relay.example.com" server={{ name: "todo", version: "1.0.0" }} appName="Todo">
|
|
13
|
+
<TodoList />
|
|
14
|
+
</TabMcpProvider>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function TodoList() {
|
|
19
|
+
const todos = useTodos(); // a store, so a tool reads what the previous tool wrote
|
|
20
|
+
useTool<{ text: string }>({
|
|
21
|
+
name: "add_todo",
|
|
22
|
+
title: "Add a todo",
|
|
23
|
+
description: "Add a todo item (at most 200 characters). Returns it with its id.",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: { text: { type: "string", minLength: 1, maxLength: 200 } },
|
|
27
|
+
required: ["text"],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
},
|
|
30
|
+
execute: ({ text }) => todos.add(text),
|
|
31
|
+
});
|
|
32
|
+
const { state, grants } = useTabMcpState();
|
|
33
|
+
return <><ConnectButton /> {state === "connected" && `${grants.length} AI apps`}</>;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- `TabMcpProvider` takes the `TabMcp` options; a changed `relay` or `server.name` makes a
|
|
38
|
+
new instance. `useTabMcp()` returns it for `disconnectAll()`, `revoke()`, `signOut()`.
|
|
39
|
+
- `useTabMcpState()` returns `{ state, session, grants, pairingCode, pairingUntil,
|
|
40
|
+
identity, identityMessage, reconnecting, tools, extension }` (the address is
|
|
41
|
+
`session?.address`) and renders again only on change.
|
|
42
|
+
- `useTool(tool, options?)` always calls the latest `execute`; it registers again
|
|
43
|
+
only when the name, title, description, schemas or annotations change, or
|
|
44
|
+
`options.callers` or `options.exposedTo` (by value). A duplicate name throws from render (use an error boundary).
|
|
45
|
+
- A tool that changes state and returns it, or that reads what the previous call
|
|
46
|
+
changed, must not read `useState` values: `setState` only schedules the next render.
|
|
47
|
+
Keep the state in a store, or the current value in a ref beside the state, changed by
|
|
48
|
+
one function that the page's own UI uses too
|
|
49
|
+
([Tools in a `useState` app](../../README.md#tools-in-a-usestate-app)).
|
|
50
|
+
- `webmcp` on the provider registers the tools with the browser's WebMCP too, tools that
|
|
51
|
+
ask included; the library shows an unvouched WebMCP call no question (the provider's
|
|
52
|
+
`onConfirm`, if given, still decides in code); `useTool(tool, { callers: ["relay",
|
|
53
|
+
"local"] })` keeps one out (SKILL.md, section 5).
|
|
54
|
+
- `useToolCalls({ limit })` lists the AI app's recent calls; `ConnectButton` opens the
|
|
55
|
+
dialog and labels itself by state.
|
|
56
|
+
- The module starts with `"use client"`: in Next.js's app router the provider renders on
|
|
57
|
+
the client and never connects on the server.
|
|
58
|
+
[examples/react-todo](https://github.com/ractive/tab-mcp/tree/client-v0.21.0-rc.2/examples/react-todo)
|
|
59
|
+
is a complete app.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Sign-in instead of a code
|
|
2
|
+
|
|
3
|
+
On a relay that pairs by `oidc` (identity binding), the
|
|
4
|
+
user signs in to the AI app's connection with the account they use on the page and no
|
|
5
|
+
code is shown. Give the library `identityAssertion: async ({ address }) => …`, which asks
|
|
6
|
+
your backend for a short-lived tab assertion of the signed-in user for that address
|
|
7
|
+
(`null` when nobody is signed in); call `mcp.signOut()` in your logout (it resolves once the relay removed the grants) and
|
|
8
|
+
`mcp.refreshIdentity()` after a sign-in without a reload (it resolves with the new
|
|
9
|
+
`identity`); both reject with an `InvalidStateError` while the page is not connected. `identity` (`none`, `pending`,
|
|
10
|
+
`bound`, `refused`) and the event `identitychange` say whether the relay accepted it.
|
|
11
|
+
A sign-in pairs the page only while its "Connect your AI app" dialog is open, and for at
|
|
12
|
+
most 10 minutes after the user opened it: `pairingUntil` (event
|
|
13
|
+
`pairinguntil`) says until when. The library's dialog shows the time and then a
|
|
14
|
+
Continue button; a custom UI calls `startPairing()` again only from such a click, never
|
|
15
|
+
from a timer. A reconnect the library makes by itself does not start the 10 minutes
|
|
16
|
+
again. The relay's configuration:
|
|
17
|
+
[identity binding](https://github.com/ractive/tab-mcp/blob/relay-v0.13.2-rc.1/docs/configuration.md#identity-binding);
|
|
18
|
+
the page's side in full:
|
|
19
|
+
[Identity binding (no code)](../../README.md#identity-binding-no-code).
|
|
20
|
+
|
|
21
|
+
The backend signs for the user of its own session (its session cookie), and only for an
|
|
22
|
+
`address` of your relay. Do not take an ID token or another bearer credential from the
|
|
23
|
+
page per request and sign for whoever it names: a program sends any `Origin`, so an
|
|
24
|
+
Origin check does not stop it, and whoever holds a user's ID token (an hour, also after
|
|
25
|
+
sign-out) would get assertions naming that user. The live sign-in example
|
|
26
|
+
(<https://tab-mcp-login.ractive.ch/>) takes Google's ID token from the page because it has
|
|
27
|
+
no backend session; it is not the pattern for a real web app. `identityAssertion` must
|
|
28
|
+
answer within 15 s, including any sign-in prompt it waits for.
|
package/strings.d.ts
CHANGED
|
@@ -52,7 +52,6 @@ declare const english: {
|
|
|
52
52
|
};
|
|
53
53
|
/** Before the page's title while a confirmation waits in a hidden tab. */
|
|
54
54
|
titlePrefix: string;
|
|
55
|
-
clientWebMcp: string;
|
|
56
55
|
clientLocal: string;
|
|
57
56
|
/** An AI app through the relay: its name and the host of its client id. */
|
|
58
57
|
clientRelay: string;
|
package/strings.js
CHANGED
package/tab-mcp.d.ts
CHANGED
|
@@ -187,8 +187,8 @@ export declare class TabMcp extends EventTarget {
|
|
|
187
187
|
* and Allow, and Always allow with `alwaysAllow` (what runs without
|
|
188
188
|
* `onConfirm`), in `options.document` (default: the global one). An
|
|
189
189
|
* `onConfirm` may hand some calls to it. A call the user allowed for its
|
|
190
|
-
* AI app resolves `true` unasked.
|
|
191
|
-
* document.
|
|
190
|
+
* AI app resolves `true` unasked. A WebMCP call resolves `true` unasked
|
|
191
|
+
* too, without loading the dialog, as without `onConfirm` (DEC-215). Resolves `false` where there is no document.
|
|
192
192
|
*/
|
|
193
193
|
confirmInPage(request: ConfirmRequest, options?: {
|
|
194
194
|
document?: Document;
|