@mcp-b/webmcp-ts-sdk 2.3.2 → 3.0.0-beta.20260702171253
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 +12 -12
- package/dist/index.d.ts +57 -9073
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +238 -5156
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://www.typescriptlang.org/)
|
|
9
9
|
[](https://github.com/WebMCP-org/npm-packages)
|
|
10
10
|
|
|
11
|
-
**[
|
|
11
|
+
**[Reference](https://docs.mcp-b.ai/packages/webmcp-ts-sdk/reference)** | **[First Tool Tutorial](https://docs.mcp-b.ai/tutorials/first-tool)**
|
|
12
12
|
|
|
13
13
|
**@mcp-b/webmcp-ts-sdk** adapts the official MCP TypeScript SDK for browser environments, enabling dynamic tool registration required by the W3C Web Model Context API. This allows AI agents like Claude, ChatGPT, Gemini, Cursor, and Copilot to interact with browser-based applications.
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
## Overview
|
|
26
26
|
|
|
27
|
-
This package adapts the official [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk) for browser environments with modifications to support dynamic tool registration required by the [W3C Web Model Context API](https://github.
|
|
27
|
+
This package adapts the official [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk) for browser environments with modifications to support dynamic tool registration required by the [W3C Web Model Context API](https://webmachinelearning.github.io/webmcp/) (`document.modelContext`).
|
|
28
28
|
|
|
29
29
|
## Why This Package Exists
|
|
30
30
|
|
|
@@ -41,7 +41,7 @@ public registerCapabilities(capabilities: ServerCapabilities): void {
|
|
|
41
41
|
|
|
42
42
|
For the Web Model Context API, this restriction is incompatible because:
|
|
43
43
|
|
|
44
|
-
1. **Tools arrive dynamically** - Web pages call `
|
|
44
|
+
1. **Tools arrive dynamically** - Web pages call `document.modelContext.registerTool(...)` at any time
|
|
45
45
|
2. **Transport must be ready immediately** - The MCP server/transport needs to be connected when the page loads
|
|
46
46
|
3. **Asynchronous registration** - Tools are registered as the page's JavaScript executes, potentially long after initialization
|
|
47
47
|
|
|
@@ -50,9 +50,9 @@ This package solves the problem by **pre-registering tool capabilities** before
|
|
|
50
50
|
Compatibility note:
|
|
51
51
|
|
|
52
52
|
- `BrowserMcpServer.registerTool(tool, options?)` accepts the WebMCP April 23, 2026 draft signature, including `options.signal` (`AbortSignal`) for unregistration. When the signal aborts, both the server-side registration and the mirrored native registration are removed.
|
|
53
|
-
- The same call
|
|
54
|
-
- `unregisterTool(name)` was removed from the WebMCP draft on April 23, 2026 in favor of the `AbortSignal` flow. It is kept on `BrowserMcpServer` with a one-time deprecation warning
|
|
55
|
-
- `provideContext()` and `clearContext()` were removed from the WebMCP draft on March 5, 2026
|
|
53
|
+
- The same call resolves `undefined`, matching current Chromium and the WebMCP spec.
|
|
54
|
+
- `unregisterTool(name)` was removed from the WebMCP draft on April 23, 2026 in favor of the `AbortSignal` flow. It is kept on `BrowserMcpServer` with a one-time deprecation warning for older MCP-B integrations. It will be removed in the next major version.
|
|
55
|
+
- `provideContext()` and `clearContext()` were removed from the WebMCP draft on March 5, 2026 and are not exposed by `BrowserMcpServer`.
|
|
56
56
|
|
|
57
57
|
## Modifications from Official SDK
|
|
58
58
|
|
|
@@ -235,20 +235,20 @@ Unlikely. The modification is minimal and isolated. When upstream updates, just
|
|
|
235
235
|
|
|
236
236
|
### When should I use this vs `@mcp-b/global`?
|
|
237
237
|
|
|
238
|
-
Use `@mcp-b/global` for the standard `
|
|
238
|
+
Use `@mcp-b/global` for the standard `document.modelContext` API. Use this package directly only if you need low-level control over the MCP server.
|
|
239
239
|
|
|
240
240
|
## Related Packages
|
|
241
241
|
|
|
242
|
-
- [`@mcp-b/global`](https://docs.mcp-b.ai/packages/global) -
|
|
243
|
-
- [`@mcp-b/transports`](https://docs.mcp-b.ai/packages/transports) - Browser-specific MCP transports
|
|
244
|
-
- [`@mcp-b/react-webmcp`](https://docs.mcp-b.ai/packages/react-webmcp) - React hooks for MCP
|
|
245
|
-
- [`@mcp-b/chrome-devtools-mcp`](https://docs.mcp-b.ai/packages/chrome-devtools-mcp) - Connect desktop AI agents to browser tools
|
|
242
|
+
- [`@mcp-b/global`](https://docs.mcp-b.ai/packages/global/reference) - Full MCP-B browser runtime (uses this package internally)
|
|
243
|
+
- [`@mcp-b/transports`](https://docs.mcp-b.ai/packages/transports/reference) - Browser-specific MCP transports
|
|
244
|
+
- [`@mcp-b/react-webmcp`](https://docs.mcp-b.ai/packages/react-webmcp/reference) - React hooks for MCP
|
|
245
|
+
- [`@mcp-b/chrome-devtools-mcp`](https://docs.mcp-b.ai/packages/chrome-devtools-mcp/reference) - Connect desktop AI agents to browser tools
|
|
246
246
|
- [`@modelcontextprotocol/sdk`](https://www.npmjs.com/package/@modelcontextprotocol/sdk) - Official MCP SDK
|
|
247
247
|
|
|
248
248
|
## Resources
|
|
249
249
|
|
|
250
250
|
- [WebMCP Documentation](https://docs.mcp-b.ai)
|
|
251
|
-
- [Web Model Context API Explainer](https://github.
|
|
251
|
+
- [Web Model Context API Explainer](https://webmachinelearning.github.io/webmcp/)
|
|
252
252
|
- [Model Context Protocol Spec](https://modelcontextprotocol.io/)
|
|
253
253
|
- [Official MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
254
254
|
- [MCP GitHub Repository](https://github.com/modelcontextprotocol)
|