Why is the Java SDK not generic ? #246
Replies: 8 comments 46 replies
-
Actually, probably the best approach would be to do something like we used to do in Java in the past: create an SPI, and then everyone provides its own implementation on top of that. It can be an RI implementation, which can be Spring Boot, plain Java, or Vertex, but at least having an SDK is not tight to anything. |
Beta Was this translation helpful? Give feedback.
-
It looks like MCP is going to stay and grow in the future. In that case, it would be great to have an SPI which is not coupled with any specific framework. That would allow any Java/JVM based applications to leverage MCP capabilities relying on SPI. |
Beta Was this translation helpful? Give feedback.
-
This statement is incorrect. The core mcp module is framework-agnostic, providing The mcp-spring is optional and only necessary if you're using Spring's WebMVC/Webflux web server support. Don't use it if you're not using Spring. Other frameworks can contribute optional transport implementations for their frameworks on top of the core mcp module. We have to update the documentation to clarify the distinction between core mcp and optional mcp-spring modules. |
Beta Was this translation helpful? Give feedback.
-
Jumping in here. I can't talk to the specifics, since I don't know the Java ecosystem enough to have a well formed opinion. I just want to be mindful that we keep the discussion productive and work towards what is clearly a good goal: A Java SDK core that everyone in the ecosystem can build on top. I can't speak for @tzolov, who of course is the maintainer of the SDK, but I would want to encourage people to build out the necessary infrastructure in the SDK together. This can be in whatever form @tzolov prefers, be it PRs, RFCs, etc. I'd strongly prefer if one or two people from the different interest groups, e.g. quarkus, represent the needs of the project and we don't continue to pile onto the thread. |
Beta Was this translation helpful? Give feedback.
-
We have identified a reasonable way to introduce an implementation-neutral SPI module that will allow any vendor to provide its own implementation without too much disruption. For the Reactive part, we are going to follow the R2DBC "playbook" which has proven to be successful in building a healthy ecosystem. So in practice we are likely going to introduce an mcp-spi module with no dependency on Reactor which any implementor can use to provide their implementation. On the technical side, we don't consider CompletionStage as a suitable type to expose mainly due to the eager processing and cancellation behavior it involves, so we’ll use Publisher for single async values with some related documentation for implementers like we successfully did in R2DBC. For the Publisher variant, our opinion (we acknowledge Red Hat contributors have a different one, and that's ok) is that the RS Publisher is the abstraction we prefer to continue using for multiple reasons. The JDK team seems more interested in investing in Virtual Threads and Structured Concurrency than leveraging Flow interfaces outside of the HTTP client, the TCK still lives on reactive-streams.org side, so in the meantime the Reactive Streams variant of Publisher is maybe not the worst bet for the future. Also, an entire multi-stakeholder reactive ecosystem (R2DBC, RSocket, large companies like Netflix and Amazon) outside of Red Hat is built on the org.reactivestreams variant, so that’s a pretty large target audience for this SPI, and that would allow us to propose a JDK 8 baseline for the SPI in case some companies want to provide such implementation. There would be no practical gain in replacing this widely established contract—only significant pain due to its integration in countless libraries throughout the ecosystem. Finally, it is very easy to adapt to/from RS Publisher to the JDK Flow variant. For declarative APIs, we think that's far too early for standardizing anything, even just annotations, but we can of course begin to discuss and brainstorm. |
Beta Was this translation helpful? Give feedback.
-
I hope it supports jdk8! There are plenty of production jdk8 environments out there, and they're afraid to upgrade. |
Beta Was this translation helpful? Give feedback.
-
At the outset, @sebastienblanc wrote:
I did seek to mention them at least in modelcontextprotocol/servers#758 . Perhaps I can get some upvotes on that one? |
Beta Was this translation helpful? Give feedback.
-
So what ever happened here? I see now that on https://modelcontextprotocol.io/sdk/java/mcp-server#sse-servlet the SSE (Servlet) approach is completely tied to Spring.... That doesn't seem at all right. Even if its just in the documentation, when presenting an example of a "vanilla" integration, the example should be "vanilla". |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Discussion Topic
The current MCP Java SDK is implemented on top of an existing Framework (Spring). While I'm sure it's an excellent implementation and it's not generic enough for people that would like to use it outside of Spring.
Other stacks like Quarkus and Langchain4j also provide solid implementations (both client and server side). Until a generic SDK is released maybe those implementations could also be mentioned in the
modelcontextprotocol
?Beta Was this translation helpful? Give feedback.
All reactions