Server
An MCP server on top of a pluggable transport.
This server automatically responds to the initialization flow as initiated by the client. You can register tools, prompts, and resources using addTool, addPrompt, and addResource. The server will then automatically handle listing and retrieval requests from the client.
Parameters
Information about this server implementation (name, version).
Configuration options for the server.
A callback invoked when the server connection closes.
Constructors
Properties
The client's reported capabilities after initialization.
The client's version information after initialization.
A handler to invoke for any notification types that do not have their own handler installed.
A handler to invoke for any request types that do not have their own handler installed.
A callback invoked when the server has completed the initialization sequence. After initialization, the server is ready to handle requests.
Functions
Registers a single prompt. The prompt can then be retrieved by the client.
Registers a single prompt by constructing a Prompt from given parameters.
Registers multiple prompts at once.
Registers a single resource. The resource content can then be read by the client.
Registers multiple resources at once.
Registers a single tool. This tool can then be called by the client.
Registers multiple tools at once.
Asserts that the client supports the capability required for the given method.
Asserts that the server can handle the specified request method.
Creates a message using the server's sampling capability.
Lists the available "roots" from the client's perspective (if supported).
Emits a notification, which is a one-way message that does not expect a response.
Called when the server connection is closing. Invokes onCloseCallback if set.
Sends a ping request to the client to check connectivity.
Removes the notification handler for the given method.
Removes the request handler for the given method.
Sends a request and wait for a response.
Sends a logging message notification to the client.
Sends a notification to the client indicating that the list of prompts has changed.
Sends a notification to the client indicating that the list of resources has changed.
Sends a resource-updated notification to the client, indicating that a specific resource has changed.
Sends a notification to the client indicating that the list of tools has changed.
Registers a handler to invoke when this protocol object receives a notification with the given method.
Registers a handler to invoke when this protocol object receives a request with the given method.