Skip to content

Commit 3409c1f

Browse files
committed
feat(mcp): update WebFlux and WebMvc server transport providers with URL configuration
- Update MCP SDK version to 0.9.0 - Add baseUrl and sseEndpoint properties to McpServerProperties - Update WebFlux and WebMvc server transport providers to use new URL configuration properties - Remove deprecated backward compatibility code and related tests - Remove deprecated methods from McpToolUtils - Update MCP SDK version to 0.9.0-SNAPSHOT - Add tool filtering capability to MCP Tool Callback Providers Introduces a BiPredicate-based filtering mechanism for both Sync and Async MCP Tool Callback Providers, allowing selective tool discovery based on custom criteria. This enables filtering tools by name, client, or any combination of properties. * Apply filter in getToolCallbacks() methods for both providers * Add tests for various filtering scenarios - Add utility method to retrieve MCP exchange from tool context * Add constant TOOL_CONTEXT_MCP_EXCHANGE_KEY to replace hardcoded exchange string * Implement getMcpExchange utility method to safely retrieve the MCP exchange object Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
1 parent dbc9375 commit 3409c1f

File tree

12 files changed

+258
-850
lines changed

12 files changed

+258
-850
lines changed

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpBackwardCompatibility.java

Lines changed: 0 additions & 112 deletions
This file was deleted.

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
5454
import org.springframework.boot.context.properties.EnableConfigurationProperties;
5555
import org.springframework.context.annotation.Bean;
56-
import org.springframework.context.annotation.Import;
5756
import org.springframework.core.log.LogAccessor;
5857
import org.springframework.util.CollectionUtils;
5958
import org.springframework.util.MimeType;
@@ -110,7 +109,6 @@
110109
@AutoConfiguration(after = { McpWebMvcServerAutoConfiguration.class, McpWebFluxServerAutoConfiguration.class })
111110
@ConditionalOnClass({ McpSchema.class, McpSyncServer.class })
112111
@EnableConfigurationProperties(McpServerProperties.class)
113-
@Import(McpBackwardCompatibility.class)
114112
@ConditionalOnProperty(prefix = McpServerProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
115113
matchIfMissing = true)
116114
public class McpServerAutoConfiguration {

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerProperties.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ public class McpServerProperties {
9898
*/
9999
private boolean promptChangeNotification = true;
100100

101+
/**
102+
*/
103+
private String baseUrl = "";
104+
105+
/**
106+
*/
107+
private String sseEndpoint = "/sse";
108+
101109
/**
102110
* The endpoint path for Server-Sent Events (SSE) when using web transports.
103111
* <p>
@@ -196,6 +204,24 @@ public void setPromptChangeNotification(boolean promptChangeNotification) {
196204
this.promptChangeNotification = promptChangeNotification;
197205
}
198206

207+
public String getBaseUrl() {
208+
return this.baseUrl;
209+
}
210+
211+
public void setBaseUrl(String baseUrl) {
212+
Assert.notNull(baseUrl, "Base URL must not be null");
213+
this.baseUrl = baseUrl;
214+
}
215+
216+
public String getSseEndpoint() {
217+
return this.sseEndpoint;
218+
}
219+
220+
public void setSseEndpoint(String sseEndpoint) {
221+
Assert.hasText(sseEndpoint, "SSE endpoint must not be empty");
222+
this.sseEndpoint = sseEndpoint;
223+
}
224+
199225
public String getSseMessageEndpoint() {
200226
return this.sseMessageEndpoint;
201227
}

0 commit comments

Comments
 (0)