MCP Java SDK

Active
GitHub Java MIT

Description

Official Java SDK for the Model Context Protocol, with Spring-style APIs, reactive and blocking clients, and Maven Central distribution.

Key Features

  • Official Java SDK distributed via Maven Central, kept in lockstep with the MCP spec
  • Spring Boot starter for auto-configured MCP servers and clients
  • Reactive Stream-based async client built on Project Reactor
  • Annotation-driven tool and resource definition mirroring the TypeScript SDK
  • Server-Sent Events and Streamable HTTP transports for browser and server integrations
  • Used by Spring AI and other enterprise agent frameworks

Use Cases

💡 Adding MCP server capabilities to Spring Boot microservices
💡 Exposing internal Java tools to LLM agents via a typed MCP client
💡 Building reactive MCP backends that handle high-concurrency tool calls
💡 Authoring MCP servers with annotation-driven tool definitions in JVM languages
💡 Bridging Apache Camel or Kafka pipelines to MCP-compatible tool surfaces

Quick Start

// pom.xml
<dependency>
  <groupId>io.modelcontextprotocol</groupId>
  <artifactId>mcp-sdk</artifactId>
  <version>0.9.0</version>
</dependency>

// McpServer.java
@McpServer("demo")
public class DemoServer {
  @McpTool(name = "echo")
  public String echo(String input) { return input; }
}

Related Projects