55// Only the meta-package provides this overload, by design — the underlying
66// `@modelcontextprotocol/{server,client}` packages stay on the v2 API.
77
8- import {
9- Client as BaseClient ,
10- type ClientContext ,
11- type NotificationMethod ,
12- type RequestMethod ,
13- type Result ,
14- type StandardSchemaV1
15- } from '@modelcontextprotocol/client' ;
16- import {
17- McpServer as BaseMcpServer ,
18- type RequestHandlerSchemas ,
19- type ResultTypeMap ,
20- Server as BaseServer ,
21- type ServerContext ,
22- type ServerOptions
23- } from '@modelcontextprotocol/server' ;
8+ import type { ClientContext , NotificationMethod , RequestMethod , Result , StandardSchemaV1 } from '@modelcontextprotocol/client' ;
9+ import { Client as BaseClient } from '@modelcontextprotocol/client' ;
10+ import type { RequestHandlerSchemas , ResultTypeMap , ServerContext , ServerOptions } from '@modelcontextprotocol/server' ;
11+ import { McpServer as BaseMcpServer , Server as BaseServer } from '@modelcontextprotocol/server' ;
2412import type * as z from 'zod' ;
2513
2614type ZodRequestSchema < M extends string = string > = z . ZodObject < { method : z . ZodLiteral < M > } & z . ZodRawShape > ;
@@ -70,7 +58,9 @@ function withV1SchemaOverloads<
7058 handler : (
7159 params : StandardSchemaV1 . InferOutput < P > ,
7260 ctx : Ctx
73- ) => R extends StandardSchemaV1 ? StandardSchemaV1 . InferOutput < R > | Promise < StandardSchemaV1 . InferOutput < R > > : Result | Promise < Result >
61+ ) => R extends StandardSchemaV1
62+ ? StandardSchemaV1 . InferOutput < R > | Promise < StandardSchemaV1 . InferOutput < R > >
63+ : Result | Promise < Result >
7464 ) : void ;
7565 override setRequestHandler ( arg1 : string | ZodRequestSchema , arg2 : unknown , arg3 ?: unknown ) : void {
7666 if ( typeof arg1 === 'string' ) {
@@ -82,7 +72,10 @@ function withV1SchemaOverloads<
8272
8373 /** v1 compat: accepts a Zod notification schema with a `method` literal as the first arg. */
8474 override setNotificationHandler < S extends ZodNotificationSchema > ( schema : S , handler : LegacyNotificationHandler < S > ) : void ;
85- override setNotificationHandler < M extends NotificationMethod > ( method : M , handler : ( notification : unknown ) => void | Promise < void > ) : void ;
75+ override setNotificationHandler < M extends NotificationMethod > (
76+ method : M ,
77+ handler : ( notification : unknown ) => void | Promise < void >
78+ ) : void ;
8679 override setNotificationHandler < P extends StandardSchemaV1 > (
8780 method : string ,
8881 schemas : { params : P } ,
0 commit comments