Skip to content

Commit 9dcb35e

Browse files
committed
feat: Conflict resolution
1 parent b693ad9 commit 9dcb35e

File tree

12 files changed

+42
-39
lines changed

12 files changed

+42
-39
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,31 +220,31 @@ public void setProtocol(ServerProtocol serverMode) {
220220
}
221221

222222
public Sse getSse() {
223-
return sse;
223+
return this.sse;
224224
}
225225

226226
public void setSse(Sse sse) {
227227
this.sse = sse;
228228
}
229229

230230
public Streamable getStreamable() {
231-
return streamable;
231+
return this.streamable;
232232
}
233233

234234
public void setStreamable(Streamable streamable) {
235235
this.streamable = streamable;
236236
}
237237

238238
public Stateless getStateless() {
239-
return stateless;
239+
return this.stateless;
240240
}
241241

242242
public void setStateless(Stateless stateless) {
243243
this.stateless = stateless;
244244
}
245245

246246
public ToolChangeNotification getToolChangeNotification() {
247-
return toolChangeNotification;
247+
return this.toolChangeNotification;
248248
}
249249

250250
public void setToolChangeNotification(ToolChangeNotification toolChangeNotification) {

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-common/src/test/java/org/springframework/ai/mcp/server/common/autoconfigure/McpServerAutoConfigurationIT.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@
1616

1717
package org.springframework.ai.mcp.server.common.autoconfigure;
1818

19+
import java.util.List;
20+
import java.util.function.BiConsumer;
21+
import java.util.function.BiFunction;
22+
1923
import com.fasterxml.jackson.core.type.TypeReference;
2024
import io.modelcontextprotocol.client.McpSyncClient;
21-
import io.modelcontextprotocol.server.*;
22-
import io.modelcontextprotocol.server.McpServerFeatures.*;
25+
import io.modelcontextprotocol.server.McpAsyncServer;
26+
import io.modelcontextprotocol.server.McpAsyncServerExchange;
27+
import io.modelcontextprotocol.server.McpServerFeatures;
28+
import io.modelcontextprotocol.server.McpSyncServer;
29+
import io.modelcontextprotocol.server.McpSyncServerExchange;
2330
import io.modelcontextprotocol.server.transport.StdioServerTransportProvider;
2431
import io.modelcontextprotocol.spec.McpSchema;
2532
import io.modelcontextprotocol.spec.McpServerTransport;
2633
import io.modelcontextprotocol.spec.McpServerTransportProvider;
2734
import org.junit.jupiter.api.Test;
2835
import org.mockito.Mockito;
36+
import reactor.core.publisher.Mono;
37+
2938
import org.springframework.ai.mcp.SyncMcpToolCallback;
3039
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
3140
import org.springframework.ai.tool.ToolCallback;
@@ -34,11 +43,6 @@
3443
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3544
import org.springframework.context.annotation.Bean;
3645
import org.springframework.context.annotation.Configuration;
37-
import reactor.core.publisher.Mono;
38-
39-
import java.util.List;
40-
import java.util.function.BiConsumer;
41-
import java.util.function.BiFunction;
4246

4347
import static org.assertj.core.api.Assertions.assertThat;
4448
import static org.mockito.Mockito.when;
@@ -206,7 +210,7 @@ void serverCapabilitiesConfiguration() {
206210
@Test
207211
void toolSpecificationConfiguration() {
208212
this.contextRunner.withUserConfiguration(TestToolConfiguration.class).run(context -> {
209-
List<SyncToolSpecification> tools = context.getBean("syncTools", List.class);
213+
List<McpServerFeatures.SyncToolSpecification> tools = context.getBean("syncTools", List.class);
210214
assertThat(tools).hasSize(1);
211215
});
212216
}
@@ -253,7 +257,7 @@ void asyncToolSpecificationConfiguration() {
253257
this.contextRunner.withPropertyValues("spring.ai.mcp.server.type=ASYNC")
254258
.withUserConfiguration(TestToolConfiguration.class)
255259
.run(context -> {
256-
List<AsyncToolSpecification> tools = context.getBean("asyncTools", List.class);
260+
List<McpServerFeatures.AsyncToolSpecification> tools = context.getBean("asyncTools", List.class);
257261
assertThat(tools).hasSize(1);
258262
});
259263
}
@@ -312,7 +316,7 @@ void toolResponseMimeTypeConfiguration() {
312316
assertThat(properties.getToolResponseMimeType()).containsEntry("test-tool", "application/json");
313317

314318
// Verify the MIME type is applied to the tool specifications
315-
List<SyncToolSpecification> tools = context.getBean("syncTools", List.class);
319+
List<McpServerFeatures.SyncToolSpecification> tools = context.getBean("syncTools", List.class);
316320
assertThat(tools).hasSize(1);
317321

318322
// The server should be properly configured with the tool
@@ -336,7 +340,8 @@ void requestTimeoutConfiguration() {
336340
@Test
337341
void completionSpecificationConfiguration() {
338342
this.contextRunner.withUserConfiguration(TestCompletionConfiguration.class).run(context -> {
339-
List<SyncCompletionSpecification> completions = context.getBean("testCompletions", List.class);
343+
List<McpServerFeatures.SyncCompletionSpecification> completions = context.getBean("testCompletions",
344+
List.class);
340345
assertThat(completions).hasSize(1);
341346
});
342347
}
@@ -346,7 +351,8 @@ void asyncCompletionSpecificationConfiguration() {
346351
this.contextRunner.withPropertyValues("spring.ai.mcp.server.type=ASYNC")
347352
.withUserConfiguration(TestAsyncCompletionConfiguration.class)
348353
.run(context -> {
349-
List<AsyncCompletionSpecification> completions = context.getBean("testAsyncCompletions", List.class);
354+
List<McpServerFeatures.AsyncCompletionSpecification> completions = context
355+
.getBean("testAsyncCompletions", List.class);
350356
assertThat(completions).hasSize(1);
351357
});
352358
}
@@ -361,7 +367,7 @@ void toolCallbackProviderConfiguration() {
361367
static class TestResourceConfiguration {
362368

363369
@Bean
364-
List<SyncResourceSpecification> testResources() {
370+
List<McpServerFeatures.SyncResourceSpecification> testResources() {
365371
return List.of();
366372
}
367373

@@ -371,7 +377,7 @@ List<SyncResourceSpecification> testResources() {
371377
static class TestPromptConfiguration {
372378

373379
@Bean
374-
List<SyncPromptSpecification> testPrompts() {
380+
List<McpServerFeatures.SyncPromptSpecification> testPrompts() {
375381
return List.of();
376382
}
377383

@@ -435,7 +441,7 @@ ToolCallbackProvider testToolCallbackProvider() {
435441
static class TestCompletionConfiguration {
436442

437443
@Bean
438-
List<SyncCompletionSpecification> testCompletions() {
444+
List<McpServerFeatures.SyncCompletionSpecification> testCompletions() {
439445

440446
BiFunction<McpSyncServerExchange, McpSchema.CompleteRequest, McpSchema.CompleteResult> completionHandler = (
441447
exchange, request) -> new McpSchema.CompleteResult(
@@ -451,7 +457,7 @@ List<SyncCompletionSpecification> testCompletions() {
451457
static class TestAsyncCompletionConfiguration {
452458

453459
@Bean
454-
List<AsyncCompletionSpecification> testAsyncCompletions() {
460+
List<McpServerFeatures.AsyncCompletionSpecification> testAsyncCompletions() {
455461
BiFunction<McpAsyncServerExchange, McpSchema.CompleteRequest, Mono<McpSchema.CompleteResult>> completionHandler = (
456462
exchange, request) -> Mono.just(new McpSchema.CompleteResult(
457463
new McpSchema.CompleteResult.CompleteCompletion(List.of(), 0, false)));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider;
2121
import io.modelcontextprotocol.spec.McpServerTransportProvider;
22+
2223
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
2324
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition;
2425
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import io.modelcontextprotocol.server.transport.WebFluxStatelessServerTransport;
2121
import io.modelcontextprotocol.spec.McpSchema;
22+
2223
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStatelessAutoConfiguration;
2324
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition;
2425
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import io.modelcontextprotocol.server.transport.WebFluxStreamableServerTransportProvider;
2121
import io.modelcontextprotocol.spec.McpSchema;
22+
2223
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
2324
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition;
2425
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux/src/test/java/org/springframework/ai/mcp/server/autoconfigure/StatelessWebClientWebFluxServerIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.ai.mcp.server.autoconfigure;
1818

19-
import java.time.Duration;
2019
import java.util.List;
2120
import java.util.Map;
2221

@@ -53,7 +52,6 @@
5352
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStatelessAutoConfiguration;
5453
import org.springframework.ai.mcp.server.common.autoconfigure.StatelessToolCallbackConverterAutoConfiguration;
5554
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
56-
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
5755
import org.springframework.ai.tool.function.FunctionToolCallback;
5856
import org.springframework.beans.factory.ObjectProvider;
5957
import org.springframework.boot.autoconfigure.AutoConfigurations;

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux/src/test/java/org/springframework/ai/mcp/server/autoconfigure/StreamableMcpAnnotationsIT.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerAnnotationScannerAutoConfiguration;
8181
import org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerSpecificationFactoryAutoConfiguration;
8282
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
83-
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
8483
import org.springframework.beans.factory.ObjectProvider;
8584
import org.springframework.boot.autoconfigure.AutoConfigurations;
8685
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -121,9 +120,9 @@ void clientServerCapabilities() {
121120
// "spring.ai.mcp.server.type=ASYNC",
122121
// "spring.ai.mcp.server.protocol=SSE",
123122
"spring.ai.mcp.server.version=1.0.0",
124-
"spring.ai.mcp.server.streamable-http.keep-alive-interval=1s",
123+
"spring.ai.mcp.server.streamable.keep-alive-interval=1s",
125124
// "spring.ai.mcp.server.requestTimeout=1m",
126-
"spring.ai.mcp.server.streamable-http.mcp-endpoint=/mcp") // @formatter:on
125+
"spring.ai.mcp.server.streamable.mcp-endpoint=/mcp") // @formatter:on
127126
.run(serverContext -> {
128127
// Verify all required beans are present
129128
assertThat(serverContext).hasSingleBean(WebFluxStreamableServerTransportProvider.class);
@@ -135,16 +134,14 @@ void clientServerCapabilities() {
135134
assertThat(properties.getName()).isEqualTo("test-mcp-server");
136135
assertThat(properties.getVersion()).isEqualTo("1.0.0");
137136

138-
McpServerStreamableHttpProperties streamableHttpProperties = serverContext
139-
.getBean(McpServerStreamableHttpProperties.class);
140-
assertThat(streamableHttpProperties.getMcpEndpoint()).isEqualTo("/mcp");
141-
assertThat(streamableHttpProperties.getKeepAliveInterval()).isEqualTo(Duration.ofSeconds(1));
137+
assertThat(properties.getStreamable().getMcpEndpoint()).isEqualTo("/mcp");
138+
assertThat(properties.getStreamable().getKeepAliveInterval()).isEqualTo(Duration.ofSeconds(1));
142139

143140
var httpServer = startHttpServer(serverContext, serverPort);
144141

145142
this.clientApplicationContext.withUserConfiguration(TestMcpClientConfiguration.class)
146143
.withPropertyValues(// @formatter:off
147-
"spring.ai.mcp.client.streamable-http.connections.server1.url=http://localhost:" + serverPort,
144+
"spring.ai.mcp.client.streamable.connections.server1.url=http://localhost:" + serverPort,
148145
// "spring.ai.mcp.client.sse.connections.server1.url=http://localhost:" + serverPort,
149146
// "spring.ai.mcp.client.request-timeout=20m",
150147
"spring.ai.mcp.client.initialized=false") // @formatter:on

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux/src/test/java/org/springframework/ai/mcp/server/autoconfigure/StreamableMcpAnnotationsManualIT.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
8383
import org.springframework.ai.mcp.server.common.autoconfigure.ToolCallbackConverterAutoConfiguration;
8484
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
85-
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
8685
import org.springframework.beans.factory.ObjectProvider;
8786
import org.springframework.boot.autoconfigure.AutoConfigurations;
8887
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -117,9 +116,9 @@ void clientServerCapabilities() {
117116
.withPropertyValues(// @formatter:off
118117
"spring.ai.mcp.server.name=test-mcp-server",
119118
"spring.ai.mcp.server.version=1.0.0",
120-
"spring.ai.mcp.server.streamable-http.keep-alive-interval=1s",
119+
"spring.ai.mcp.server.streamable.keep-alive-interval=1s",
121120
// "spring.ai.mcp.server.requestTimeout=1m",
122-
"spring.ai.mcp.server.streamable-http.mcp-endpoint=/mcp") // @formatter:on
121+
"spring.ai.mcp.server.streamable.mcp-endpoint=/mcp") // @formatter:on
123122
.run(serverContext -> {
124123
// Verify all required beans are present
125124
assertThat(serverContext).hasSingleBean(WebFluxStreamableServerTransportProvider.class);
@@ -131,16 +130,14 @@ void clientServerCapabilities() {
131130
assertThat(properties.getName()).isEqualTo("test-mcp-server");
132131
assertThat(properties.getVersion()).isEqualTo("1.0.0");
133132

134-
McpServerStreamableHttpProperties streamableHttpProperties = serverContext
135-
.getBean(McpServerStreamableHttpProperties.class);
136-
assertThat(streamableHttpProperties.getMcpEndpoint()).isEqualTo("/mcp");
137-
assertThat(streamableHttpProperties.getKeepAliveInterval()).isEqualTo(Duration.ofSeconds(1));
133+
assertThat(properties.getStreamable().getMcpEndpoint()).isEqualTo("/mcp");
134+
assertThat(properties.getStreamable().getKeepAliveInterval()).isEqualTo(Duration.ofSeconds(1));
138135

139136
var httpServer = startHttpServer(serverContext, serverPort);
140137

141138
this.clientApplicationContext.withUserConfiguration(TestMcpClientConfiguration.class)
142139
.withPropertyValues(// @formatter:off
143-
"spring.ai.mcp.client.streamable-http.connections.server1.url=http://localhost:" + serverPort,
140+
"spring.ai.mcp.client.streamable.connections.server1.url=http://localhost:" + serverPort,
144141
// "spring.ai.mcp.client.request-timeout=20m",
145142
"spring.ai.mcp.client.initialized=false") // @formatter:on
146143
.run(clientContext -> {

auto-configurations/mcp/spring-ai-autoconfigure-mcp-server-webflux/src/test/java/org/springframework/ai/mcp/server/autoconfigure/StreamableWebClientWebFluxServerIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
6868
import org.springframework.ai.mcp.server.common.autoconfigure.ToolCallbackConverterAutoConfiguration;
6969
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;
70-
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties;
7170
import org.springframework.beans.factory.ObjectProvider;
7271
import org.springframework.boot.autoconfigure.AutoConfigurations;
7372
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.fasterxml.jackson.databind.ObjectMapper;
2020
import io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvider;
2121
import io.modelcontextprotocol.spec.McpServerTransportProvider;
22+
2223
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration;
2324
import org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition;
2425
import org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties;

0 commit comments

Comments
 (0)