diff --git a/.github/workflows/apidocs.yaml b/.github/workflows/apidocs.yaml new file mode 100644 index 00000000..0d4880c2 --- /dev/null +++ b/.github/workflows/apidocs.yaml @@ -0,0 +1,49 @@ +name: Build and Publish API Docs to GitHub Pages + +on: + release: + types: + - published + # Allow running this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Generate Dokka Site + run: |- + ./gradlew :docs:clean :docs:dokkaGenerate + + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: build/dokka/html + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 4db43814..c0631fac 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ build/ .idea/compiler.xml .idea/libraries/ .idea +!.idea/icon.png *.iws *.iml *.ipr diff --git a/build.gradle.kts b/build.gradle.kts index d9f1b286..33cd34fd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + id("mcp.dokka") alias(libs.plugins.ktlint) alias(libs.plugins.kover) } @@ -9,6 +10,10 @@ allprojects { } dependencies { + dokka(project(":kotlin-sdk-core")) + dokka(project(":kotlin-sdk-client")) + dokka(project(":kotlin-sdk-server")) + kover(project(":kotlin-sdk-core")) kover(project(":kotlin-sdk-client")) kover(project(":kotlin-sdk-server")) @@ -20,6 +25,14 @@ subprojects { apply(plugin = "org.jetbrains.kotlinx.kover") } +dokka { + moduleName = "MCP Kotlin SDK" + + dokkaPublications.html { + includes.from("docs/moduledoc.md") + } +} + kover { reports { filters { diff --git a/buildSrc/src/main/kotlin/mcp.dokka.gradle.kts b/buildSrc/src/main/kotlin/mcp.dokka.gradle.kts index 8f912e9a..7ad49313 100644 --- a/buildSrc/src/main/kotlin/mcp.dokka.gradle.kts +++ b/buildSrc/src/main/kotlin/mcp.dokka.gradle.kts @@ -5,9 +5,14 @@ plugins { } dokka { - moduleName.set("MCP Kotlin SDK - ${project.name}") dokkaSourceSets.configureEach { + includes.from("Module.md") + + pluginsConfiguration.html { + footerMessage = "Copyright © 2024-2025 Anthropic, PBC" + } + sourceLink { localDirectory = projectDir.resolve("src") remoteUrl("https://github.com/modelcontextprotocol/kotlin-sdk/tree/main/${project.name}/src") @@ -15,9 +20,20 @@ dokka { } documentedVisibilities(VisibilityModifier.Public) - } - dokkaPublications.html { - outputDirectory = rootProject.layout.projectDirectory.dir("docs/${project.name}") + externalDocumentationLinks.register("ktor-client") { + url("https://api.ktor.io/ktor-client/") + packageListUrl("https://api.ktor.io/package-list") + } + + externalDocumentationLinks.register("kotlinx-coroutines") { + url("https://kotlinlang.org/api/kotlinx.coroutines/") + packageListUrl("https://kotlinlang.org/api/kotlinx.coroutines/package-list") + } + + externalDocumentationLinks.register("kotlinx-serialization") { + url("https://kotlinlang.org/api/kotlinx.serialization/") + packageListUrl("https://kotlinlang.org/api/kotlinx.serialization/package-list") + } } -} \ No newline at end of file +} diff --git a/docs/-m-c-p -kotlin -s-d-k/io.modelcontextprotocol.kotlin.sdk.client/-client-options/-client-options.html b/docs/-m-c-p -kotlin -s-d-k/io.modelcontextprotocol.kotlin.sdk.client/-client-options/-client-options.html deleted file mode 100644 index 47fffb70..00000000 --- a/docs/-m-c-p -kotlin -s-d-k/io.modelcontextprotocol.kotlin.sdk.client/-client-options/-client-options.html +++ /dev/null @@ -1,87 +0,0 @@ - - -
- -Options for configuring the MCP client.
Information about the client implementation (name, version).
Configuration options for this client.
A method to check if a request handler is supported by the local side, for the given method to be handled.
This should be implemented by subclasses.
Calls a tool on the server by name, passing the specified arguments.
The result of the tool call, or null
if none.
The name of the tool to call.
A map of argument names to values for the tool.
Whether to use compatibility mode for older protocol versions.
Optional request options.
If the server does not support tools.
Calls a tool on the server using a CallToolRequest object.
The result of the tool call, or null
if none.
The request object containing the tool name and arguments.
Whether to use compatibility mode for older protocol versions.
Optional request options.
If the server does not support tools.
Sends a completion request to the server, typically to generate or complete some content.
The completion result returned by the server, or null
if none.
The completion request parameters.
Optional request options.
If the server does not support prompts or completion.
Connects the client to the given transport, performing the initialization handshake with the server.
The transport to use for communication with the server.
If the server's protocol version is not supported.
Retrieves a prompt by name from the server.
The requested prompt details, or null
if not found.
The prompt request containing the prompt name.
Optional request options.
If the server does not support prompts.
Retrieves the server's reported capabilities after the initialization process completes.
The server's capabilities, or null
if initialization is not yet complete.
Retrieves the server's reported version information after initialization.
Information about the server's implementation, or null
if initialization is not yet complete.
An MCP client on top of a pluggable transport.
The client automatically performs the initialization handshake with the server when connect is called. After initialization, getServerCapabilities and getServerVersion provide details about the connected server.
You can extend this class with custom request/notification/result types if needed.
Information about the client implementation (name, version).
Configuration options for this client.
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 method to check if a request handler is supported by the local side, for the given method to be handled.
Calls a tool on the server using a CallToolRequest object.
Calls a tool on the server by name, passing the specified arguments.
Sends a completion request to the server, typically to generate or complete some content.
Retrieves a prompt by name from the server.
Retrieves the server's reported capabilities after the initialization process completes.
Retrieves the server's reported version information after initialization.
Lists all available prompts from the server.
Lists all available resources from the server.
Lists resource templates available on the server.
Lists all available tools on the server.
Emits a notification, which is a one-way message that does not expect a response.
Sends a ping request to the server to check connectivity.
Reads a resource from the server by its URI.
Removes the notification handler for the given method.
Removes the request handler for the given method.
Sends a request and wait for a response.
Notifies the server that the list of roots has changed. Typically used if the client is managing some form of hierarchical structure.
Sets the logging level on the server.
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.
Subscribes to resource changes on the server.
Unsubscribes from resource changes on the server.
Lists all available prompts from the server.
The list of available prompts, or null
if none.
A request object for listing prompts (usually empty).
Optional request options.
If the server does not support prompts.
Lists resource templates available on the server.
The list of resource templates, or null
if none.
The request object for listing resource templates.
Optional request options.
If the server does not support resources.
Lists all available resources from the server.
The list of resources, or null
if none.
A request object for listing resources (usually empty).
Optional request options.
If the server does not support resources.
Lists all available tools on the server.
The list of available tools, or null
if none.
A request object for listing tools (usually empty).
Optional request options.
If the server does not support tools.
Sends a ping request to the server to check connectivity.
Optional request options.
If the server does not support the ping method (unlikely).
Reads a resource from the server by its URI.
The resource content, or null
if the resource is not found.
The request object containing the resource URI.
Optional request options.
If the server does not support resources.
Notifies the server that the list of roots has changed. Typically used if the client is managing some form of hierarchical structure.
If the client or server does not support roots.
Sets the logging level on the server.
The desired logging level.
Optional request options.
If the server does not support logging.
Subscribes to resource changes on the server.
The subscription request containing resource details.
Optional request options.
If the server does not support resource subscriptions.
Unsubscribes from resource changes on the server.
The unsubscribe request containing resource details.
Optional request options.
If the server does not support resource subscriptions.
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.
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
The input stream where messages are received.
The output stream where messages are sent.
A transport implementation for JSON-RPC communication that leverages standard input and output streams.
This class reads from an input stream to process incoming JSON-RPC messages and writes JSON-RPC messages to an output stream.
The input stream where messages are received.
The output stream where messages are sent.
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
Client transport for WebSocket: this will connect to a server over the WebSocket protocol.
An MCP client on top of a pluggable transport.
Options for configuring the MCP client.
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.
A transport implementation for JSON-RPC communication that leverages standard input and output streams.
Client transport for WebSocket: this will connect to a server over the WebSocket protocol.
Returns a new SSE transport for the Model Context Protocol using the provided HttpClient.
Creates and connects an MCP client over WebSocket using the provided HttpClient.
Returns a new WebSocket transport for the Model Context Protocol using the provided HttpClient.
Returns a new SSE transport for the Model Context Protocol using the provided HttpClient.
A SSEClientTransport configured for MCP communication.
Optional URL of the MCP server.
Optional duration to wait before attempting to reconnect.
Optional lambda to configure the HTTP request.
Creates and connects an MCP client over SSE using the provided HttpClient.
A connected Client ready for MCP communication.
Optional URL of the MCP server.
Optional duration to wait before attempting to reconnect.
Optional lambda to configure the HTTP request.
Returns a new WebSocket transport for the Model Context Protocol using the provided HttpClient.
A WebSocketClientTransport configured for MCP communication.
Optional URL of the MCP server.
Optional lambda to configure the HTTP request.
Creates and connects an MCP client over WebSocket using the provided HttpClient.
A connected Client ready for MCP communication.
Optional URL of the MCP server.
Optional lambda to configure the HTTP request.
A wrapper class representing a registered prompt on the server.
A wrapper class representing a registered resource on the server.
A wrapper class representing a registered tool on the server.
Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different from HTTP POST.
Handles incoming POST messages.
This should be called when a POST request is made to send a message to the server.
Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by _endpoint
.
Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different from HTTP POST.
Handles incoming POST messages.
Sends a JSON-RPC message (request or response).
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Configuration options for the MCP server.
Information about this server implementation (name, version).
Configuration options for the server.
A callback invoked when the server connection closes.
Registers a single prompt. The prompt can then be retrieved by the client.
A Prompt object describing the prompt.
A suspend function that returns the prompt content when requested by the client.
If the server does not support prompts.
Registers a single prompt by constructing a Prompt from given parameters.
The name of the prompt.
An optional human-readable description of the prompt.
An optional list of PromptArgument that the prompt accepts.
A suspend function that returns the prompt content when requested.
If the server does not support prompts.
Registers multiple prompts at once.
A list of RegisteredPrompt objects representing the prompts to register.
If the server does not support prompts.
Registers a single resource. The resource content can then be read by the client.
The URI of the resource.
A human-readable name for the resource.
A description of the resource's content.
The MIME type of the resource content.
A suspend function that returns the resource content when read by the client.
If the server does not support resources.
Registers multiple resources at once.
A list of RegisteredResource objects representing the resources to register.
If the server does not support resources.
Registers a single tool. This tool can then be called by the client.
The name of the tool.
A human-readable description of what the tool does.
The expected input schema for the tool.
A suspend function that handles executing the tool when called by the client.
If the server does not support tools.
Registers multiple tools at once.
A list of RegisteredTool objects representing the tools to register.
If the server does not support tools.
Asserts that the server can handle the specified request method.
Throws IllegalStateException if the server does not have the capabilities required to handle this request.
The request method.
The client's reported capabilities after initialization.
The client's version information after initialization.
Creates a message using the server's sampling capability.
The created message result.
The parameters for creating a message.
Optional request options.
If the server does not support sampling or if the request fails.
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.
Information about this server implementation (name, version).
Configuration options for the server.
A callback invoked when the server connection closes.
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.
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 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.
Lists the available "roots" from the client's perspective (if supported).
The list of roots.
JSON parameters for the request, usually empty.
Optional request options.
If the server or client does not support roots.
A callback invoked when the server connection closes.
A callback invoked when the server has completed the initialization sequence. After initialization, the server is ready to handle requests.
Called when the server connection is closing. Invokes onCloseCallback if set.
Sends a ping request to the client to check connectivity.
The result of the ping request.
If for some reason the method is not supported or the connection is closed.
Sends a logging message notification to the client.
The logging message notification parameters.
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.
Details of the updated resource.
Sends a notification to the client indicating that the list of tools has changed.
A server transport that communicates with a client via standard I/O.
Reads from System.in and writes to System.out.
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
Server-side implementation of the MCP (Model Context Protocol) transport over WebSocket.
A wrapper class representing a registered prompt on the server.
A wrapper class representing a registered resource on the server.
A wrapper class representing a registered tool on the server.
An MCP server on top of a pluggable transport.
Configuration options for the MCP server.
Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
A server transport that communicates with a client via standard I/O.
Server-side implementation of the MCP (Model Context Protocol) transport over WebSocket.
Registers a WebSocket route that establishes an MCP (Model Context Protocol) server session.
Registers a WebSocket route at the specified path that establishes an MCP server session.
Registers a WebSocket route that creates an MCP server transport layer.
Registers a WebSocket route at the specified path that creates an MCP server transport layer.
Registers a WebSocket route that creates an MCP server transport layer.
A suspend function that defines the behavior of the transport layer.
Registers a WebSocket route at the specified path that creates an MCP server transport layer.
The URL path at which to register the WebSocket route.
A suspend function that defines the behavior of the transport layer.
Registers a WebSocket route that establishes an MCP (Model Context Protocol) server session.
Optional server configuration settings for the MCP server.
A suspend function that defines the server's behavior.
Registers a WebSocket route at the specified path that establishes an MCP server session.
The URL path at which to register the WebSocket route.
Optional server configuration settings for the MCP server.
A suspend function that defines the server's behavior.
The default request timeout.
Callback for progress notifications.
Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.
Note that this DOES NOT affect checking of local side capabilities, as it is considered a logic error to mis-specify those.
Currently this defaults to false, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to true.
Additional initialization options.
A method to check if a request handler is supported by the local side, for the given method to be handled.
This should be implemented by subclasses.
Attaches to the given transport, starts it, and starts listening for messages.
The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
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.
Implements MCP protocol framing on top of a pluggable transport, including features like request/response linking, notifications, and progress.
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 method to check if a request handler is supported by the local side, for the given method to be handled.
Emits a notification, which is a one-way message that does not expect a response.
Removes the notification handler for the given method.
Removes the request handler for the given method.
Sends a request and wait for a response.
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.
Emits a notification, which is a one-way message that does not expect a response.
Removes the notification handler for the given method.
Removes the request handler for the given method.
Sends a request and wait for a response.
Do not use this method to emit notifications! Use notification() instead.
Registers a handler to invoke when this protocol object receives a notification with the given method.
Note that this will replace any previous notification handler for the same method.
Registers a handler to invoke when this protocol object receives a request with the given method.
Note that this will replace any previous request handler for the same method.
Options that can be given per request.
If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
Describes the minimal contract for a MCP transport that a client or server can communicate over.
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
Abstract class representing a WebSocket transport for the Model Context Protocol (MCP). Handles communication over a WebSocket session.
Callback for when a message (request or response) is received over the connection.
Sends a JSON-RPC message (request or response).
Starts processing messages on the transport, including any connection steps that might need to be taken.
This method should only be called after callbacks are installed, or else messages may be lost.
NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start().
Callback for progress notifications.
Implements MCP protocol framing on top of a pluggable transport, including features like request/response linking, notifications, and progress.
Additional initialization options.
Buffers a continuous stdio stream into discrete JSON-RPC messages.
Extra data given to request handlers.
Options that can be given per request.
Abstract class representing a WebSocket transport for the Model Context Protocol (MCP). Handles communication over a WebSocket session.
Represents the binary contents of a resource encoded as a base64 string.
Used by the client to invoke a tool provided by the server.
The server's response to a tool call.
This notification can be sent by either side to indicate that it is cancelling a previously issued request.
The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
This notification indicates that the result will be unused, so any associated processing SHOULD cease.
A client MUST NOT attempt to cancel its initialize
request.
Whether the client supports issuing notifications for changes to the root list.
Experimental, non-standard capabilities that the client supports.
Capabilities a client may support. Known capabilities are defined here, in this, but this is not a closed set: any client can define its own, additional capabilities.
Present if the client supports listing roots.
Represents a notification sent by the client.
Represents a request sent by the client.
Represents a result returned to the client.
CallToolResult extended with backwards compatibility to protocol version 2024-10-07.
The argument's information
A request from the client to the server to ask for completion options.
The server's response to a completion/complete request
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
if this enum type has no constant with the specified name
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.
A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling to allow them to inspect the request (human in the loop) and decide whether to approve it.
A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
The server's preferences for which model to select.
An optional system prompt the server wants to use it for sampling. The client MAY modify or omit this prompt.
The server's preferences for which model to select.
An optional system prompt the server wants to use it for sampling. The client MAY modify or omit this prompt.
The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
The reason why sampling stopped.
The JSON object holding metadata. Defaults to an empty JSON object.
An implementation of WithMeta containing custom metadata.
The JSON object holding metadata. Defaults to an empty JSON object.
The contents of a resource, embedded into a prompt or tool call result.
Additional metadata for the response. Defaults to an empty JSON object.
An empty result for a request, containing optional metadata.
Additional metadata for the response. Defaults to an empty JSON object.
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
if this enum type has no constant with the specified name
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.
Used by the client to get a prompt provided by the server.
An optional description for the prompt.
The server's response to a prompts/get request from the client.
An image provided to or from an LLM.
This request is sent from the client to the server when it first connects, asking it to begin initialization.
After receiving an initialized request from the client, the server sends this response.
The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
A response to a request that indicates an error occurred.
Represents a JSON-RPC message in the protocol.
A notification which does not expect a response.
A request that expects a response.
A successful (non-error) response to a request.
Sent from the client to request a list of prompts and prompt templates the server has.
The server's response to a prompts/list request from the client.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Sent from the client to request a list of resource templates the server has.
The server's response to a resources/templates/list request from the client.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Sent from the client to request a list of resources the server has.
The server's response to a resources/list request from the client.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Sent from the server to request a list of root URIs from the client.
The client's response to a roots/list request from the server.
Sent from the client to request a list of tools the server has.
The server's response to a tools/list request from the client.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
The severity of a log message.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
if this enum type has no constant with the specified name
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.
A request from the client to the server to enable or adjust logging.
The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.
Notification of a log message passed from server to client. If no logging level request has been sent from the client, the server MAY decide which messages to send automatically.
A request from the client to the server to enable or adjust logging.
The severity of this log message.
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
Enum of predefined methods supported by the protocol.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
Returns an array containing the constants of this enum type, in the order they're declared.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
if this enum type has no constant with the specified name
Returns an array containing the constants of this enum type, in the order they're declared.
This method may be used to iterate over the constants.
How much to prioritize cost when selecting a model.
How much to prioritize cost when selecting a model.
How much to prioritize intelligence and capabilities when selecting a model.
How much to prioritize sampling speed (latency) when selecting a model.
How much to prioritize intelligence and capabilities when selecting a model.
How much to prioritize sampling speed (latency) when selecting a model.
Represents a notification in the protocol.
Represents a paginated result of a request.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
An out-of-band notification used to inform the receiver of a progress update for a long-running request.
The progress token, which was given in the initial request, used to associate this notification with the request that is proceeding.
A progress token, used to associate progress notifications with the original request. Stores message ID.
A human-readable description of the argument.
Describes an argument that a prompt can accept.
An optional notification from the server to the client, informing it that the list of prompts it offers has changed. Servers may issue this without any previous subscription from the client.
Represents prompt message content that is either text or an image.
Represents the content of a prompt message.
A list of arguments to use for templating the prompt.
An optional description of what this prompt provides
Sent from the client to the server to read a specific resource URI.
The server's response to a resources/read request from the client.
Represents the result of a request, including additional metadata.
Represents a request in the protocol.
The contents of a specific resource or sub-resource.
An optional notification from the server to the client, informing it that the list of resources it can read from has changed. Servers may issue this without any previous subscription from the client.
A description of what this template is for.
Clients can use this to improve the LLM's understanding of available resources. It can be thought of as a "hint" to the model.
A URI template (according to RFC 6570) that can be used to construct resource URIs.
A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
A description of what this resource represents.
Clients can use this to improve the LLM's understanding of available resources. It can be thought of as a "hint" to the model.
Returns a representation of an immutable list of all enum entries, in the order they're declared.
This method may be used to iterate over the enum entries.
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
if this enum type has no constant with the specified name
Describes a message issued to or received from an LLM API.
Whether this server supports issuing notifications for changes to the prompt list.
Whether this server supports issuing notifications for changes to the resource list.
Whether this server supports issuing notifications for changes to the tool list.
Represents the capabilities that a server can support.
Experimental, non-standard capabilities that the server supports.
Capabilities related to prompt templates offered by the server.
Capabilities related to resources available on the server.
Capabilities related to tools that can be called on the server.
Represents a notification sent by the server.
Represents a request sent by the server.
Represents a result returned by the server.
Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
Text provided to or from an LLM.
Represents the text contents of a resource.
An optional notification from the server to the client, informing it that the list of tools it offers has changed. Servers may issue this without any previous subscription from the client.
A human-readable description of the tool.
Definition for a tool the client can call.
A JSON object defining the expected parameters for the tool.
Represents a request or notification for an unknown method.
The method that is unknown.
Represents resource contents with unknown or unspecified data.
Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
Represents an entity that includes additional metadata in its responses.
Represents the binary contents of a resource encoded as a base64 string.
Used by the client to invoke a tool provided by the server.
The server's response to a tool call.
The server's response to a tool call.
This notification can be sent by either side to indicate that it is cancelling a previously issued request.
Capabilities a client may support. Known capabilities are defined here, in this, but this is not a closed set: any client can define its own, additional capabilities.
Represents a notification sent by the client.
Represents a request sent by the client.
Represents a result returned to the client.
CallToolResult extended with backwards compatibility to protocol version 2024-10-07.
A request from the client to the server to ask for completion options.
The server's response to a completion/complete request
A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling to allow them to inspect the request (human in the loop) and decide whether to approve it.
The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
An implementation of WithMeta containing custom metadata.
A custom request with a specified method.
The contents of a resource, embedded into a prompt or tool call result.
An empty result for a request, containing optional metadata.
Used by the client to get a prompt provided by the server.
The server's response to a prompts/get request from the client.
An image provided to or from an LLM.
Describes the name and version of an MCP implementation.
This notification is sent from the client to the server after initialization has finished.
This request is sent from the client to the server when it first connects, asking it to begin initialization.
After receiving an initialized request from the client, the server sends this response.
A response to a request that indicates an error occurred.
Represents a JSON-RPC message in the protocol.
A notification which does not expect a response.
A request that expects a response.
A successful (non-error) response to a request.
Sent from the client to request a list of prompts and prompt templates the server has.
The server's response to a prompts/list request from the client.
Sent from the client to request a list of resources the server has.
The server's response to a resources/list request from the client.
Sent from the client to request a list of resource templates the server has.
The server's response to a resources/templates/list request from the client.
Sent from the server to request a list of root URIs from the client.
The client's response to a roots/list request from the server.
Sent from the client to request a list of tools the server has.
The server's response to a tools/list request from the client.
The severity of a log message.
Notification of a log message passed from server to client. If no logging level request has been sent from the client, the server MAY decide which messages to send automatically.
Represents a notification in the protocol.
Represents a request supporting pagination.
Represents a paginated result of a request.
A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
Represents a progress notification.
Represents the base interface for progress tracking.
An out-of-band notification used to inform the receiver of a progress update for a long-running request.
A progress token, used to associate progress notifications with the original request. Stores message ID.
Describes an argument that a prompt can accept.
An optional notification from the server to the client, informing it that the list of prompts it offers has changed. Servers may issue this without any previous subscription from the client.
Describes a message returned as part of a prompt.
Represents the content of a prompt message.
Represents prompt message content that is either text or an image.
Identifies a prompt.
Sent from the client to the server to read a specific resource URI.
The server's response to a resources/read request from the client.
Represents the result of a request, including additional metadata.
The contents of a specific resource or sub-resource.
An optional notification from the server to the client, informing it that the list of resources it can read from has changed. Servers may issue this without any previous subscription from the client.
A reference to a resource or resource template definition.
A template description for resources available on the server.
A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
A notification from the client to the server, informing it that the list of roots has changed.
Describes a message issued to or received from an LLM API.
Represents the capabilities that a server can support.
Represents a notification sent by the server.
Represents a request sent by the server.
Represents a result returned by the server.
Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
Text provided to or from an LLM.
Represents the text contents of a resource.
Definition for a tool the client can call.
An optional notification from the server to the client, informing it that the list of tools it offers has changed. Servers may issue this without any previous subscription from the client.
An image provided to or from an LLM.
Represents a request or notification for an unknown method.
Identifies a prompt.
Represents resource contents with unknown or unspecified data.
Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
{"use strict";var r=t(4376),o=t(3517),i=t(34),a=t(8227)("species"),l=Array;e.exports=function(e){var n;return r(e)&&(n=e.constructor,(o(n)&&(n===l||r(n.prototype))||i(n)&&null===(n=n[a]))&&(n=void 0)),void 0===n?l:n}},1469:(e,n,t)=>{"use strict";var r=t(7433);e.exports=function(e,n){return new(r(e))(0===n?0:n)}},6319:(e,n,t)=>{"use strict";var r=t(8551),o=t(9539);e.exports=function(e,n,t,i){try{return i?n(r(t)[0],t[1]):n(t)}catch(n){o(e,"throw",n)}}},4428:(e,n,t)=>{"use strict";var r=t(8227)("iterator"),o=!1;try{var i=0,a={next:function(){return{done:!!i++}},return:function(){o=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,n){try{if(!n&&!o)return!1}catch(e){return!1}var t=!1;try{var i={};i[r]=function(){return{next:function(){return{done:t=!0}}}},e(i)}catch(e){}return t}},4576:(e,n,t)=>{"use strict";var r=t(9504),o=r({}.toString),i=r("".slice);e.exports=function(e){return i(o(e),8,-1)}},6955:(e,n,t)=>{"use strict";var r=t(2140),o=t(4901),i=t(4576),a=t(8227)("toStringTag"),l=Object,c="Arguments"===i(function(){return arguments}());e.exports=r?i:function(e){var n,t,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(t=function(e,n){try{return e[n]}catch(e){}}(n=l(e),a))?t:c?i(n):"Object"===(r=i(n))&&o(n.callee)?"Arguments":r}},6938:(e,n,t)=>{"use strict";var r=t(2360),o=t(2106),i=t(6279),a=t(6080),l=t(679),c=t(4117),u=t(2652),s=t(1088),f=t(2529),p=t(7633),d=t(3724),g=t(3451).fastKey,h=t(1181),v=h.set,b=h.getterFor;e.exports={getConstructor:function(e,n,t,s){var f=e((function(e,o){l(e,p),v(e,{type:n,index:r(null),first:void 0,last:void 0,size:0}),d||(e.size=0),c(o)||u(o,e[s],{that:e,AS_ENTRIES:t})})),p=f.prototype,h=b(n),A=function(e,n,t){var r,o,i=h(e),a=m(e,n);return a?a.value=t:(i.last=a={index:o=g(n,!0),key:n,value:t,previous:r=i.last,next:void 0,removed:!1},i.first||(i.first=a),r&&(r.next=a),d?i.size++:e.size++,"F"!==o&&(i.index[o]=a)),e},m=function(e,n){var t,r=h(e),o=g(n);if("F"!==o)return r.index[o];for(t=r.first;t;t=t.next)if(t.key===n)return t};return i(p,{clear:function(){for(var e=h(this),n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),n=n.next;e.first=e.last=void 0,e.index=r(null),d?e.size=0:this.size=0},delete:function(e){var n=this,t=h(n),r=m(n,e);if(r){var o=r.next,i=r.previous;delete t.index[r.index],r.removed=!0,i&&(i.next=o),o&&(o.previous=i),t.first===r&&(t.first=o),t.last===r&&(t.last=i),d?t.size--:n.size--}return!!r},forEach:function(e){for(var n,t=h(this),r=a(e,arguments.length>1?arguments[1]:void 0);n=n?n.next:t.first;)for(r(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(e){return!!m(this,e)}}),i(p,t?{get:function(e){var n=m(this,e);return n&&n.value},set:function(e,n){return A(this,0===e?0:e,n)}}:{add:function(e){return A(this,e=0===e?0:e,e)}}),d&&o(p,"size",{configurable:!0,get:function(){return h(this).size}}),f},setStrong:function(e,n,t){var r=n+" Iterator",o=b(n),i=b(r);s(e,n,(function(e,n){v(this,{type:r,target:e,state:o(e),kind:n,last:void 0})}),(function(){for(var e=i(this),n=e.kind,t=e.last;t&&t.removed;)t=t.previous;return e.target&&(e.last=t=t?t.next:e.state.first)?f("keys"===n?t.key:"values"===n?t.value:[t.key,t.value],!1):(e.target=void 0,f(void 0,!0))}),t?"entries":"values",!t,!0),p(n)}}},4006:(e,n,t)=>{"use strict";var r=t(9504),o=t(6279),i=t(3451).getWeakData,a=t(679),l=t(8551),c=t(4117),u=t(34),s=t(2652),f=t(9213),p=t(9297),d=t(1181),g=d.set,h=d.getterFor,v=f.find,b=f.findIndex,A=r([].splice),m=0,y=function(e){return e.frozen||(e.frozen=new E)},E=function(){this.entries=[]},C=function(e,n){return v(e.entries,(function(e){return e[0]===n}))};E.prototype={get:function(e){var n=C(this,e);if(n)return n[1]},has:function(e){return!!C(this,e)},set:function(e,n){var t=C(this,e);t?t[1]=n:this.entries.push([e,n])},delete:function(e){var n=b(this.entries,(function(n){return n[0]===e}));return~n&&A(this.entries,n,1),!!~n}},e.exports={getConstructor:function(e,n,t,r){var f=e((function(e,o){a(e,d),g(e,{type:n,id:m++,frozen:void 0}),c(o)||s(o,e[r],{that:e,AS_ENTRIES:t})})),d=f.prototype,v=h(n),b=function(e,n,t){var r=v(e),o=i(l(n),!0);return!0===o?y(r).set(n,t):o[r.id]=t,e};return o(d,{delete:function(e){var n=v(this);if(!u(e))return!1;var t=i(e);return!0===t?y(n).delete(e):t&&p(t,n.id)&&delete t[n.id]},has:function(e){var n=v(this);if(!u(e))return!1;var t=i(e);return!0===t?y(n).has(e):t&&p(t,n.id)}}),o(d,t?{get:function(e){var n=v(this);if(u(e)){var t=i(e);return!0===t?y(n).get(e):t?t[n.id]:void 0}},set:function(e,n){return b(this,e,n)}}:{add:function(e){return b(this,e,!0)}}),f}}},6468:(e,n,t)=>{"use strict";var r=t(6518),o=t(4475),i=t(9504),a=t(2796),l=t(6840),c=t(3451),u=t(2652),s=t(679),f=t(4901),p=t(4117),d=t(34),g=t(9039),h=t(4428),v=t(687),b=t(3167);e.exports=function(e,n,t){var A=-1!==e.indexOf("Map"),m=-1!==e.indexOf("Weak"),y=A?"set":"add",E=o[e],C=E&&E.prototype,w=E,_={},x=function(e){var n=i(C[e]);l(C,e,"add"===e?function(e){return n(this,0===e?0:e),this}:"delete"===e?function(e){return!(m&&!d(e))&&n(this,0===e?0:e)}:"get"===e?function(e){return m&&!d(e)?void 0:n(this,0===e?0:e)}:"has"===e?function(e){return!(m&&!d(e))&&n(this,0===e?0:e)}:function(e,t){return n(this,0===e?0:e,t),this})};if(a(e,!f(E)||!(m||C.forEach&&!g((function(){(new E).entries().next()})))))w=t.getConstructor(n,e,A,y),c.enable();else if(a(e,!0)){var S=new w,k=S[y](m?{}:-0,1)!==S,O=g((function(){S.has(1)})),B=h((function(e){new E(e)})),T=!m&&g((function(){for(var e=new E,n=5;n--;)e[y](n,n);return!e.has(-0)}));B||((w=n((function(e,n){s(e,C);var t=b(new E,e,w);return p(n)||u(n,t[y],{that:t,AS_ENTRIES:A}),t}))).prototype=C,C.constructor=w),(O||T)&&(x("delete"),x("has"),A&&x("get")),(T||k)&&x(y),m&&C.clear&&delete C.clear}return _[e]=w,r({global:!0,constructor:!0,forced:w!==E},_),v(w,e),m||t.setStrong(w,e,A),w}},7740:(e,n,t)=>{"use strict";var r=t(9297),o=t(5031),i=t(7347),a=t(4913);e.exports=function(e,n,t){for(var l=o(n),c=a.f,u=i.f,s=0;s