Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type SSEClientTransportOptions = {
/**
* Client transport for SSE: this will connect to a server using Server-Sent Events for receiving
* messages and make separate POST requests for sending messages.
* @deprecated SSEClientTransport is deprecated. Prefer to use StreamableHTTPClientTransport where possible instead. Note that because some servers are still using SSE, clients may need to support both transports during the migration period.
*/
export class SSEClientTransport implements Transport {
private _eventSource?: EventSource;
Expand Down
1 change: 1 addition & 0 deletions src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export type ServerOptions = ProtocolOptions & {
* version: "1.0.0"
* })
* ```
* @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases.
*/
export class Server<
RequestT extends Request = Request,
Expand Down
14 changes: 14 additions & 0 deletions src/server/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,21 +423,25 @@ export class McpServer {

/**
* Registers a resource `name` at a fixed URI, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, uri: string, readCallback: ReadResourceCallback): RegisteredResource;

/**
* Registers a resource `name` at a fixed URI with metadata, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, uri: string, metadata: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource;

/**
* Registers a resource `name` with a template pattern, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, template: ResourceTemplate, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;

/**
* Registers a resource `name` with a template pattern and metadata, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(
name: string,
Expand Down Expand Up @@ -687,11 +691,13 @@ export class McpServer {

/**
* Registers a zero-argument tool `name`, which will run the given function when the client calls it.
* @deprecated Use `registerTool` instead.
*/
tool(name: string, cb: ToolCallback): RegisteredTool;

/**
* Registers a zero-argument tool `name` (with a description) which will run the given function when the client calls it.
* @deprecated Use `registerTool` instead.
*/
tool(name: string, description: string, cb: ToolCallback): RegisteredTool;

Expand All @@ -701,6 +707,7 @@ export class McpServer {
*
* Note: We use a union type for the second parameter because TypeScript cannot reliably disambiguate
* between ToolAnnotations and ZodRawShape during overload resolution, as both are plain object types.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShape>(name: string, paramsSchemaOrAnnotations: Args | ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;

Expand All @@ -711,6 +718,7 @@ export class McpServer {
*
* Note: We use a union type for the third parameter because TypeScript cannot reliably disambiguate
* between ToolAnnotations and ZodRawShape during overload resolution, as both are plain object types.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShape>(
name: string,
Expand All @@ -721,11 +729,13 @@ export class McpServer {

/**
* Registers a tool with both parameter schema and annotations.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShape>(name: string, paramsSchema: Args, annotations: ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;

/**
* Registers a tool with description, parameter schema, and annotations.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShape>(
name: string,
Expand Down Expand Up @@ -818,21 +828,25 @@ export class McpServer {

/**
* Registers a zero-argument prompt `name`, which will run the given function when the client calls it.
* @deprecated Use `registerPrompt` instead.
*/
prompt(name: string, cb: PromptCallback): RegisteredPrompt;

/**
* Registers a zero-argument prompt `name` (with a description) which will run the given function when the client calls it.
* @deprecated Use `registerPrompt` instead.
*/
prompt(name: string, description: string, cb: PromptCallback): RegisteredPrompt;

/**
* Registers a prompt `name` accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
* @deprecated Use `registerPrompt` instead.
*/
prompt<Args extends PromptArgsRawShape>(name: string, argsSchema: Args, cb: PromptCallback<Args>): RegisteredPrompt;

/**
* Registers a prompt `name` (with a description) accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
* @deprecated Use `registerPrompt` instead.
*/
prompt<Args extends PromptArgsRawShape>(
name: string,
Expand Down
1 change: 1 addition & 0 deletions src/server/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface SSEServerTransportOptions {
* Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
*
* This transport is only available in Node.js environments.
* @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead.
*/
export class SSEServerTransport implements Transport {
private _sseResponse?: ServerResponse;
Expand Down