You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
docs: improve transport layer documentation and code cleanup
- Add comprehensive Javadoc for SSE transport implementations
- Document key features and implementation details for WebFlux/WebMVC transports
- Refactor FlowSseClient to use records for better immutability
- Fix typo in prompt property name
- Remove unused code and improve readability
Copy file name to clipboardExpand all lines: mcp-transport/mcp-webflux-sse-transport/src/main/java/org/springframework/ai/mcp/client/transport/WebFluxSseClientTransport.java
+51-4Lines changed: 51 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -61,10 +61,9 @@
61
61
* <li>The client establishes an SSE connection to the server's /sse endpoint</li>
62
62
* <li>The server sends an 'endpoint' event containing the URI for sending messages</li>
63
63
* </ol>
64
-
*
65
-
* This implementation handles automatic reconnection for transient failures and provides
66
-
* graceful shutdown capabilities. It uses {@link WebClient} for HTTP communications and
67
-
* supports JSON serialization/deserialization of messages.
64
+
*
65
+
* This implementation uses {@link WebClient} for HTTP communications and supports JSON
66
+
* serialization/deserialization of messages.
68
67
*
69
68
* @author Christian Tzolov
70
69
* @see <a href=
@@ -157,6 +156,28 @@ public WebFluxSseClientTransport(WebClient.Builder webClientBuilder, ObjectMappe
157
156
this.webClient = webClientBuilder.build();
158
157
}
159
158
159
+
/**
160
+
* Establishes a connection to the MCP server using Server-Sent Events (SSE). This
161
+
* method initiates the SSE connection and sets up the message processing pipeline.
162
+
*
163
+
* <p>
164
+
* The connection process follows these steps:
165
+
* <ol>
166
+
* <li>Establishes an SSE connection to the server's /sse endpoint</li>
167
+
* <li>Waits for the server to send an 'endpoint' event with the message posting
168
+
* URI</li>
169
+
* <li>Sets up message handling for incoming JSON-RPC messages</li>
170
+
* </ol>
171
+
*
172
+
* <p>
173
+
* The connection is considered established only after receiving the endpoint event
174
+
* from the server.
175
+
* @param handler a function that processes incoming JSON-RPC messages and returns
176
+
* responses
177
+
* @return a Mono that completes when the connection is fully established
178
+
* @throws McpError if there's an error processing SSE events or if an unrecognized
Copy file name to clipboardExpand all lines: mcp-transport/mcp-webflux-sse-transport/src/main/java/org/springframework/ai/mcp/server/transport/WebFluxSseServerTransport.java
0 commit comments