@mcp-b/webmcp-ts-sdk 2.3.2 → 3.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 +1 -1
- package/dist/index.d.ts +5 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -46
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ Compatibility note:
|
|
|
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
53
|
- The same call still returns a deprecated `{ unregister }` compatibility handle so existing MCP-B integrations do not break, even though spec/native runtimes return `undefined`. The handle will be removed in the next major version — prefer `options.signal`.
|
|
54
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 to interoperate with current Chrome Beta 147 (which still ships the string-name API). It will be removed in the next major version.
|
|
55
|
-
- `provideContext()` and `clearContext()` were removed from the WebMCP draft on March 5, 2026
|
|
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
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as z3 from "zod/v3";
|
|
2
2
|
import * as z from "zod/v4";
|
|
3
3
|
import * as z4 from "zod/v4/core";
|
|
4
|
-
import { InputSchema, ModelContextCore,
|
|
4
|
+
import { InputSchema, ModelContextCore, ModelContextRegisterToolOptions, ModelContextTestingExecuteToolOptions, ModelContextToolInfo, ModelContextToolReference, ResourceContents as ResourceContents$1, ToolDescriptor, ToolListItem, ToolResponse } from "@mcp-b/webmcp-types";
|
|
5
5
|
|
|
6
6
|
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts
|
|
7
7
|
type AnySchema = z3.ZodTypeAny | z4.$ZodType;
|
|
@@ -9012,8 +9012,8 @@ type RegisteredToolHandle = {
|
|
|
9012
9012
|
* (resources, prompts, elicitation, sampling) via BaseMcpServer.
|
|
9013
9013
|
*
|
|
9014
9014
|
* Deprecated compatibility (kept for Chrome Beta 147 and existing wrappers,
|
|
9015
|
-
* removed in the next major): `unregisterTool(name)
|
|
9016
|
-
*
|
|
9015
|
+
* removed in the next major): `unregisterTool(name)` and the `{ unregister }`
|
|
9016
|
+
* handle returned from `registerTool`.
|
|
9017
9017
|
*
|
|
9018
9018
|
* When `native` is provided, tool operations are mirrored so that
|
|
9019
9019
|
* navigator.modelContextTesting stays in sync.
|
|
@@ -9024,8 +9024,6 @@ declare class BrowserMcpServer extends McpServer {
|
|
|
9024
9024
|
private _promptSchemas;
|
|
9025
9025
|
private _jsonValidator;
|
|
9026
9026
|
private _publicMethodsBound;
|
|
9027
|
-
private _provideContextDeprecationWarned;
|
|
9028
|
-
private _clearContextDeprecationWarned;
|
|
9029
9027
|
private _unregisterToolDeprecationWarned;
|
|
9030
9028
|
private _nativeToolCleanups;
|
|
9031
9029
|
private _producerEventTarget;
|
|
@@ -9068,7 +9066,6 @@ declare class BrowserMcpServer extends McpServer {
|
|
|
9068
9066
|
*/
|
|
9069
9067
|
syncNativeTools(): number;
|
|
9070
9068
|
unregisterTool(nameOrTool: string | ModelContextToolReference): void;
|
|
9071
|
-
private clearRegisteredTools;
|
|
9072
9069
|
registerResource(descriptor: {
|
|
9073
9070
|
uri: string;
|
|
9074
9071
|
name: string;
|
|
@@ -9090,11 +9087,7 @@ declare class BrowserMcpServer extends McpServer {
|
|
|
9090
9087
|
}): {
|
|
9091
9088
|
unregister: () => void;
|
|
9092
9089
|
};
|
|
9093
|
-
provideContext(options?: ModelContextOptions): void;
|
|
9094
|
-
clearContext(): void;
|
|
9095
9090
|
private resolveToolNameForUnregister;
|
|
9096
|
-
private warnProvideContextDeprecationOnce;
|
|
9097
|
-
private warnClearContextDeprecationOnce;
|
|
9098
9091
|
private warnUnregisterToolDeprecationOnce;
|
|
9099
9092
|
listResources(): Array<{
|
|
9100
9093
|
uri: string;
|
|
@@ -9118,7 +9111,7 @@ declare class BrowserMcpServer extends McpServer {
|
|
|
9118
9111
|
messages: PromptMessage[];
|
|
9119
9112
|
}>;
|
|
9120
9113
|
listTools(): ToolListItem[];
|
|
9121
|
-
getTools():
|
|
9114
|
+
getTools(): Promise<ModelContextToolInfo[]>;
|
|
9122
9115
|
/**
|
|
9123
9116
|
* Override SDK's validateToolInput to handle both Zod schemas and plain JSON Schema.
|
|
9124
9117
|
* Zod schemas use the SDK's safeParseAsync; plain JSON Schema uses PolyfillJsonSchemaValidator.
|
|
@@ -9136,6 +9129,7 @@ declare class BrowserMcpServer extends McpServer {
|
|
|
9136
9129
|
name: string;
|
|
9137
9130
|
arguments?: Record<string, unknown>;
|
|
9138
9131
|
}): Promise<ToolResponse>;
|
|
9132
|
+
executeTool(tool: ModelContextToolInfo, inputArgsJson: string, options?: ModelContextTestingExecuteToolOptions): Promise<string | null>;
|
|
9139
9133
|
executeTool(name: string, args?: Record<string, unknown>): Promise<ToolResponse>;
|
|
9140
9134
|
/**
|
|
9141
9135
|
* Override connect to initialize request handlers BEFORE the transport connection.
|