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). The InMemorySync*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;
SyncCompletionRegistration does the same for
a completion reference. 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.
-
ClassDescriptionAn in-memory
McpSyncCompletionRepositorythat dispatchescompletion/completeto theSyncCompletionRegistrationregistered for the request's prompt or resource reference.Builds aInMemorySyncCompletionRepository.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.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 completion provider exposed on a 2026-07-28 server: the prompt or resource reference it completes and the handler that servescompletion/complete.Serves acompletion/completerequest.A listed resource together with theMcpSyncResourcethat reads it.A resource template together with theMcpSyncResourcethat reads every URI matching it.