Skip to content

Commit 30dc805

Browse files
committed
Merge branch 'main' into 1-0-0-remove-deprecations
2 parents c04e062 + 77bc64a commit 30dc805

File tree

60 files changed

+242
-9361
lines changed

Some content is hidden

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

60 files changed

+242
-9361
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ For comprehensive guides and SDK API documentation
2020
- [Java MCP Server](https://modelcontextprotocol.github.io/java-sdk/server/) - Learn how to implement and configure a MCP servers.
2121

2222
#### Spring AI MCP documentation
23-
[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) starters.
24-
The [MCP Annotations](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-annotations-overview.html) - provides annotation-based method handling for MCP servers and clients in Java.
25-
The [MCP Security](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-security.html) - provides comprehensive OAuth 2.0 and API key-based security support for Model Context Protocol implementations in Spring AI.
23+
[Spring AI MCP](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) extends the MCP Java SDK with Spring Boot integration, providing both [client](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-client-boot-starter-docs.html) and [server](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-server-boot-starter-docs.html) starters.
24+
The [MCP Annotations](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-annotations-overview.html) - provides annotation-based method handling for MCP servers and clients in Java.
25+
The [MCP Security](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-security.html) - provides comprehensive OAuth 2.0 and API key-based security support for Model Context Protocol implementations in Spring AI.
2626
Bootstrap your AI applications with MCP support using [Spring Initializer](https://start.spring.io).
2727

2828
## Development
@@ -139,21 +139,21 @@ MCP supports both clients (applications consuming MCP servers) and servers (appl
139139

140140
#### Client Transport in the SDK
141141

142-
* **SDK Choice**: JDK HttpClient (Java 11+) as the default client, with optional Spring WebClient support
142+
* **SDK Choice**: JDK HttpClient (Java 11+) as the default client
143143

144-
* **Why**: The JDK HttpClient is built-in, portable, and supports streaming responses. This keeps the default lightweight with no extra dependencies. Spring WebClient support is available for Spring-based projects.
144+
* **Why**: The JDK HttpClient is built-in, portable, and supports streaming responses. This keeps the default lightweight with no extra dependencies.
145145

146-
* **How we expose it**: MCP Client APIs are transport-agnostic. The core module ships with JDK HttpClient transport. A Spring module provides WebClient integration.
146+
* **How we expose it**: MCP Client APIs are transport-agnostic. The core module ships with JDK HttpClient transport. Spring WebClient-based transport is available in [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+.
147147

148148
* **How it fits the SDK**: This ensures all applications can talk to MCP servers out of the box, while allowing richer integration in Spring and other environments.
149149

150150
#### Server Transport in the SDK
151151

152-
* **SDK Choice**: Jakarta Servlet implementation in core, with optional Spring WebFlux and Spring WebMVC providers
152+
* **SDK Choice**: Jakarta Servlet implementation in core
153153

154-
* **Why**: Servlet is the most widely deployed Java server API. WebFlux and WebMVC cover a significant part of the Spring community. Together these provide reach across blocking and non-blocking models.
154+
* **Why**: Servlet is the most widely deployed Java server API, providing broad reach across blocking and non-blocking models without additional dependencies.
155155

156-
* **How we expose it**: Server APIs are transport-agnostic. Core includes Servlet support. Spring modules extend support for WebFlux and WebMVC.
156+
* **How we expose it**: Server APIs are transport-agnostic. Core includes Servlet support. Spring WebFlux and WebMVC server transports are available in [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+.
157157

158158
* **How it fits the SDK**: This allows developers to expose MCP servers in the most common Java environments today, while enabling other transport implementations such as Netty, Vert.x, or Helidon.
159159

@@ -176,9 +176,10 @@ The SDK is organized into modules to separate concerns and allow adopters to bri
176176
* `mcp-json-jackson3` – Jackson 3 implementation of JSON binding
177177
* `mcp` – Convenience bundle (core + Jackson 3)
178178
* `mcp-test` – Shared testing utilities
179-
* `mcp-spring` – Spring integrations (WebClient, WebFlux, WebMVC)
180179

181-
For example, a minimal adopter may depend only on `mcp` (core + Jackson), while a Spring-based application can use `mcp-spring` for deeper framework integration.
180+
Spring integrations (WebClient, WebFlux, WebMVC) are now part of [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+ (group `org.springframework.ai`).
181+
182+
For example, a minimal adopter may depend only on `mcp` (core + Jackson), while a Spring-based application can use the Spring AI `mcp-spring-webflux` or `mcp-spring-webmvc` artifacts for deeper framework integration.
182183

183184
Additionally, `mcp-test` contains integration tests for `mcp-core`.
184185
`mcp-core` needs a JSON implementation to run full integration tests.

SECURITY.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Security Policy
22

3-
Thank you for helping us keep the SDKs and systems they interact with secure.
3+
Thank you for helping keep the Model Context Protocol and its ecosystem secure.
44

55
## Reporting Security Issues
66

7-
This SDK is maintained by [Anthropic](https://www.anthropic.com/) as part of the Model
8-
Context Protocol project.
7+
If you discover a security vulnerability in this repository, please report it through
8+
the [GitHub Security Advisory process](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability)
9+
for this repository.
910

10-
The security of our systems and user data is Anthropic’s top priority. We appreciate the
11-
work of security researchers acting in good faith in identifying and reporting potential
12-
vulnerabilities.
11+
Please **do not** report security vulnerabilities through public GitHub issues, discussions,
12+
or pull requests.
1313

14-
Our security program is managed on HackerOne and we ask that any validated vulnerability
15-
in this functionality be reported through their
16-
[submission form](https://hackerone.com/anthropic-vdp/reports/new?type=team&report_type=vulnerability).
14+
## What to Include
1715

18-
## Vulnerability Disclosure Program
16+
To help us triage and respond quickly, please include:
1917

20-
Our Vulnerability Program Guidelines are defined on our
21-
[HackerOne program page](https://hackerone.com/anthropic-vdp).
18+
- A description of the vulnerability
19+
- Steps to reproduce the issue
20+
- The potential impact
21+
- Any suggested fixes (optional)

docs/blog/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Blog
1+
# News

docs/client.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ The MCP Client is a key component in the Model Context Protocol (MCP) architectu
1919
!!! tip
2020
The core `io.modelcontextprotocol.sdk:mcp` module provides STDIO, SSE, and Streamable HTTP client transport implementations without requiring external web frameworks.
2121

22-
Spring-specific transport implementations are available as an **optional** dependency `io.modelcontextprotocol.sdk:mcp-spring-webflux` for [Spring Framework](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html) users.
22+
The Spring-specific WebFlux transport (`mcp-spring-webflux`) is now part of [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+ (group `org.springframework.ai`) and is no longer shipped by this SDK.
23+
See the [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-client-boot-starter-docs.html) documentation for Spring-based client setup.
2324

2425
The client provides both synchronous and asynchronous APIs for flexibility in different application contexts.
2526

@@ -135,26 +136,20 @@ The client provides both synchronous and asynchronous APIs for flexibility in di
135136

136137
The transport layer handles the communication between MCP clients and servers, providing different implementations for various use cases. The client transport manages message serialization, connection establishment, and protocol-specific communication patterns.
137138

138-
=== "STDIO"
139+
### STDIO
139140

140-
Creates transport for process-based communication using stdin/stdout:
141+
Creates transport for process-based communication using stdin/stdout:
141142

142-
```java
143-
ServerParameters params = ServerParameters.builder("npx")
144-
.args("-y", "@modelcontextprotocol/server-everything", "dir")
145-
.build();
146-
McpTransport transport = new StdioClientTransport(params);
147-
```
148-
149-
=== "SSE (HttpClient)"
150-
151-
Creates a framework-agnostic (pure Java API) SSE client transport. Included in the core `mcp` module:
143+
```java
144+
ServerParameters params = ServerParameters.builder("npx")
145+
.args("-y", "@modelcontextprotocol/server-everything", "dir")
146+
.build();
147+
McpTransport transport = new StdioClientTransport(params);
148+
```
152149

153-
```java
154-
McpTransport transport = new HttpClientSseClientTransport("http://your-mcp-server");
155-
```
150+
### Streamable HTTP
156151

157-
=== "Streamable HTTP"
152+
=== "Streamable HttpClient"
158153

159154
Creates a Streamable HTTP client transport for efficient bidirectional communication. Included in the core `mcp` module:
160155

@@ -172,16 +167,36 @@ The transport layer handles the communication between MCP clients and servers, p
172167
- Custom HTTP request customization
173168
- Multiple protocol version negotiation
174169

175-
=== "SSE (WebFlux)"
170+
=== "Streamable WebClient (external)"
171+
172+
Creates Streamable HTTP WebClient-based client transport. Requires the `mcp-spring-webflux` dependency from [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+ (group `org.springframework.ai`):
176173

177-
Creates WebFlux-based SSE client transport. Requires the `mcp-spring-webflux` dependency:
174+
```java
175+
McpTransport transport = WebFluxSseClientTransport
176+
.builder(WebClient.builder().baseUrl("http://your-mcp-server"))
177+
.build();
178+
```
179+
180+
### SSE HTTP (Legacy)
181+
182+
=== "SSE HttpClient"
183+
184+
Creates a framework-agnostic (pure Java API) SSE client transport. Included in the core `mcp` module:
185+
186+
```java
187+
McpTransport transport = new HttpClientSseClientTransport("http://your-mcp-server");
188+
```
189+
=== "SSE WebClient (external)"
190+
191+
Creates WebFlux-based SSE client transport. Requires the `mcp-spring-webflux` dependency from [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+ (group `org.springframework.ai`):
178192

179193
```java
180194
WebClient.Builder webClientBuilder = WebClient.builder()
181195
.baseUrl("http://your-mcp-server");
182196
McpTransport transport = new WebFluxSseClientTransport(webClientBuilder);
183197
```
184198

199+
185200
## Client Capabilities
186201

187202
The client can be configured with various capabilities:

docs/index.md

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Overview
2+
title: Index
33
description: Introduction to the Model Context Protocol (MCP) Java SDK
44
---
55

@@ -27,7 +27,7 @@ enables standardized integration between AI models and tools.
2727
- Java HttpClient-based SSE client transport for HTTP SSE Client-side streaming
2828
- Servlet-based SSE server transport for HTTP SSE Server streaming
2929
- [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http) transport for efficient bidirectional communication (client and server)
30-
- Optional Spring-based transports (convenience if using Spring Framework):
30+
- Optional Spring-based transports (available in [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+, no longer part of this SDK):
3131
- WebFlux SSE client and server transports for reactive HTTP streaming
3232
- WebFlux Streamable HTTP server transport
3333
- WebMVC SSE server transport for servlet-based HTTP streaming
@@ -41,56 +41,9 @@ enables standardized integration between AI models and tools.
4141
!!! tip
4242
The core `io.modelcontextprotocol.sdk:mcp` module provides default STDIO, SSE, and Streamable HTTP client and server transport implementations without requiring external web frameworks.
4343

44-
Spring-specific transports are available as optional dependencies for convenience when using the [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html) and [MCP Server Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html).
45-
Also consider the [MCP Annotations](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-annotations-overview.html) and [MCP Security](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-security.html).
46-
47-
## Architecture
48-
49-
The SDK follows a layered architecture with clear separation of concerns:
50-
51-
![MCP Stack Architecture](images/mcp-stack.svg)
52-
53-
- **Client/Server Layer (McpClient/McpServer)**: Both use McpSession for sync/async operations,
54-
with McpClient handling client-side protocol operations and McpServer managing server-side protocol operations.
55-
- **Session Layer (McpSession)**: Manages communication patterns and state.
56-
- **Transport Layer (McpTransport)**: Handles JSON-RPC message serialization/deserialization via:
57-
- StdioTransport (stdin/stdout) in the core module
58-
- HTTP SSE transports in dedicated transport modules (Java HttpClient, Spring WebFlux, Spring WebMVC)
59-
- Streamable HTTP transports for efficient bidirectional communication
60-
61-
The MCP Client is a key component in the Model Context Protocol (MCP) architecture, responsible for establishing and managing connections with MCP servers.
62-
It implements the client-side of the protocol.
63-
64-
![Java MCP Client Architecture](images/java-mcp-client-architecture.jpg)
65-
66-
The MCP Server is a foundational component in the Model Context Protocol (MCP) architecture that provides tools, resources, and capabilities to clients.
67-
It implements the server-side of the protocol.
68-
69-
![Java MCP Server Architecture](images/java-mcp-server-architecture.jpg)
70-
71-
Key Interactions:
72-
73-
- **Client/Server Initialization**: Transport setup, protocol compatibility check, capability negotiation, and implementation details exchange.
74-
- **Message Flow**: JSON-RPC message handling with validation, type-safe response processing, and error handling.
75-
- **Resource Management**: Resource discovery, URI template-based access, subscription system, and content retrieval.
76-
77-
## Module Structure
78-
79-
The SDK is organized into modules to separate concerns and allow adopters to bring in only what they need:
80-
81-
| Module | Artifact ID | Purpose |
82-
|--------|------------|---------|
83-
| `mcp-bom` | `mcp-bom` | Bill of Materials for dependency management |
84-
| `mcp-core` | `mcp-core` | Core reference implementation (STDIO, JDK HttpClient, Servlet, Streamable HTTP) |
85-
| `mcp-json-jackson2` | `mcp-json-jackson2` | Jackson 2.x JSON serialization implementation |
86-
| `mcp-json-jackson3` | `mcp-json-jackson3` | Jackson 3.x JSON serialization implementation |
87-
| `mcp` | `mcp` | Convenience bundle (`mcp-core` + `mcp-json-jackson3`) |
88-
| `mcp-test` | `mcp-test` | Shared testing utilities and integration tests |
89-
| `mcp-spring-webflux` | `mcp-spring-webflux` | Spring WebFlux integration (SSE and Streamable HTTP) |
90-
| `mcp-spring-webmvc` | `mcp-spring-webmvc` | Spring WebMVC integration (SSE and Streamable HTTP) |
91-
92-
!!! tip
93-
A minimal adopter may depend only on `mcp` (core + Jackson 3), while a Spring-based application can add `mcp-spring-webflux` or `mcp-spring-webmvc` for deeper framework integration.
44+
Spring-specific transports (WebFlux, WebMVC) are now part of [Spring AI](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-overview.html) 2.0+ and are no longer shipped by this SDK.
45+
Use the [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-client-boot-starter-docs.html) and [MCP Server Boot Starter](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-server-boot-starter-docs.html) from Spring AI.
46+
Also consider the [MCP Annotations](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-annotations-overview.html) and [MCP Security](https://docs.spring.io/spring-ai/reference/2.0-SNAPSHOT/api/mcp/mcp-security.html).
9447

9548
## Next Steps
9649

0 commit comments

Comments
 (0)