@mcp-b/webmcp-ts-sdk 2.3.1 → 3.0.0-beta.20260529000441

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 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. They are kept here as deprecated compatibility shims and emit a one-time deprecation warning when invoked.
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,9 +1,9 @@
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, ModelContextOptions, ModelContextRegisterToolOptions, ModelContextTestingToolInfo, ModelContextToolReference, ResourceContents as ResourceContents$1, ToolDescriptor, ToolListItem, ToolResponse } from "@mcp-b/webmcp-types";
4
+ import { InputSchema, ModelContextCore, ModelContextRegisterToolOptions, ModelContextTestingExecuteToolOptions, ModelContextToolInfo, ModelContextToolReference, ResourceContents as ResourceContents$1, ToolDescriptor, ToolListItem, ToolResponse } from "@mcp-b/webmcp-types";
5
5
 
6
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts
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;
8
8
  type AnyObjectSchema = z3.AnyZodObject | z4.$ZodObject | AnySchema;
9
9
  type ZodRawShapeCompat = Record<string, AnySchema>;
@@ -14,7 +14,7 @@ type SchemaOutput<S> = S extends z3.ZodTypeAny ? z3.infer<S> : S extends z4.$Zod
14
14
  */
15
15
  type ShapeOutput<Shape extends ZodRawShapeCompat> = { [K in keyof Shape]: SchemaOutput<Shape[K]> };
16
16
  //#endregion
17
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts
17
+ //#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/auth/types.d.ts
18
18
  /**
19
19
  * Information about a validated access token, provided to request handlers.
20
20
  */
@@ -47,7 +47,7 @@ interface AuthInfo {
47
47
  extra?: Record<string, unknown>;
48
48
  }
49
49
  //#endregion
50
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts
50
+ //#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/types.d.ts
51
51
  declare const LATEST_PROTOCOL_VERSION = "2025-11-25";
52
52
  declare const SUPPORTED_PROTOCOL_VERSIONS: string[];
53
53
  /**
@@ -5729,7 +5729,7 @@ type ServerRequest = Infer<typeof ServerRequestSchema>;
5729
5729
  type ServerNotification = Infer<typeof ServerNotificationSchema>;
5730
5730
  type ServerResult = Infer<typeof ServerResultSchema>;
5731
5731
  //#endregion
5732
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts
5732
+ //#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/shared/transport.d.ts
5733
5733
  /**
5734
5734
  * Options for sending a JSON-RPC message.
5735
5735
  */
@@ -5803,7 +5803,7 @@ interface Transport {
5803
5803
  setProtocolVersion?: (version: string) => void;
5804
5804
  }
5805
5805
  //#endregion
5806
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts
5806
+ //#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/experimental/tasks/interfaces.d.ts
5807
5807
  /**
5808
5808
  * Extended handler extra with task store for task creation.
5809
5809
  * @experimental
@@ -6019,7 +6019,7 @@ interface TaskStore {
6019
6019
  }>;
6020
6020
  }
6021
6021
  //#endregion
6022
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts
6022
+ //#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/shared/responseMessage.d.ts
6023
6023
  /**
6024
6024
  * Base message type
6025
6025
  */
@@ -6061,7 +6061,7 @@ interface ErrorMessage extends BaseResponseMessage {
6061
6061
  */
6062
6062
  type ResponseMessage<T extends Result> = TaskStatusMessage | TaskCreatedMessage | ResultMessage<T> | ErrorMessage;
6063
6063
  //#endregion
6064
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts
6064
+ //#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/shared/protocol.d.ts
6065
6065
  /**
6066
6066
  * Callback for progress notifications.
6067
6067
  */
@@ -7529,7 +7529,7 @@ declare enum TypeName {
7529
7529
  String = "string"
7530
7530
  }
7531
7531
  //#endregion
7532
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts
7532
+ //#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/validation/types.d.ts
7533
7533
  /**
7534
7534
  * JSON Schema type definition (JSON Schema Draft 2020-12)
7535
7535
  *
@@ -7594,7 +7594,7 @@ interface jsonSchemaValidator {
7594
7594
  getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator$2<T>;
7595
7595
  }
7596
7596
  //#endregion
7597
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts
7597
+ //#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/experimental/tasks/client.d.ts
7598
7598
  /**
7599
7599
  * Experimental task features for MCP clients.
7600
7600
  *
@@ -7703,7 +7703,7 @@ declare class ExperimentalClientTasks<RequestT extends Request = Request, Notifi
7703
7703
  requestStream<T extends AnyObjectSchema>(request: ClientRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>;
7704
7704
  }
7705
7705
  //#endregion
7706
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts
7706
+ //#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/client/index.d.ts
7707
7707
  type ClientOptions = ProtocolOptions & {
7708
7708
  /**
7709
7709
  * Capabilities to advertise as being supported by this client.
@@ -8271,7 +8271,7 @@ declare class Client<RequestT extends Request = Request, NotificationT extends N
8271
8271
  sendRootsListChanged(): Promise<void>;
8272
8272
  }
8273
8273
  //#endregion
8274
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts
8274
+ //#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/shared/stdio.d.ts
8275
8275
  /**
8276
8276
  * Buffers a continuous stdio stream into discrete JSON-RPC messages.
8277
8277
  */
@@ -8283,7 +8283,7 @@ declare class ReadBuffer {
8283
8283
  }
8284
8284
  declare function serializeMessage(message: JSONRPCMessage): string;
8285
8285
  //#endregion
8286
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts
8286
+ //#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/experimental/tasks/server.d.ts
8287
8287
  /**
8288
8288
  * Experimental task features for low-level MCP servers.
8289
8289
  *
@@ -8356,7 +8356,7 @@ declare class ExperimentalServerTasks<RequestT extends Request = Request, Notifi
8356
8356
  cancelTask(taskId: string, options?: RequestOptions): Promise<CancelTaskResult>;
8357
8357
  }
8358
8358
  //#endregion
8359
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts
8359
+ //#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/index.d.ts
8360
8360
  type ServerOptions = ProtocolOptions & {
8361
8361
  /**
8362
8362
  * Capabilities to advertise as being supported by this server.
@@ -8547,7 +8547,7 @@ declare class Server<RequestT extends Request = Request, NotificationT extends N
8547
8547
  sendPromptListChanged(): Promise<void>;
8548
8548
  }
8549
8549
  //#endregion
8550
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts
8550
+ //#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/shared/uriTemplate.d.ts
8551
8551
  type Variables = Record<string, string | string[]>;
8552
8552
  declare class UriTemplate {
8553
8553
  /**
@@ -8573,7 +8573,7 @@ declare class UriTemplate {
8573
8573
  match(uri: string): Variables | null;
8574
8574
  }
8575
8575
  //#endregion
8576
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts
8576
+ //#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/experimental/tasks/mcp-server.d.ts
8577
8577
  /**
8578
8578
  * Experimental task features for McpServer.
8579
8579
  *
@@ -8641,7 +8641,7 @@ declare class ExperimentalMcpServerTasks {
8641
8641
  }, handler: ToolTaskHandler<InputArgs>): RegisteredTool;
8642
8642
  }
8643
8643
  //#endregion
8644
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_@cfworker+json-schema@4.1.1_zod@4.3.5/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts
8644
+ //#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/mcp.d.ts
8645
8645
  /**
8646
8646
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
8647
8647
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -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)`, `provideContext()`,
9016
- * `clearContext()`, and the `{ unregister }` handle returned from `registerTool`.
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(): ModelContextTestingToolInfo[];
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.