SDK Contents
[Java MCP Overview] Java MCP Client Java MCP Server The Java SDK for the Model Context Protocol enables standardized integration between AI models and tools.Features
- MCP Client and MCP Server implementations supporting:
- Protocol version compatibility negotiation
- Tool discovery, execution, list change notifications
- Resource management with URI templates
- Prompt handling and management
- Completion argument autocompletion suggestions for prompts and resource URIs
- Progress progress tracking for long-running operations
- Ping lightweight health check mechanism
- Server Keepalive to maintain active server connections
- Logging for sending structured log messages to clients
- Roots list management and notifications
- Sampling support for AI model interactions
- Elicitation for servers to request additional information from users through the client
- Multiple transport implementations:
- Default transports (included in core
mcp
module, no external web frameworks required):- Stdio-based transport for process-based communication
- Java HttpClient-based
SSE
andStreamable-HTTP
client transport - Servlet-based
SSE
andStreamable-HTTP
server transport
- Optional Spring-based transports (convenience if using Spring Framework):
- WebFlux
SSE
andStreamable-HTTP
client and server transports - WebMVC
SSE
andStreamable-HTTP
transport for servlet-based HTTP streaming
- WebFlux
- Default transports (included in core
- Supports Synchronous and Asynchronous programming paradigms
The core
io.modelcontextprotocol.sdk:mcp
module provides default STDIO
, SSE
and Streamable-HTTP
client and server transport implementations without requiring external web frameworks.Spring-specific transports are available as optional dependencies for convenience when using the Spring AI Framework.Architecture
The SDK follows a layered architecture with clear separation of concerns:- Client/Server Layer (McpClient/McpServer): Both use McpSession for sync/async operations, with McpClient handling client-side protocol operations and McpServer managing server-side protocol operations.
- Session Layer (McpSession): Manages communication patterns and state using DefaultMcpSession implementation.
- Transport Layer (McpTransport): Handles JSON-RPC message serialization/deserialization via:
- StdioTransport (stdin/stdout) in the core module
- HTTP
Streamable-HTTP
andSSE
transports in dedicated transport modules (Java HttpClient, Spring WebFlux, Spring WebMVC)


- Client/Server Initialization: Transport setup, protocol compatibility check, capability negotiation, and implementation details exchange.
- Message Flow: JSON-RPC message handling with validation, type-safe response processing, and error handling.
- Resource Management: Resource discovery, URI template-based access, subscription system, and content retrieval.
Dependencies
Add the following dependencies to your project:The core MCP functionality:The core
mcp
module already includes default STDIO
, SSE
and Streamable-HTTP
transport implementations and doesn’t require external web frameworks.If you’re using the Spring Framework and want to use Spring-specific transport implementations, add one of the following optional dependencies:io.modelcontextprotocol.sdk:mcp-spring-webflux
- WebFlux-based Client and Server,Streamable-HTTP
andSSE
transport implementations. The WebFlux implementation can be used in reactive applications while the WebClient-based MCP Client can be used in both reactive and imperative applications. It is a highly scalable option and suitable and recommended for high-throughput scenarios.io.modelcontextprotocol.sdk:mcp-spring-webmvc
- WebMVC-based Server,Streamable-HTTP
andSSE
transport implementation for servlet-based applications.
Bill of Materials (BOM)
The Bill of Materials (BOM) declares the recommended versions of all the dependencies used by a given release. Using the BOM from your application’s build script avoids the need for you to specify and maintain the dependency versions yourself. Instead, the version of the BOM you’re using determines the utilized dependency versions. It also ensures that you’re using supported and tested versions of the dependencies by default, unless you choose to override them. Add the BOM to your project:Additional Dependencies
The following additional dependencies are available and managed by the BOM:io.modelcontextprotocol.sdk:mcp-test
- Testing utilities and support for MCP-based applications.