@mcp-b/global 1.3.0 → 1.5.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 +33 -0
- package/dist/index.d.ts +2 -1013
- package/dist/index.d.ts.map +1 -1
- package/dist/index.iife.js +13 -9
- package/dist/index.js +246 -232
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +71 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +48 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-DemXxUoc.d.ts +1036 -0
- package/dist/types-DemXxUoc.d.ts.map +1 -0
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -552,6 +552,8 @@ initializeWebModelContext({
|
|
|
552
552
|
|
|
553
553
|
This package **automatically detects and integrates** with Chromium's native Web Model Context API when available. No configuration needed - it just works!
|
|
554
554
|
|
|
555
|
+
For standards/source tracking and future conformance planning, see `./WEBMCP-CONFORMANCE-REFERENCES.md`.
|
|
556
|
+
|
|
555
557
|
### Automatic Detection & Integration
|
|
556
558
|
|
|
557
559
|
When you call `initializeWebModelContext()` (or when auto-initialization runs):
|
|
@@ -1371,6 +1373,37 @@ if (window.__mcpBridge) {
|
|
|
1371
1373
|
|
|
1372
1374
|
This package provides a **Model Context Testing API** at `window.navigator.modelContextTesting` for debugging and testing your tools during development.
|
|
1373
1375
|
|
|
1376
|
+
> [!WARNING]
|
|
1377
|
+
> `navigator.modelContextTesting` is deprecated and kept for compatibility.
|
|
1378
|
+
> For in-page consumers, use `navigator.modelContext.callTool({ name, arguments })` and
|
|
1379
|
+
> `navigator.modelContext.addEventListener("toolschanged", ...)`.
|
|
1380
|
+
|
|
1381
|
+
### Unified Consumer API (Recommended)
|
|
1382
|
+
|
|
1383
|
+
```javascript
|
|
1384
|
+
// Execute tools with object args (no JSON stringification)
|
|
1385
|
+
const result = await navigator.modelContext.callTool({
|
|
1386
|
+
name: "greet",
|
|
1387
|
+
arguments: { name: "Alice" }
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
// React to tool list changes
|
|
1391
|
+
navigator.modelContext.addEventListener("toolschanged", () => {
|
|
1392
|
+
console.log("Tools changed:", navigator.modelContext.listTools());
|
|
1393
|
+
});
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
### Testing Helpers Module
|
|
1397
|
+
|
|
1398
|
+
Use `@mcp-b/global/testing` to avoid depending on global-only testing extensions directly:
|
|
1399
|
+
|
|
1400
|
+
```javascript
|
|
1401
|
+
import { createTestHelper } from "@mcp-b/global/testing";
|
|
1402
|
+
|
|
1403
|
+
const testing = createTestHelper();
|
|
1404
|
+
await testing.executeTool("greet", { name: "Alice" });
|
|
1405
|
+
```
|
|
1406
|
+
|
|
1374
1407
|
### Native Support in Chromium
|
|
1375
1408
|
|
|
1376
1409
|
**IMPORTANT**: The `modelContextTesting` API is available natively in Chromium-based browsers when the experimental feature flag is enabled. This polyfill will detect and use the native implementation when available.
|