4444import io .modelcontextprotocol .spec .McpStreamableServerTransportProvider ;
4545import reactor .core .publisher .Mono ;
4646
47- import org .springframework .ai .mcp .server .common .autoconfigure .properties .McpServerChangeNotificationProperties ;
4847import org .springframework .ai .mcp .server .common .autoconfigure .properties .McpServerProperties ;
4948import org .springframework .beans .factory .ObjectProvider ;
5049import org .springframework .boot .autoconfigure .AutoConfiguration ;
7877 "org.springframework.ai.mcp.server.autoconfigure.McpServerStreamableHttpWebMvcAutoConfiguration" ,
7978 "org.springframework.ai.mcp.server.autoconfigure.McpServerStreamableHttpWebFluxAutoConfiguration" })
8079@ ConditionalOnClass ({ McpSchema .class })
81- @ EnableConfigurationProperties ({ McpServerProperties .class , McpServerChangeNotificationProperties . class })
80+ @ EnableConfigurationProperties ({ McpServerProperties .class })
8281@ ConditionalOnProperty (prefix = McpServerProperties .CONFIG_PREFIX , name = "enabled" , havingValue = "true" ,
8382 matchIfMissing = true )
8483@ Conditional (McpServerAutoConfiguration .NonStatlessServerCondition .class )
@@ -103,7 +102,6 @@ public McpSchema.ServerCapabilities.Builder capabilitiesBuilder() {
103102 matchIfMissing = true )
104103 public McpSyncServer mcpSyncServer (McpServerTransportProviderBase transportProvider ,
105104 McpSchema .ServerCapabilities .Builder capabilitiesBuilder , McpServerProperties serverProperties ,
106- McpServerChangeNotificationProperties changeNotificationProperties ,
107105 ObjectProvider <List <SyncToolSpecification >> tools ,
108106 ObjectProvider <List <SyncResourceSpecification >> resources ,
109107 ObjectProvider <List <SyncPromptSpecification >> prompts ,
@@ -127,8 +125,8 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
127125 // Tools
128126 if (serverProperties .getCapabilities ().isTool ()) {
129127 logger .info ("Enable tools capabilities, notification: "
130- + changeNotificationProperties .isToolChangeNotification ());
131- capabilitiesBuilder .tools (changeNotificationProperties .isToolChangeNotification ());
128+ + serverProperties . getToolChangeNotification () .isToolChangeNotification ());
129+ capabilitiesBuilder .tools (serverProperties . getToolChangeNotification () .isToolChangeNotification ());
132130
133131 List <SyncToolSpecification > toolSpecifications = new ArrayList <>(
134132 tools .stream ().flatMap (List ::stream ).toList ());
@@ -142,8 +140,9 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
142140 // Resources
143141 if (serverProperties .getCapabilities ().isResource ()) {
144142 logger .info ("Enable resources capabilities, notification: "
145- + changeNotificationProperties .isResourceChangeNotification ());
146- capabilitiesBuilder .resources (false , changeNotificationProperties .isResourceChangeNotification ());
143+ + serverProperties .getToolChangeNotification ().isResourceChangeNotification ());
144+ capabilitiesBuilder .resources (false ,
145+ serverProperties .getToolChangeNotification ().isResourceChangeNotification ());
147146
148147 List <SyncResourceSpecification > resourceSpecifications = resources .stream ().flatMap (List ::stream ).toList ();
149148 if (!CollectionUtils .isEmpty (resourceSpecifications )) {
@@ -155,8 +154,8 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
155154 // Prompts
156155 if (serverProperties .getCapabilities ().isPrompt ()) {
157156 logger .info ("Enable prompts capabilities, notification: "
158- + changeNotificationProperties .isPromptChangeNotification ());
159- capabilitiesBuilder .prompts (changeNotificationProperties .isPromptChangeNotification ());
157+ + serverProperties . getToolChangeNotification () .isPromptChangeNotification ());
158+ capabilitiesBuilder .prompts (serverProperties . getToolChangeNotification () .isPromptChangeNotification ());
160159
161160 List <SyncPromptSpecification > promptSpecifications = prompts .stream ().flatMap (List ::stream ).toList ();
162161 if (!CollectionUtils .isEmpty (promptSpecifications )) {
@@ -202,7 +201,6 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
202201 @ ConditionalOnProperty (prefix = McpServerProperties .CONFIG_PREFIX , name = "type" , havingValue = "ASYNC" )
203202 public McpAsyncServer mcpAsyncServer (McpServerTransportProviderBase transportProvider ,
204203 McpSchema .ServerCapabilities .Builder capabilitiesBuilder , McpServerProperties serverProperties ,
205- McpServerChangeNotificationProperties changeNotificationProperties ,
206204 ObjectProvider <List <AsyncToolSpecification >> tools ,
207205 ObjectProvider <List <AsyncResourceSpecification >> resources ,
208206 ObjectProvider <List <AsyncPromptSpecification >> prompts ,
@@ -228,8 +226,8 @@ public McpAsyncServer mcpAsyncServer(McpServerTransportProviderBase transportPro
228226 tools .stream ().flatMap (List ::stream ).toList ());
229227
230228 logger .info ("Enable tools capabilities, notification: "
231- + changeNotificationProperties .isToolChangeNotification ());
232- capabilitiesBuilder .tools (changeNotificationProperties .isToolChangeNotification ());
229+ + serverProperties . getToolChangeNotification () .isToolChangeNotification ());
230+ capabilitiesBuilder .tools (serverProperties . getToolChangeNotification () .isToolChangeNotification ());
233231
234232 if (!CollectionUtils .isEmpty (toolSpecifications )) {
235233 serverBuilder .tools (toolSpecifications );
@@ -240,8 +238,9 @@ public McpAsyncServer mcpAsyncServer(McpServerTransportProviderBase transportPro
240238 // Resources
241239 if (serverProperties .getCapabilities ().isResource ()) {
242240 logger .info ("Enable resources capabilities, notification: "
243- + changeNotificationProperties .isResourceChangeNotification ());
244- capabilitiesBuilder .resources (false , changeNotificationProperties .isResourceChangeNotification ());
241+ + serverProperties .getToolChangeNotification ().isResourceChangeNotification ());
242+ capabilitiesBuilder .resources (false ,
243+ serverProperties .getToolChangeNotification ().isResourceChangeNotification ());
245244
246245 List <AsyncResourceSpecification > resourceSpecifications = resources .stream ().flatMap (List ::stream ).toList ();
247246 if (!CollectionUtils .isEmpty (resourceSpecifications )) {
@@ -253,8 +252,8 @@ public McpAsyncServer mcpAsyncServer(McpServerTransportProviderBase transportPro
253252 // Prompts
254253 if (serverProperties .getCapabilities ().isPrompt ()) {
255254 logger .info ("Enable prompts capabilities, notification: "
256- + changeNotificationProperties .isPromptChangeNotification ());
257- capabilitiesBuilder .prompts (changeNotificationProperties .isPromptChangeNotification ());
255+ + serverProperties . getToolChangeNotification () .isPromptChangeNotification ());
256+ capabilitiesBuilder .prompts (serverProperties . getToolChangeNotification () .isPromptChangeNotification ());
258257 List <AsyncPromptSpecification > promptSpecifications = prompts .stream ().flatMap (List ::stream ).toList ();
259258
260259 if (!CollectionUtils .isEmpty (promptSpecifications )) {
0 commit comments