@mcp-b/webmcp-ts-sdk 4.0.0-beta.20260702175639 → 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.
Files changed (2) hide show
  1. package/README.md +12 -15
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -6,25 +6,22 @@
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@mcp-b/webmcp-ts-sdk?style=flat-square)](https://www.npmjs.com/package/@mcp-b/webmcp-ts-sdk)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue?style=flat-square)](https://www.typescriptlang.org/)
9
- [![Minimal Code](https://img.shields.io/badge/Custom_Code-~50_lines-green?style=flat-square)](https://github.com/WebMCP-org/npm-packages)
10
-
11
9
  **[Reference](https://docs.mcp-b.ai/packages/webmcp-ts-sdk/reference)** | **[First Tool Tutorial](https://docs.mcp-b.ai/tutorials/first-tool)**
12
10
 
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.
11
+ **@mcp-b/webmcp-ts-sdk** adapts the official MCP TypeScript SDK for browser environments, enabling dynamic tool registration required by the WebMCP API. This allows AI agents like Claude, ChatGPT, Gemini, Cursor, and Copilot to interact with browser-based applications.
14
12
 
15
13
  ## Why Use @mcp-b/webmcp-ts-sdk?
16
14
 
17
15
  | Feature | Benefit |
18
16
  | ----------------------------- | --------------------------------------------------------------------- |
19
17
  | **Dynamic Tool Registration** | Register tools after transport connection - required for browser apps |
20
- | **Minimal Overhead** | Only ~50 lines of custom code on top of official SDK |
21
18
  | **Full SDK Compatibility** | Re-exports all types, classes, and utilities from official SDK |
22
19
  | **Type-Safe** | No prototype hacks - clean TypeScript extension |
23
20
  | **Auto-Updates** | Types and protocol follow official SDK automatically |
24
21
 
25
22
  ## Overview
26
23
 
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`).
24
+ 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 [WebMCP API](https://webmachinelearning.github.io/webmcp/) (`document.modelContext`).
28
25
 
29
26
  ## Why This Package Exists
30
27
 
@@ -39,7 +36,7 @@ public registerCapabilities(capabilities: ServerCapabilities): void {
39
36
  }
40
37
  ```
41
38
 
42
- For the Web Model Context API, this restriction is incompatible because:
39
+ For WebMCP, this restriction is incompatible because:
43
40
 
44
41
  1. **Tools arrive dynamically** - Web pages call `document.modelContext.registerTool(...)` at any time
45
42
  2. **Transport must be ready immediately** - The MCP server/transport needs to be connected when the page loads
@@ -136,13 +133,13 @@ server.registerTool(
136
133
  {
137
134
  description: 'A dynamically registered tool',
138
135
  inputSchema: { message: z.string() },
139
- // Output schemas enable structured, type-safe AI responses
136
+ // outputSchema is MCP-B metadata for structured, type-safe responses
140
137
  outputSchema: { result: z.string() },
141
138
  },
142
139
  async ({ message }) => {
143
140
  return {
144
141
  content: [{ type: 'text', text: `Echo: ${message}` }],
145
- // structuredContent must match the outputSchema
142
+ // structuredContent should match the outputSchema for MCP-B adapters
146
143
  structuredContent: { result: `Echo: ${message}` },
147
144
  };
148
145
  }
@@ -203,9 +200,8 @@ server.registerTool(
203
200
 
204
201
  This package is designed for **minimal maintenance**:
205
202
 
206
- - **~50 lines** of custom code
207
203
  - **Automatic updates** for types, protocol, validation via official SDK dependency
208
- - **Single modification point** - only capability registration behavior
204
+ - **Small modification surface** - capability registration and browser runtime adaptation
209
205
  - **Type-safe** - no prototype hacks or unsafe casts
210
206
 
211
207
  ### Syncing with Upstream
@@ -217,7 +213,8 @@ When the official SDK updates:
217
213
  3. Test that capability registration still works
218
214
  4. Update this README if SDK behavior changes
219
215
 
220
- The modification is minimal and unlikely to conflict with upstream changes.
216
+ The modification surface is intentionally small and should be checked whenever
217
+ the upstream SDK changes capability registration behavior.
221
218
 
222
219
  ## Frequently Asked Questions
223
220
 
@@ -227,11 +224,11 @@ The official SDK throws an error if you try to register tools after connecting a
227
224
 
228
225
  ### Is this a fork of the official SDK?
229
226
 
230
- No - it's a thin adapter (~50 lines) that extends the official SDK. All types, protocol handling, and validation come from the upstream package.
227
+ No. It is an adapter that extends the official SDK. Core protocol handling and most SDK types come from the upstream package.
231
228
 
232
229
  ### Will this break when the official SDK updates?
233
230
 
234
- Unlikely. The modification is minimal and isolated. When upstream updates, just update your dependencies - the wrapper adapts automatically.
231
+ Unlikely. The modification surface is isolated. When upstream updates, update the dependency and run the conformance tests.
235
232
 
236
233
  ### When should I use this vs `@mcp-b/global`?
237
234
 
@@ -242,13 +239,13 @@ Use `@mcp-b/global` for the standard `document.modelContext` API. Use this packa
242
239
  - [`@mcp-b/global`](https://docs.mcp-b.ai/packages/global/reference) - Full MCP-B browser runtime (uses this package internally)
243
240
  - [`@mcp-b/transports`](https://docs.mcp-b.ai/packages/transports/reference) - Browser-specific MCP transports
244
241
  - [`@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
242
+ - [`chrome-devtools-mcp`](https://github.com/ChromeDevTools/chrome-devtools-mcp) - Upstream Chrome DevTools MCP server
246
243
  - [`@modelcontextprotocol/sdk`](https://www.npmjs.com/package/@modelcontextprotocol/sdk) - Official MCP SDK
247
244
 
248
245
  ## Resources
249
246
 
250
247
  - [WebMCP Documentation](https://docs.mcp-b.ai)
251
- - [Web Model Context API Explainer](https://webmachinelearning.github.io/webmcp/)
248
+ - [WebMCP specification](https://webmachinelearning.github.io/webmcp/)
252
249
  - [Model Context Protocol Spec](https://modelcontextprotocol.io/)
253
250
  - [Official MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
254
251
  - [MCP GitHub Repository](https://github.com/modelcontextprotocol)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/webmcp-ts-sdk",
3
- "version": "4.0.0-beta.20260702175639",
3
+ "version": "4.0.0",
4
4
  "description": "Browser-adapted MCP TypeScript SDK - Dynamic tool registration for W3C Web Model Context API and AI agent integration",
5
5
  "keywords": [
6
6
  "adapter",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@modelcontextprotocol/sdk": "1.29.0",
61
- "@mcp-b/webmcp-polyfill": "4.0.0-beta.20260702175639",
62
- "@mcp-b/webmcp-types": "4.0.0-beta.20260702175639"
61
+ "@mcp-b/webmcp-polyfill": "4.0.0",
62
+ "@mcp-b/webmcp-types": "4.0.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/node": "22.17.2",