modelcontextprotocol/java-sdk
The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI
What it solves
The MCP Java SDK provides a standardized way for Java applications to communicate with AI models and tools. It bridges the gap between Java environments and the Model Context Protocol (MCP), allowing developers to build both clients that consume AI services and servers that expose tools and resources through a consistent interface.
How it works
The SDK uses a modular architecture that separates core logic from specific implementations. It handles complex asynchronous communication—such as streaming and bidirectional JSON-RPC—using Reactive Streams (via Project Reactor) while providing a synchronous facade for simpler, blocking use cases. It is transport-agnostic, supporting standard protocols like STDIO, HTTP, and Servlets, and allows developers to plug in their preferred JSON serialization libraries (defaulting to Jackson).
Who it’s for
This SDK is for Java developers building AI-integrated applications who need a reliable, production-ready implementation of the Model Context Protocol. It is particularly well-suited for those working within the Spring ecosystem, as it integrates directly with Spring AI for enhanced features like security, annotation-based handling, and web-based transport.
Highlights
- Standardized implementation of the Model Context Protocol for Java 17+.
- Built-in support for both synchronous and asynchronous communication patterns.
- Highly pluggable architecture for JSON serialization and transport layers.
- Deep integration with Spring AI for advanced features like OAuth 2.0 security and annotation-based configuration.
- Validated against the official MCP conformance test suite for high reliability.
Related
- Project
- Project
- Project
- Project
- Project