@mcp-b/webmcp-polyfill 4.0.0-beta.20260702180822 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Strict WebMCP core runtime polyfill for `document.modelContext` (with a
|
|
4
4
|
backward-compatible `navigator.modelContext` alias).
|
|
5
5
|
|
|
6
|
-
> **Heads up
|
|
6
|
+
> **Heads up - WebMCP spec migration.** The `modelContext` getter moved from
|
|
7
7
|
> `Navigator` to `Document` in
|
|
8
8
|
> [webmachinelearning/webmcp#184](https://github.com/webmachinelearning/webmcp/pull/184)
|
|
9
9
|
> and Chrome 150 deprecates `navigator.modelContext`. The polyfill installs on
|
|
@@ -13,17 +13,17 @@ backward-compatible `navigator.modelContext` alias).
|
|
|
13
13
|
> access. Prefer `document.modelContext` for new code.
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
|
-
const modelContext = document.modelContext
|
|
16
|
+
const modelContext = document.modelContext;
|
|
17
17
|
if (modelContext) {
|
|
18
|
-
// Register tools
|
|
18
|
+
// Register tools...
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
`@mcp-b/webmcp-polyfill` installs only the strict core API:
|
|
23
23
|
|
|
24
|
-
- `registerTool(tool, options?)`
|
|
25
|
-
- `getTools()`
|
|
26
|
-
- `executeTool(toolFromGetTools, inputArgsJson, options?)`
|
|
24
|
+
- `registerTool(tool, options?)` - pass `options.signal` (`AbortSignal`) to unregister when aborted
|
|
25
|
+
- `getTools()` - async Chromium producer-preview discovery API
|
|
26
|
+
- `executeTool(toolFromGetTools, inputArgsJson, options?)` - Chromium producer-preview execution API
|
|
27
27
|
- `unregisterTool(nameOrTool)` (deprecated compatibility API)
|
|
28
28
|
|
|
29
29
|
It does not install MCP bridge extensions like `callTool`, resources, or prompts.
|
|
@@ -166,7 +166,7 @@ Restores previous `document.modelContext`, `navigator.modelContext`, and `naviga
|
|
|
166
166
|
- Requires a non-empty `name`, non-empty `description`, and `execute` function.
|
|
167
167
|
- Throws on duplicate tool names.
|
|
168
168
|
- If `inputSchema` is omitted, runtime defaults to `{ type: 'object', properties: {} }`.
|
|
169
|
-
- `options.signal` (optional `AbortSignal`)
|
|
169
|
+
- `options.signal` (optional `AbortSignal`) - when the signal aborts, the tool is unregistered. If the signal is already aborted at registration time, the polyfill skips the registration and logs a warning (matching the April 23, 2026 spec step).
|
|
170
170
|
|
|
171
171
|
```ts
|
|
172
172
|
const ac = new AbortController();
|
|
@@ -182,7 +182,7 @@ document.modelContext.registerTool(
|
|
|
182
182
|
{ signal: ac.signal }
|
|
183
183
|
);
|
|
184
184
|
|
|
185
|
-
// Later
|
|
185
|
+
// Later - unregister cleanly:
|
|
186
186
|
ac.abort();
|
|
187
187
|
```
|
|
188
188
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-b/webmcp-polyfill",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Strict WebMCP core runtime polyfill for document.modelContext (with deprecated navigator.modelContext alias)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@cfworker/json-schema": "^4.1.1",
|
|
54
54
|
"@standard-schema/spec": "^1.1.0",
|
|
55
|
-
"@mcp-b/webmcp-types": "4.0.0
|
|
55
|
+
"@mcp-b/webmcp-types": "4.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@vitest/coverage-v8": "^4.1.7",
|