Mirror of https://github.com/modelcontextprotocol/java-sdk — The official Java SDK for Model Context Protocol servers and clients. Maintained in collaboration with Spring AI
- Java 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- Add JsonSchemaValidator interface and DefaultJsonSchemaValidator implementation - put the JsonSchemaValidator classes into a dedicated spec package - add schema caching to DefaultJsonSchemaValidator for better performance - Extend Tool schema to support outputSchema field for defining expected output structure - Add structuredContent field to CallToolResult for validated structured responses - Implement automatic validation of tool outputs against their defined schemas - Add comprehensive test coverage for structured output validation scenarios - Add json-schema-validator and json-unit-assertj dependencies for validation and testing - Update McpServer builders to accept custom JsonSchemaValidator instances - Ensure backward compatibility with existing tools without output schemas This implements the MCP specification requirement that tools with output schemas must provide structured results conforming to those schemas, with automatic validation and error handling for non-conforming outputs. https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> |
||
| .github | ||
| .mvn/wrapper | ||
| mcp | ||
| mcp-bom | ||
| mcp-spring | ||
| mcp-test | ||
| .gitattributes | ||
| .gitignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| migration-0.8.0.md | ||
| mvnw | ||
| mvnw.cmd | ||
| pom.xml | ||
| README.md | ||
| SECURITY.md | ||
MCP Java SDK
A set of projects that provide Java SDK integration for the Model Context Protocol. This SDK enables Java applications to interact with AI models and tools through a standardized interface, supporting both synchronous and asynchronous communication patterns.
📚 Reference Documentation
MCP Java SDK documentation
For comprehensive guides and SDK API documentation
- Features - Overview the features provided by the Java MCP SDK
- Architecture - Java MCP SDK architecture overview.
- Java Dependencies / BOM - Java dependencies and BOM.
- Java MCP Client - Learn how to use the MCP client to interact with MCP servers.
- Java MCP Server - Learn how to implement and configure a MCP servers.
Spring AI MCP documentation
Spring AI MCP extends the MCP Java SDK with Spring Boot integration, providing both client and server starters. Bootstrap your AI applications with MCP support using Spring Initializer.
Development
Building from Source
./mvnw clean install -DskipTests
Running Tests
To run the tests you have to pre-install Docker and npx.
./mvnw test
Contributing
Contributions are welcome! Please follow the Contributing Guidelines.
Team
- Christian Tzolov
- Dariusz Jędrzejczyk
Links
License
This project is licensed under the MIT License.