Server
An MCP server is responsible for storing features and handling new connections.
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.
In case the server supports feature list notification or resource substitution, the server will automatically send notifications for all connected clients. Currently, after subscription to a resource, the server will NOT send the subscription confirmation as this response schema is not defined in the protocol.
Parameters
Information about this server implementation (name, version).
Configuration options for the server.
Optional provider for instructions from the server to the client about how to use this server. The provider is called each time a new session is started to support dynamic instructions.
A block to configure the mcp server.
Constructors
Alternative constructor that provides the instructions directly as a string.
Properties
Provides a snapshot of all prompts currently registered in the server
Provides a snapshot of all resources currently registered in the server
Provides a snapshot of all sessions currently registered in the server
Provides a snapshot of all tools currently registered in the server
Functions
Registers a single prompt. The client can then retrieve the prompt.
Registers a single prompt by constructing a Prompt from given parameters.
Registers multiple prompts at once.
Registers a single resource. The client can then read the resource content.
Registers multiple resources at once.
Registers a single tool. The client can then call this tool.
Registers multiple tools at once.
Starts a new server session with the given transport and initializes internal request handlers based on the server's capabilities.
Triggers ServerSession.createElicitation request for session by provided sessionId.
Triggers ServerSession.createMessage request for session by provided sessionId.
Starts a new server session with the given transport and initializes internal request handlers based on the server's capabilities.
Triggers ServerSession.listRoots request for session by provided sessionId.
Registers a callback to be invoked when the server has completed initialization.
Triggers ServerSession.ping request for session by provided sessionId.
Removes a single prompt by name.
Removes multiple prompts at once.
Removes a single resource by URI.
Removes multiple resources at once.
Removes a single tool by name.
Removes multiple tools at once.
Triggers ServerSession.sendLoggingMessage for session by provided sessionId.
Triggers ServerSession.sendPromptListChanged for session by provided sessionId.
Triggers ServerSession.sendResourceListChanged for session by provided sessionId.
Triggers ServerSession.sendResourceUpdated for session by provided sessionId.
Triggers ServerSession.sendToolListChanged for session by provided sessionId.