{"name":"java-sdk: The Official Java SDK for Model Context Protocol","description":"The `java-sdk` is the official Java SDK for interacting with Model Context Protocol servers and clients. It provides a standardized interface for Java applications to communicate with AI models and tools, supporting both synchronous and asynchronous patterns. Developed in collaboration with Spring AI, it offers robust integration for building AI-powered applications.","github":"https://github.com/modelcontextprotocol/java-sdk","url":"https://osrepos.com/repo/modelcontextprotocol-java-sdk","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/modelcontextprotocol-java-sdk","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/modelcontextprotocol-java-sdk.md","json":"https://osrepos.com/repo/modelcontextprotocol-java-sdk.json","topics":["Java","SDK","AI","Model Context Protocol","Spring AI","Reactive Programming","JSON-RPC","Open Source"],"keywords":["Java","SDK","AI","Model Context Protocol","Spring AI","Reactive Programming","JSON-RPC","Open Source"],"stars":null,"summary":"The `java-sdk` is the official Java SDK for interacting with Model Context Protocol servers and clients. It provides a standardized interface for Java applications to communicate with AI models and tools, supporting both synchronous and asynchronous patterns. Developed in collaboration with Spring AI, it offers robust integration for building AI-powered applications.","content":"## Introduction\n\nThe `java-sdk` is the official Java SDK designed to facilitate interaction with Model Context Protocol (MCP) servers and clients. This SDK empowers Java applications to seamlessly integrate with AI models and tools through a standardized interface, supporting both synchronous and asynchronous communication patterns. Maintained in collaboration with Spring AI, the `java-sdk` offers comprehensive support for building modern AI-driven applications, including Spring Boot integration for both client and server functionalities.\n\n## Installation\n\nTo get started with the `java-sdk`, you can build it directly from the source code. Stable releases are also available via Maven Central.\n\n### Building from Source\n\nTo build the project from its source code, execute the following command:\n\nbash\n./mvnw clean install -DskipTests\n\n\n### Running Tests\n\nTo run the tests, ensure you have Docker and npx pre-installed on your system.\n\nbash\n./mvnw test\n\n\nFor stable releases, you can find the `java-sdk` on [Maven Central](https://central.sonatype.com/artifact/io.modelcontextprotocol.sdk/mcp \"Maven Central\" target=\"_blank\").\n\n## Examples\n\nThe `java-sdk` provides extensive capabilities for both consuming and exposing Model Context Protocol endpoints. For detailed examples and comprehensive guides on using the SDK, refer to the official documentation:\n\n*   **MCP Java Client**: Learn how to use the MCP client to interact with MCP servers.\n    *   [Documentation Link](https://modelcontextprotocol.io/sdk/java/mcp-client \"MCP Java Client Documentation\" target=\"_blank\")\n*   **MCP Java Server**: Discover how to implement and configure MCP servers.\n    *   [Documentation Link](https://modelcontextprotocol.io/sdk/java/mcp-server \"MCP Java Server Documentation\" target=\"_blank\")\n\nAdditionally, for Spring-based applications, the SDK extends its functionality with Spring Boot integration, allowing for quick bootstrapping of AI applications:\n\n*   **Spring AI MCP Client Boot Starter**:\n    *   [Documentation Link](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html \"Spring AI MCP Client Boot Starter Documentation\" target=\"_blank\")\n*   **Spring AI MCP Server Boot Starter**:\n    *   [Documentation Link](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html \"Spring AI MCP Server Boot Starter Documentation\" target=\"_blank\")\n\nThese resources provide practical examples and detailed instructions to help you integrate MCP into your Java and Spring AI projects.\n\n## Why Use the java-sdk?\n\nThe `java-sdk` is built with a strong focus on pragmatism, interoperability, and pluggability, making it a robust choice for developing AI-powered applications in Java. Its design decisions address key challenges in the Java ecosystem, ensuring developers can be productive quickly while maintaining flexibility.\n\nKey aspects that make the `java-sdk` a compelling choice include:\n\n*   **Pragmatic Design**: The SDK aims to make developers productive quickly by providing sensible defaults and clear abstractions.\n*   **Interoperability**: It aligns with widely adopted libraries and practices in the Java ecosystem, such as Jackson for JSON serialization and SLF4J for logging.\n*   **Pluggability**: The architecture allows for alternatives where projects prefer different stacks, for example, by offering pluggable JSON libraries, client/server transports, and authorization hooks.\n*   **Thoughtful Technology Choices**:\n    *   **JSON Serialization**: Uses Jackson as the default, widely adopted and performant, but provides an abstraction (`mcp-json`) for easy swapping.\n    *   **Programming Model**: Leverages Reactive Streams with Project Reactor for asynchronous and streaming interactions, crucial for MCP's bidirectional protocol. A synchronous facade is also provided for simpler, blocking use cases.\n    *   **Observability**: Integrates SLF4J for logging and Reactor Context for propagating observability data across asynchronous boundaries, ensuring compatibility with modern tracing and metrics frameworks.\n    *   **Remote Clients and Servers**: Offers JDK HttpClient as the default client transport and Jakarta Servlet for server transport, with optional Spring WebClient, WebFlux, and WebMVC integrations for Spring-based projects. It also includes pluggable authorization hooks for server-side security.\n*   **Modular Structure**: The SDK is organized into distinct modules, allowing users to include only the necessary components, promoting lightweight and efficient dependency management.\n\n## Links\n\nExplore the `java-sdk` further through these official resources:\n\n*   **GitHub Repository**: [https://github.com/modelcontextprotocol/java-sdk](https://github.com/modelcontextprotocol/java-sdk \"GitHub Repository\" target=\"_blank\")\n*   **Issue Tracker**: [https://github.com/modelcontextprotocol/java-sdk/issues](https://github.com/modelcontextprotocol/java-sdk/issues \"Issue Tracker\" target=\"_blank\")\n*   **CI/CD**: [https://github.com/modelcontextprotocol/java-sdk/actions](https://github.com/modelcontextprotocol/java-sdk/actions \"CI/CD Actions\" target=\"_blank\")\n*   **Reference Documentation**: [https://modelcontextprotocol.io/sdk/java/mcp-overview](https://modelcontextprotocol.io/sdk/java/mcp-overview \"Reference Documentation\" target=\"_blank\")\n*   **Spring AI MCP Documentation**: [https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html \"Spring AI MCP Documentation\" target=\"_blank\")\n*   **Maven Central**: [https://central.sonatype.com/artifact/io.modelcontextprotocol.sdk/mcp](https://central.sonatype.com/artifact/io.modelcontextprotocol.sdk/mcp \"Maven Central\" target=\"_blank\")","metrics":{"detailViews":13,"githubClicks":8},"dates":{"published":null,"modified":"2026-02-11T12:01:23.000Z"}}