feat(java): Update the Java SDK to 0.8.0 (#190)

* feat(java): Update the Java SDK to 0.8.0

- Update Java SDK version from 0.7.0 to 0.8.0
- Refactor transport layer to use transportProvider pattern
- Rename registrations to specifications in server API
- Add exchange parameter to callback functions
- Add breaking changes note
- Enhance MCP Java SDK documentation with sampling
  * Add documentation for sampling capabilities in MCP Server
  * Expand documentation for Tool, Resource, and Prompt specifications
  * Add Spring AI integration to the client/server docs

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>

* refactor(java-sdk): improve API usage example

- Replace Content builder pattern with direct TextContent constructor
- Replace ModelHint builder pattern with static factory method

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>

---------

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Christian Tzolov 2025-03-21 19:10:49 +01:00 • committed by GitHub
commit 6e1bbc4e30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,12 @@ description: Introduction to the Model Context Protocol (MCP) Java SDK
Java SDK for the [Model Context Protocol](https://modelcontextprotocol.org/docs/concepts/architecture)
enables standardized integration between AI models and tools.
<Note>
### Breaking Changes in 0.8.0 ⚠️
**Note:** Version 0.8.0 introduces several breaking changes including a new session-based architecture.
If you're upgrading from 0.7.0, please refer to the [Migration Guide](https://github.com/modelcontextprotocol/java-sdk/blob/main/migration-0.8.0.md) for detailed instructions.
</Note>
## Features
- MCP Client and MCP Server implementations supporting:
@ -25,6 +31,10 @@ enables standardized integration between AI models and tools.
- WebMVC SSE transport for servlet-based HTTP streaming
- Supports Synchronous and Asynchronous programming paradigms
<Tip>[Spring AI MCP](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html) extends the MCP Java SDK with Spring Boot integration,
providing both [Client](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html) and [Server](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html) Boot Starters.
You can bootstrap your AI Spring applications using the [Spring Initializer](https://start.spring.io/).</Tip>
## Architecture
The SDK follows a layered architecture with clear separation of concerns:
@ -129,7 +139,7 @@ Add the BOM to your project:
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-bom</artifactId>
<version>0.7.0</version>
<version>0.8.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -141,7 +151,7 @@ Add the BOM to your project:
<Tab title="Gradle">
```groovy
dependencies {
implementation platform("io.modelcontextprotocol.sdk:mcp-bom:0.7.0")
implementation platform("io.modelcontextprotocol.sdk:mcp-bom:0.8.0")
//...
}
```