Package org.springframework.ai.mcp.modern.client
@NullMarked
package org.springframework.ai.mcp.modern.client
Client-side support for the MCP 2026-07-28 ("modern") protocol revision, built on the
MCP Java SDK's
io.modelcontextprotocol.modern.client package.
SyncModernMcpToolCallbackProvider
exposes the tools of modern MCP servers as Spring AI
ToolCallbacks. Each server is described by a
SyncModernMcpConnection, which decides
which client serves a request: one client shared by all requests, a new client for each
request, or the client that a scope of the application selects.
AsyncModernMcpToolCallbackProvider and
AsyncModernMcpConnection are their
counterparts on the asynchronous client of the SDK. The tool filter, the tool name
generator and the connection info are shared by both.
-
ClassDescriptionHears about the changes that modern MCP servers report on their listen streams, with the asynchronous client type.Keeps a listen stream open to each of its modern MCP connections and tells its
listenerswhat the servers report.Builder forAsyncModernMcpChangeSubscriber.Decides whichMcpAsyncClientof a connection serves a request, for an application that wants neither a new client for each request nor one client for all of them.A connection to one modern MCP server, and the rule that decides whichMcpAsyncClientserves a request.Adapts a tool of a modern MCP server to Spring AI'sToolCallback.Builder forAsyncModernMcpToolCallback.Exposes the tools of modern MCP servers as Spring AIToolCallbacks.Builder forAsyncModernMcpToolCallbackProvider.Customizes a single call of a modern MCP tool, with theToolContextof that call at hand.Supplies the caller of the current request to the asynchronous modern connections.Describes a connection to a modern MCP server, forMcpModernToolFilterandMcpModernToolNamePrefixGenerator.Decides which tools of a modern MCP serverSyncModernMcpToolCallbackProviderandAsyncModernMcpToolCallbackProviderexpose.Generates the name under which a tool of a modern MCP server is presented to the model.Hears about the changes that modern MCP servers report on their listen streams.Keeps a listen stream open to each of its modern MCP connections and tells itslistenerswhat the servers report.Builder forSyncModernMcpChangeSubscriber.Decides whichMcpSyncClientof a connection serves a request, for an application that wants neither a new client for each request nor one client for all of them.A connection to one modern MCP server, and the rule that decides whichMcpSyncClientserves a request.Adapts a tool of a modern MCP server to Spring AI'sToolCallback.Builder forSyncModernMcpToolCallback.Exposes the tools of modern MCP servers as Spring AIToolCallbacks.Builder forSyncModernMcpToolCallbackProvider.Customizes a single call of a modern MCP tool, with theToolContextof that call at hand.