-
Notifications
You must be signed in to change notification settings - Fork 450
WebClient Streamable HTTP support #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The CI fails for the Stdio tests. I can't reproduce it on my M1 Mac, but will try a linux box and investigate. |
There is the missing bit for issuing a DELETE upon client-side session termination, I'll investigate how it could be achieved. I will review the spec once more and see what else is missing. |
Hi @chemicL thanks for the excellent work! I can run the unit test on our mcp streamable http service. But one issue is that our service is running on springframework 5.3.28. And I notice that your WebClientStreamableHttpTransport only work compatible with springframework 6.2.1. So when I integrate with your code in our service. The below error popped up.
this is from spring-web-6.2.1.jar We integrated with HttpClientSseClientTransport before to take care of sse, and the springframework 5.3.28 works fine with the class. Now we would like to upgrade to WebClientStreamableHttpTransport and has this incompatible issue. Is it possible to make it compatible with the old spring version? Thanks! |
@bugzyz thank you! We are targetting Spring Framework gen 6, unfortunately. However, in your circumstances, once we introduce the JDK HttpClient support for Streamable HTTP, you should be able to use that in combination with older Spring Framework-based code. That work is coming once we finalize the architectural changes covered here. And then you wouldn't need the mcp-spring module dependency. Hope this helps. |
I updated the description in the PR to reflect the architectural overview and decisions to improve the review. @tzolov I'll continue looking into the DELETE aspect and come back either here or via a follow-up PR. |
Streamable is finally here:) Thanks! |
@bugzyz java8, java11, spring5, etc., can use the solon-ai project https://github.com/opensolon/solon-ai We sync a java8 code and provide a simple experience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left few comments.
Not critical but hopefully can improve the readability and understandability.
mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Outdated
Show resolved
Hide resolved
mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Outdated
Show resolved
Hide resolved
mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Outdated
Show resolved
Hide resolved
mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Outdated
Show resolved
Hide resolved
mcp/src/main/java/io/modelcontextprotocol/client/McpAsyncClient.java
Outdated
Show resolved
Hide resolved
Thank you @chemicL . Looking forward to the release! |
Thanks for the update. Looks great @chemicL ! |
Added the documentation, cleaned up. If there are no more remarks, I'll merge this. The occasional CI failures with STDIO Transport are a result of running |
@chemicL this in response to this comment in issue #273 . I think this is definitively a step in the right direction. I think what'd be good for completing this is also adding access to the transport's underlying properties. For instance, it'd be great to have a way of accessing the request's headers and query params. This is important for implementing authorization schemes, custom traceability and other concerns that go beyond what this SDK (or the Spring ecosystem) should implement OOTB (I also think that enabling non-spring apps is very important too) Also, if you're looking for input on the server side, please see issues #274 and #275 as well. Thank you! |
Introducing WebClient support for Streamable HTTP transport.
Motivation and Context
The 2025-03-26 specification of MCP introduces Streamable HTTP transport that replaces SSE transport.
This change introduces more resilient primitives that support the initial, WebClient-based client transport for Streamable HTTP.
Various failure modes at either the transport or logical layer have been addressed and are now fully supported by the new
WebClientStreamableHttpTransport
class. The surroundingMcpAsyncClient
andMcpClientSession
have been modified to handle possible issues according to the adequate layer's responsibility.Orientation
The existing APIs are organized quite logically with regards to various responsibilities using layers. Below is the status quo description and the changes required for Streamable HTTP to be implemented.
Rationale for the API
The client types are layered in the following way:
Here are the distinguishing features of these APIs:
McpAsyncClient
(and the facade,McpSyncClient
)Mcp(Client)Session
Mcp(Client)Transport
McpTransportSession
McpTransportStream
How Has This Been Tested?
everything
MCP server.Breaking Changes
The client initialization became lazy and more error-prone - connections happen upon first request and initialization is performed implicitly if it has not been issued before.
Types of changes
Checklist
Additional context
The JDK HttpClient will be implemented next.
Remaining tasks
Related #72