Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 611f325

Browse files
committed
refactor: Split transport implementations into modules
Split the transport implementations into dedicated modules to improve modularity and reduce core dependencies. Added shared test module for common test utilities. Key changes: - Create mcp-transport/mcp-webflux-sse-transport module - Move SseClientTransport → WebFluxSseClientTransport - Move SseServerTransport → WebFluxSseServerTransport - Move related tests and utilities - Create mcp-transport/mcp-webmvc-sse-transport module - Add new WebMvcSseServerTransport implementation - Add corresponding tests and integration tests - Add framework-independent SSE client implementations to core module - Add FlowSseClient using java.net.http - Add HttpClientSseClientTransport using java.net.http - Keep StdioClientTransport/StdioServerTransport in core (no external deps) - Create mcp-test module for shared test infrastructure - Move abstract test base classes - Move shared test utilities and mocks - Update test dependencies The modular approach allows users to choose between: - Framework-specific implementations (WebFlux/WebMVC) - Pure Java implementations (java.net.http) - Basic implementations (STDIO) Add breaking changes readme: 0.5.0-BREAKING-CHANGES.md Resolves #54
1 parent 85c4fb8 commit 611f325

File tree

63 files changed

+5002
-1588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5002
-1588
lines changed

0.5.0-BREAKING-CHANGES.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Breaking Changes for Spring AI MCP 0.5.0-SNAPSHOT
2+
3+
## Major Changes
4+
5+
1. Transport Implementation Modularization
6+
- SSE transport implementations have been moved to dedicated modules:
7+
- `mcp-webflux-sse-transport`: WebFlux-based SSE transport
8+
- `mcp-webmvc-sse-transport`: WebMVC-based SSE transport
9+
- Base MCP module no longer includes transport implementations
10+
11+
2. Class Renames
12+
- `SseClientTransport``WebFluxSseClientTransport`
13+
- `SseServerTransport``WebFluxSseServerTransport`
14+
15+
3. Project Structure
16+
- Test utilities moved to new `mcp-test` module
17+
- Sample application moved to `samples/` directory
18+
19+
## Migration Guide
20+
21+
### 1. Update Dependencies
22+
23+
If using SSE transport, add the appropriate transport module to your pom.xml:
24+
25+
For WebFlux SSE transport:
26+
```xml
27+
<dependency>
28+
<groupId>org.springframework.experimental</groupId>
29+
<artifactId>mcp-webflux-sse-transport</artifactId>
30+
<version>0.5.0-SNAPSHOT</version>
31+
</dependency>
32+
```
33+
34+
For WebMVC SSE transport:
35+
```xml
36+
<dependency>
37+
<groupId>org.springframework.experimental</groupId>
38+
<artifactId>mcp-webmvc-sse-transport</artifactId>
39+
<version>0.5.0-SNAPSHOT</version>
40+
</dependency>
41+
```
42+
43+
### 2. Update Transport Class References
44+
45+
Replace:
46+
```java
47+
import org.springframework.ai.mcp.client.transport.SseClientTransport;
48+
import org.springframework.ai.mcp.server.transport.SseServerTransport;
49+
```
50+
51+
With:
52+
```java
53+
// For WebFlux
54+
import org.springframework.ai.mcp.client.transport.WebFluxSseClientTransport;
55+
import org.springframework.ai.mcp.server.transport.WebFluxSseServerTransport;
56+
57+
// Or for WebMVC
58+
import org.springframework.ai.mcp.server.transport.WebMvcSseServerTransport;
59+
```
60+
61+
### 3. Update Transport Instantiation
62+
63+
Replace:
64+
```java
65+
var transport = new SseClientTransport(webClientBuilder);
66+
```
67+
68+
With:
69+
```java
70+
var transport = new WebFluxSseClientTransport(webClientBuilder);
71+
```
72+
73+
Replace:
74+
```java
75+
var serverTransport = new SseServerTransport(objectMapper, messageEndpoint);
76+
```
77+
78+
With:
79+
```java
80+
// For WebFlux
81+
var serverTransport = new WebFluxSseServerTransport(objectMapper, messageEndpoint);
82+
83+
// Or for WebMVC
84+
var serverTransport = new WebMvcSseServerTransport(objectMapper, messageEndpoint);
85+
```
86+
87+
### 4. Test Dependencies
88+
89+
If you're using MCP test utilities, add the test module dependency:
90+
91+
```xml
92+
<dependency>
93+
<groupId>org.springframework.experimental</groupId>
94+
<artifactId>mcp-test</artifactId>
95+
<version>0.5.0-SNAPSHOT</version>
96+
<scope>test</scope>
97+
</dependency>
98+
```
99+
100+
## Other Changes
101+
102+
- Spring AI dependency updated to 1.0.0-M5
103+
- Improved dependency management and reduced transitive dependencies
104+
- Sample application restructured under samples/ directory
105+
- New test utilities and base test classes in mcp-test module

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Explore these MCP examples in the [spring-ai-examples/model-context-protocol](ht
6868
- [SQLite Chatbot](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sqlite/chatbot) - Interactive chatbot with SQLite database interaction
6969
- [Filesystem](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/filesystem) - Enables LLM interaction with local filesystem folders and files
7070
- [Brave](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/brave) - Enables natural language interactions with Brave Search, allowing you to perform internet searches.
71-
- [Spring-ai-mcp-sample](./spring-ai-mcp-sample/) - Showcases how to create and use MCP servers and clients with different transport modes and capabilities.
71+
- [Spring-ai-mcp-sample](./samples/spring-ai-mcp-sample/) - Showcases how to create and use MCP servers and clients with different transport modes and capabilities.
7272
## Documentation
7373

7474
- [Java MCP SDK documentation](mcp/README.md)

docs/CLIENT.SSE.TRANSPORT.md

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

docs/CLIENT.STDIO.TRANSPORT.md

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

0 commit comments

Comments
 (0)