Java SDK for the Model Context Protocol (MCP), providing seamless integration between Java and Spring applications and MCP-compliant AI models and tools.
Set of projects that provide Java SDK and Spring Framework integration for the Model Context Protocol. It enables Java applications to interact with AI models and tools through a standardized interface, supporting both synchronous and asynchronous communication patterns.
For comprehensive guides and API documentation, visit the Spring AI MCP Reference Documentation.
Java implementation of the Model Context Protocol specification. It includes:
StdioClientTransport
, StdioServerTransport
) for process-based communicationHttpClientSseClientTransport
) for HTTP streamingHttpServletSseServerTransport
) for HTTP SSE Server streaming using traditional Servlet APIHttpClientSseClientTransport
transport as a SSE client.The Spring integration module provides Spring-specific functionality:
Add the following dependencies to your Maven project:
<!-- Core MCP -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>mcp</artifactId>
</dependency>
<!-- Optional: WebFlux SSE transport -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>mcp-webflux-sse-transport</artifactId>
</dependency>
<!-- Optional: WebMVC SSE transport -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>mcp-webmvc-sse-transport</artifactId>
</dependency>
<!-- Optional: Spring AI integration -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-ai-mcp</artifactId>
</dependency>
This is a milestone release, not available on Maven Central. Add this repository to your POM:
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Reffer to the Dependency Management page for more information.
Explore these MCP examples in the spring-ai-examples/model-context-protocol repository:
mvn clean install
mvn test
This is an experimental Spring project. Contributions are welcome! Please:
This project is licensed under the Apache License 2.0.