Migrate MCP server registrations to specifications

Proprietary

MCP Java SDK 0.8 replaced McpServerFeatures.SyncToolRegistration and the other tool, resource and prompt registrations with specifications, whose handlers also take the McpSyncServerExchange or McpAsyncServerExchange of the request, and Spring AI 1.0 uses an SDK that no longer has the registrations. This renames the registrations to their specifications, and adds an exchange parameter in front of the parameter of a handler lambda. Handlers that are not lambdas are left for review.

io.moderne.java.spring.ai1.MigrateMcpServerRegistrations
mod run . --recipe=io.moderne.java.spring.ai1.MigrateMcpServerRegistrations

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change type McpServerFeatures$SyncToolRegistration to McpServerFeatures$SyncToolSpecification
  2. Change type McpServerFeatures$SyncResourceRegistration to McpServerFeatures$SyncResourceSpecification
  3. Change type McpServerFeatures$SyncPromptRegistration to McpServerFeatures$SyncPromptSpecification
  4. Change type McpServerFeatures$AsyncToolRegistration to McpServerFeatures$AsyncToolSpecification
  5. Change type McpServerFeatures$AsyncResourceRegistration to McpServerFeatures$AsyncResourceSpecification
  6. Change type McpServerFeatures$AsyncPromptRegistration to McpServerFeatures$AsyncPromptSpecification