Package org.springframework.ai.mcp.modern
io.modelcontextprotocol.modern server API of the MCP Java SDK.
The modern SDK serves each primitive from a repository that lists definitions and finds
a definition with its handler (McpSyncTool, McpSyncPrompt,
McpSyncResource, or their McpAsync* twins). The
InMemorySync*Repository and InMemoryAsync*Repository classes are
map-backed repositories with runtime add and remove, change broadcasts and key-cursor
paging. SyncResourceRegistration and
SyncResourceTemplateRegistration pair a
resource or template definition with its handler, which the SDK's
McpSyncResource does not carry, and the Async*Registration records are
their asynchronous twins. Completions travel with their prompt or template, through the
SDK's withCompletionHandler.
McpModernAsyncUtils runs blocking code inside
asynchronous handlers. McpSchemaConverter
converts between the legacy and modern schema types, which lets handlers written
against the legacy types be exposed on a modern server, and
McpTransportContexts reads the request
headers that the Spring transports put into the transport context.
-
ClassDescriptionThe asynchronous twin of
SyncResourceRegistration: a listed resource together with theMcpAsyncResourcethat reads it.The asynchronous twin ofSyncResourceTemplateRegistration: a resource template together with theMcpAsyncResourcethat reads every URI matching it.The asynchronous twin ofInMemorySyncPromptRepository: aMcpAsyncPromptRepositorythat keepsMcpAsyncPrompts in a sorted, concurrent map.Builder forInMemoryAsyncPromptRepository.The asynchronous twin ofInMemorySyncResourceRepository: aMcpAsyncResourceRepositorythat keepsAsyncResourceRegistrations andAsyncResourceTemplateRegistrations in sorted, concurrent maps.Builder forInMemoryAsyncResourceRepository.The asynchronous twin ofInMemorySyncToolRepository: aMcpAsyncToolRepositorythat keepsMcpAsyncTools in a sorted, concurrent map.Builder forInMemoryAsyncToolRepository.AMcpSyncPromptRepositorythat keepsMcpSyncPrompts in a sorted, concurrent map.Builder forInMemorySyncPromptRepository.AMcpSyncResourceRepositorythat keepsSyncResourceRegistrations andSyncResourceTemplateRegistrations in sorted, concurrent maps.Builder forInMemorySyncResourceRepository.AMcpSyncToolRepositorythat keepsMcpSyncTools in a sorted, concurrent map.Builder forInMemorySyncToolRepository.Runs blocking code inside the asynchronous handlers of a 2026-07-28 ("modern") MCP server.Exposes Spring AIToolCallbacks as tools of a 2026-07-28 MCP server.Converts between the legacy (io.modelcontextprotocol.spec.McpSchema) and the modern (io.modelcontextprotocol.modern.McpSchema) schema types.The transport context convention of the modern Spring AI transports, and accessors for it.A listed resource together with theMcpSyncResourcethat reads it.A resource template together with theMcpSyncResourcethat reads every URI matching it.